how do I force use of hosts file?

B

BobGardner

I have a winsock app to send udp datagrams to an embedded controller. I put the
eth add of the controller in the arp table, and I put the 'dummy' ip add in a
line in the hosts file. So I create the socket and fill in the ip addr, it
should look up the eth addr in the arp table, right?
I have an entry in the hosts file with the ip address and ethernet address of
my device. When I open the socket to that ip address, the sniffer shows it
sending the packet off to the default gateway. This all worked last week till
the network guy changed everything from 192.168.1.1 thru 200 to 5.1 thru 5.99.
My device is still 192.168.1.200. I should be able to send a udp datagram to
that ip addr, and have it look up the eth addr in the host file, right? What
got messed up and how do I change it back?!? Thanks!
 
J

John Wunderlich

(e-mail address removed) (BobGardner) wrote in
I have a winsock app to send udp datagrams to an embedded
controller. I put the eth add of the controller in the arp table,
and I put the 'dummy' ip add in a line in the hosts file. So I
create the socket and fill in the ip addr, it should look up the
eth addr in the arp table, right?

If it is in the same subnet as your device, it will. If it is in a
different subnet (or thinks it is), then it will send the packet to the
gateway device.
[...] I should be able to send a udp datagram to that ip addr, and
have it look up the eth addr in the host file, right?

The hosts file will convert an IP _name_ to an IP _address_. Given the
IP address, the _Ethernet_ address will be looked-up in the ARP table
if it hasn't expired from there and found by broadcast if it has.

It sounds as if your network admin has moved all devices into a
different subnet except your machine so your machine is always
searching for the gateway device to route packets to the destination.
Type "netstat -rn" to see the routing table and see how your packets
will be routed.

HTH,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top