Double default gw in routing table ?? Help!!
Hi,
My system is Redhat9 with 1 network on board. I set up 2 ip address(alias), one is 202.x.x.z with GW (202.x.x.x) and the other for local is 192.x.x.x with GW 192.168.1.1 My propblem is every time I reboot machine the routing table will have double default gateway. eg. when I type 'route' routing table will come up like this. Destination Gateway Genmask Flags Metric Ref Use Iface 202.x.x.y * 255.255.255.224 U 0 0 0 eth0 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default 202.x.x.x 0.0.0.0 UG 0 0 0 eth0 default 202.x.x.x 0.0.0.0 UG 0 0 0 eth0 default 192.168.1.1 0.0.0.0 UG 1 0 0 eth0 So, I must manually delete it every time i reboot machine. Any idea, Help me please. Sorry for my poor english. |
Why do you need to delete it?
It shouldn't cause you any trouble, the double entries points to the same direction. |
pingu,
I need to delete it because if it has double gw I can not telnet, ftp etc from other machine. It look like request can go into that box but don't know which gateway to send response back(even it's same). it will generate time out:( |
another thing is,
If I delete the local ip(192.x.x.x), routing table will look ok. Destination Gateway Genmask Flags Metric Ref Use Iface 202.x.x.y * 255.255.255.224 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default 202.x.x.x 0.0.0.0 UG 0 0 0 eth0 and work fine. anyway this box need to has local ip to connect to thedatabase box. So help me plzzz:confused: |
Reading again, I notice the subnetmask 255.255.255.224
This gives you 2 subnets for 202.x.x.x: Network 1 range 202.1.1.0 - 202.1.1.31 Network 2 range 202.1.1.32 - 202.1.1.255 which could explain the double entries. Could you post the output of 'ifconfig', also iptables configuration (or whatever you have) (It would also be easier if you could post the complete IP's, I guess it's for security precautions you don't do that.) |
poj,
Are you saying that eth0 is connected to both your internet connection and also to your local network? Is that why you have two ip addresses on the same interface? So essentially you have two addressing schemes on the same network segment? Can you tell me what it says in your /etc/sysconfig/network-scripts/ifcfg-eth0? If I have guessed correctly, then I think you are going to need to define subinterfaces. So eth0 would have the public ip address, and then you would define a new interface eth0:0 that had the ip address of the local network. Then you could have seperate routing for the local network and the internet. Have a look at this: http://tldp.org/HOWTO/IP-Alias/index.html and see how you get on. koan |
output from ifconfig is
eth0 Link encap:Ethernet HWaddr 00:E0:4C:81:D0:E5 inet addr:202.183.x.y Bcast:202.183.x.127 Mask:255.255.255.224 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:31771 errors:0 dropped:0 overruns:0 frame:0 TX packets:16833 errors:0 dropped:0 overruns:0 carrier:0 collisions:4909 txqueuelen:100 RX bytes:4592806 (4.3 Mb) TX bytes:1568848 (1.4 Mb) Interrupt:5 Base address:0x2000 eth0:1 Link encap:Ethernet HWaddr 00:E0:4C:81:D0:E5 inet addr:192.168.1.57 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:31771 errors:0 dropped:0 overruns:0 frame:0 TX packets:16833 errors:0 dropped:0 overruns:0 carrier:0 collisions:4909 txqueuelen:100 RX bytes:4592806 (4.3 Mb) TX bytes:1568848 (1.4 Mb) Interrupt:5 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:94 errors:0 dropped:0 overruns:0 frame:0 TX packets:94 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:7708 (7.5 Kb) TX bytes:7708 (7.5 Kb) |
muff,
I already define it as alias(I use tool in KDE). my ifcfg-eth0 is DEVICE=eth0 ONBOOT=yes BOOTPROTO=none IPADDR=202.183.x.y NETMASK=255.255.255.224 GATEWAY=202.183.x.97 TYPE=Ethernet USERCTL=no PEERDNS=yes NETWORK=202.183.219.96 BROADCAST=202.183.219.127 HWADDR=00:e0:4c:81:d0:e5 and this is ifcfg-eth0:1 GATEWAY=192.168.1.1 TYPE=Ethernet DEVICE=eth0:1 HWADDR=00:e0:4c:81:d0:e5 BOOTPROTO=none NETMASK=255.255.255.0 ONBOOT=yes IPADDR=192.168.1.57 USERCTL=no PEERDNS=yes NETWORK=192.168.1.0 BROADCAST=192.168.1.255 |
Hmmm.
Ok, so you have two subinterfaces defined, and you can see your two gateways right (the define default routes)? What I don't understand is why the route has eth0 rather than eth0:1 If you look in /etc/rc.d/rc.local, can you see any route commands? When ftp doesn't work for you, is it from this machine to the internet that doesn't work, or from the other local machine to this one that doesn't work? |
muff,
no route command in rc.local script. problem is I can not ftp from other to this machine(the one has 2 gw). |
Ok, lets force the issue.
I imagine what is happening is that the first packet is coming arriving at "this" machine, with a destination of 192.168.0.x. It checks its routing table, and cannot find an entry for that network, so it sends it to the router, where it gets lost. Try /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0:1 |
thanks muff,
this problem will be solved if i manually delete the redundant gw but it will come back when reboot the machine. maybe there are some network scripts or config files that will be call when sytem startup. What i don't know is where i should go to check.:confused: |
can you try changing ifcfg-eth0 to ifcfg-eth0:0 or eth0:2.
not sure if this will alleviate you problem ... |
I am not sure where you should look exactly either.
I was heading toward a workaround - if you add your delete command to the rc.local file, or the route add command I suggested, it will save you doing it manually. My experience with routing says that you should always do it manually. I would take the gateways out of the ifcfg files and manually add routes to rc.local. This doesn't explain what is going wrong however. |
as i know there are some routing files. here are the files i know:
1- /etc/sysconfig/network-scripts/$NICK.route this type of files adds static routes for that net device ($NICK) 2- it is possible to define gateway in /etc/sysconfig/network file also. 3- for redhat like systems, it is possible to define static route in /etc/sysconfig/static-routes file. maybe this file isnt exist, but network script search it. actually u can find what files are readed for your network config: check your network init script. |
All times are GMT -5. The time now is 02:54 PM. |