using hosts/lmhosts for own computer name in multi-homed system

  • Thread starter Thread starter thammond
  • Start date Start date
T

thammond

From what I have seen, I can use the hosts and lmhosts files to
configure the IP Addresses returned by gethostbyname() for any computer
name _except_ local host's computer name (i.e. the name returned by
typing "hostname" at a command prompt). Can anyone back that up, or
prove me wrong?

I have a multi-homed computer using XP Embedded. I need my computer
name to always resolve to the first IP address on "Local Area
Connection" (has a static IP address). But I have seen it get resolved
to one of the static IP addresses on my second network card on
different targets. Sounds like a minor issue, but it screws up the 3rd
party software I have to integrate with. The only advice people have
is to add an entry to the hosts and lmhosts files, but I have found
that any entry I put in these files for my own computer name is
completely ignored.

Got any suggestions?
Thanks.

- Tony H.
 
configure the IP Addresses returned by gethostbyname() for any computer
name _except_ local host's computer name (i.e. the name returned by
typing "hostname" at a command prompt). Can anyone back that up, or
prove me wrong?

I have a multi-homed computer using XP Embedded. I need my computer
name to always resolve to the first IP address on "Local Area
Connection" (has a static IP address). But I have seen it get resolved
to one of the static IP addresses on my second network card on
different targets. Sounds like a minor issue, but it screws up the 3rd
party software I have to integrate with. The only advice people have
is to add an entry to the hosts and lmhosts files, but I have found
that any entry I put in these files for my own computer name is
completely ignored.

Got any suggestions?
Thanks.

- Tony H.

Tony,

What Node Type are the other computers in question?
http://support.microsoft.com/?id=160177

And Tony, posting your email address openly will get you more unwanted email,
than wanted email. Learn to munge your email address properly, to keep yourself
a bit safer when posting to open forums. Protect yourself and the rest of the
internet - read this article.
http://www.mailmsg.com/SPAM_munging.htm
 
Chuck,

I looked at that link, and that may be a clue to my problem. I'll have
to wait until the hardware is available for me to test on.

But let's say I have a multi-homed computer, and I assigned some static
IP addresses to each of its 2 network cards. My computer name is, for
example, "TARGET1". I am writing an application that calls
gethostbyname("TARGET1"). How can I guarantee which IP address is
resolved/returned? If I made the NodeType type-h, does that mean I
could use hosts or lmhosts to resolve the IP address for MY OWN
COMPUTERNAME? (I already have the IP addresses set up on the NICs, I
just need Windows to return the one I want for calls to gethostbyname()
). I don't have trouble resolving external host IP addresses.

.... and as far as the Email address, I found that out the hard way. I
was new to newsgroups when I started investigating Windows issues, and
accessing the groups through Google requires that you enter a valid
Email address. I didn't think to go out and get a junk address for
that purpose. I'll do that in the future though. Thanks for the tip.

- Tony H.
 
Chuck,

I looked at that link, and that may be a clue to my problem. I'll have
to wait until the hardware is available for me to test on.

But let's say I have a multi-homed computer, and I assigned some static
IP addresses to each of its 2 network cards. My computer name is, for
example, "TARGET1". I am writing an application that calls
gethostbyname("TARGET1"). How can I guarantee which IP address is
resolved/returned? If I made the NodeType type-h, does that mean I
could use hosts or lmhosts to resolve the IP address for MY OWN
COMPUTERNAME? (I already have the IP addresses set up on the NICs, I
just need Windows to return the one I want for calls to gethostbyname()
). I don't have trouble resolving external host IP addresses.

... and as far as the Email address, I found that out the hard way. I
was new to newsgroups when I started investigating Windows issues, and
accessing the groups through Google requires that you enter a valid
Email address. I didn't think to go out and get a junk address for
that purpose. I'll do that in the future though. Thanks for the tip.

Tony,

If you enable DNS based name resolution (H or M Node - with H more useful in
this case), you can define the ip address for the multi-homed host.

This is not something that comes up too frequently - I've worked with
multi-homed hosts before, but only with a corporate network, with P-Node
systems. I guess H-Node (DNS then broadcast) in a workgroup is equivalent to
P-Node in a domain (WINS) structure.
 
Back
Top