LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Double default gw in routing table ?? Help!! (https://www.linuxquestions.org/questions/linux-networking-3/double-default-gw-in-routing-table-help-204358/)

poj 07-13-2004 12:19 AM

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.

pingu 07-13-2004 02:33 AM

Why do you need to delete it?
It shouldn't cause you any trouble, the double entries points to the same direction.

poj 07-13-2004 02:58 AM

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:(

poj 07-13-2004 03:08 AM

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:

pingu 07-13-2004 03:12 AM

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.)

muff 07-13-2004 03:23 AM

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

poj 07-13-2004 03:26 AM

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)

poj 07-13-2004 03:38 AM

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

muff 07-13-2004 03:54 AM

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?

poj 07-13-2004 04:07 AM

muff,

no route command in rc.local script. problem is I can not ftp from other to this machine(the one has 2 gw).

muff 07-13-2004 04:20 AM

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

poj 07-13-2004 04:51 AM

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:

ppuru 07-13-2004 05:00 AM

can you try changing ifcfg-eth0 to ifcfg-eth0:0 or eth0:2.

not sure if this will alleviate you problem ...

muff 07-13-2004 05:13 AM

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.

maxut 07-13-2004 06:24 AM

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 05:12 PM.