Static DCHP problems
Dear All,
I have 2 linux boxes on the same network. They first host has the following /etc/network/interface file: auto eth0 iface eth0 inet static address 192.168.1.101 netmask 255.255.255.0 gateway 192.168.1.254 auto lo iface lo inet loopback The second is identical but the address is: 192.168.1.102 The first host works fine. The second host can see machines on the network (e.g. 192.168.1.101) but cannot see the gateway (ping 192.168.1.254 gives destination host unreachable). If I change the second host to DCHP. The second host works fine. The only other clue I can see is that using a static ip the mac address for the 2nd host is wrong when I log into the router, i.e. the last digit in the mac address is 1 higher than it should be: i.e. 11:12:13:14:01 instead of 11:12:13:14:00 Any thoughts? |
Have you got a default route set on the failing machine? Run the command 'netstat -r' without the quotes, and see if one is set. It will look something like this:
Quote:
|
This is what netsat gives me with the static config
scott@www:/etc/network$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 192.168.1.254 0.0.0.0 UG 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 and with the working DCHP scott@www:/etc/network$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default O2WirelessBox.l 0.0.0.0 UG 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 The only difference I see is that the working config knows the gateway's A name, 192.168.1.254 = O2WirelessBox. I could do with some further help. |
Could you post the results of '/sbin/ifconfig eth0' for both scenarios? Could you post the error message(s) you get when it is failing.
|
this is the working dchp ifconfig
scott@www:/etc/network$ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:21:9b:fa:4f:00 inet addr:192.168.1.74 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::221:9bff:fefa:4f00/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8136 errors:0 dropped:0 overruns:0 frame:0 TX packets:5606 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8556095 (8.5 MB) TX bytes:729836 (729.8 KB) Interrupt:16 this is static and doesn't work eth0 Link encap:Ethernet HWaddr 00:21:9b:fa:4f:00 inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::221:9bff:fefa:4f00/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12 errors:0 dropped:0 overruns:0 frame:0 TX packets:43 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1273 (1.2 KB) TX bytes:6973 (6.9 KB) Interrupt:16 e.g. ^Cscott@www:/etc/network$ ping 192.168.1.254 PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data. From 192.168.1.102 icmp_seq=1 Destination Host Unreachable |
I don't see any problems with any of your settings.
What happens if you change the machine that is 101 to 102, and the 102 to 101? Just wondering if this is router config problem. |
Well, swapping 102 and 101 allows the now working box to connect but the box which was working no longer works, i.e. 192.168.1.101 allways works regardless of the box but 102 never works. I take it this means that the problem is indeed with the router. I appreciate the help i've been given so far but I am afraid I need more help as this is all getting a bit beyond me.
|
Do you have a file /etc/hosts on either, or both machines? If yes, would you post the contents?
Do you know how to connect to the router, and look at the configuration? If not, post the make and model number. There is probably doc online. |
The hosts file looks like this (both machines are the same except the second line).
127.0.0.1 localhost 127.0.1.1 www # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters I normally connect to the router through a web browser by pointing it at 192.168.1.254, which works, except on 192.168.1.102. The router is a Thomson Gateway TG585, not sure of the version I think it is V7 |
Mmmm. I have changed the non working host to 192.168.1.201 and it works. 192.168.1.101 also works so it looks like a router issue. The router is a cheapo thing provided by my ISP and may not be up to the task.
I am not wedded to having my servers as 101 and 102 so I think I'll just give them new numbers and move on. Thanks for all the help, which was really prompt, to the point and, er, helpful. |
There doesn't appear to be anything I see wrong in /etc/hosts. So, It would appear to be related to your router.
I'm not familiar with our router. My comments will have to remain general. Most routers you can set the range of addresses the DHCP server will give out, the ones I have had are in groups of four. Most routers are set for class C networks ( like yours ) to allow all addresses ( 254 ) to DHCP. Depending on the number of devices you have that rely on DHCP, set a value that leaves some addresses of the 254 not in the DHCP range. These ones you can use for static addresses. The routers I have had, this doesn't seem to matter. I have set static addresses within this range, and all was well. The problem you can have, is if the router has given out the IP you want to use for a static address, and you turn that device on, it won't get in. Beyond that, there is some security ( small ) risk with having a DHCP range much greater than the number of devices you might want using DHCP. Is this a wireless router? My guess is yes, most home routers are WAP's. You might want to look to see if there is any code updates for the router. This is a bit of a long shot, however, this problem doesn't seem to make sense. Looks like we were both typing at the same time. Glad you found a work around. |
All times are GMT -5. The time now is 03:30 AM. |