LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-13-2004, 12:19 AM   #1
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Rep: Reputation: 0
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.
 
Old 07-13-2004, 02:33 AM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Why do you need to delete it?
It shouldn't cause you any trouble, the double entries points to the same direction.
 
Old 07-13-2004, 02:58 AM   #3
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
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
 
Old 07-13-2004, 03:08 AM   #4
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
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

Last edited by poj; 07-13-2004 at 03:10 AM.
 
Old 07-13-2004, 03:12 AM   #5
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
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.)
 
Old 07-13-2004, 03:23 AM   #6
muff
Member
 
Registered: Jan 2003
Distribution: Gentoo / Arch / OpenSuse / Ubuntu / LMDE / Centos
Posts: 44

Rep: Reputation: 15
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
 
Old 07-13-2004, 03:26 AM   #7
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
output from ifconfig is


eth0 Link encap:Ethernet HWaddr 00:E0:4C:810: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:810: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)

Last edited by poj; 07-13-2004 at 03:42 AM.
 
Old 07-13-2004, 03:38 AM   #8
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
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

Last edited by poj; 07-13-2004 at 03:42 AM.
 
Old 07-13-2004, 03:54 AM   #9
muff
Member
 
Registered: Jan 2003
Distribution: Gentoo / Arch / OpenSuse / Ubuntu / LMDE / Centos
Posts: 44

Rep: Reputation: 15
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?
 
Old 07-13-2004, 04:07 AM   #10
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
muff,

no route command in rc.local script. problem is I can not ftp from other to this machine(the one has 2 gw).
 
Old 07-13-2004, 04:20 AM   #11
muff
Member
 
Registered: Jan 2003
Distribution: Gentoo / Arch / OpenSuse / Ubuntu / LMDE / Centos
Posts: 44

Rep: Reputation: 15
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
 
Old 07-13-2004, 04:51 AM   #12
poj
LQ Newbie
 
Registered: Oct 2003
Location: Bangkok, Thailand.
Distribution: Debian,Ubuntu
Posts: 19

Original Poster
Rep: Reputation: 0
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.
 
Old 07-13-2004, 05:00 AM   #13
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

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

not sure if this will alleviate you problem ...
 
Old 07-13-2004, 05:13 AM   #14
muff
Member
 
Registered: Jan 2003
Distribution: Gentoo / Arch / OpenSuse / Ubuntu / LMDE / Centos
Posts: 44

Rep: Reputation: 15
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.
 
Old 07-13-2004, 06:24 AM   #15
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
routing table arvind kumar Linux - Networking 2 06-08-2005 11:59 PM
Help with a Routing Table maginotjr Linux - Networking 4 06-06-2005 09:49 AM
how to set default entry in routing table? cranium2004 Linux - Networking 7 03-15-2005 05:26 PM
Default Gateway Not Listed In Routing Table krazyace78 Linux - Networking 0 10-05-2004 12:09 PM
routing table upr8830 Linux - Networking 6 06-18-2003 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration