LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 06-12-2006, 03:35 PM   #1
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Rep: Reputation: 15
Question Cannot contact external hosts, route resets after setting gateway


Ok, I have an old Linux box, which is just serving as a mail server on a private LAN, but for some reason, it is unable to contact hosts from outside the LAN. I think that it is a routing issue. The gateway that it should be using is located at 192.168.10.101, but it is not using it. That would be a simple problem, but when I use 'route' to register the gateway, the new entry in the routing tables only sticks for around 15 seconds. Demo:
Code:
[root@lcmme /root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.0.0     U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
[root@lcmme /root]# ping google.com
connect: Network is unreachable
[root@lcmme /root]# route add default gw 192.168.10.101
[root@lcmme /root]# ping google.com
PING google.com (64.233.167.99) from 192.168.10.103 : 56(84) bytes of data.
64 bytes from 64.233.167.99: icmp_seq=0 ttl=240 time=90.177 msec
64 bytes from 64.233.167.99: icmp_seq=1 ttl=240 time=89.326 msec
64 bytes from 64.233.167.99: icmp_seq=2 ttl=240 time=89.127 msec
ping: sendto: Network is unreachable
ping: wrote google.com 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote google.com 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote google.com 64 chars, ret=-1
So, it knows how to get to the LAN, that is the first line of route. It knows how to get to itself, that is the second line of route. When I add the gateway to get to the WAN, I am able to contact external hosts. But it only lasts for a brief moment. The ping works, then dies part way through.

Does anybody have any ideas why this might be happening?
 
Old 06-12-2006, 11:15 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Is this on Fedora?

Is this a single interface?

Is there a reason you're doing this on the command line rather than in the config files?

Don't see too many folk from Las Cruces. I used to live there for a bit when I was in school.
 
Old 06-12-2006, 11:59 PM   #3
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
It is a terribly terribly old RH7 box. Shaddup. Don't even start. I would upgrade it if I could, but I can't bring it down. It is running a 2.2 kernel. Trust me when I say I know how much that sucks.

Yes it is a single interface. There is only one physical device, and it is set as eth0.

I would not know what config files to edit, or what the syntax for them should be. Shouldn't the command line tools change the config files for me?
 
Old 06-13-2006, 12:00 AM   #4
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
(Edit: This post was a dupe)
 
Old 06-13-2006, 01:30 PM   #5
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by pyrosim
It is a terribly terribly old RH7 box. Shaddup. Don't even start. I would upgrade it if I could, but I can't bring it down. It is running a 2.2 kernel. Trust me when I say I know how much that sucks.

Yes it is a single interface. There is only one physical device, and it is set as eth0.

I would not know what config files to edit, or what the syntax for them should be. Shouldn't the command line tools change the config files for me?
To answer your question - no, the commnd line stuff does not change files. It only changes setting for the current session. If you were to reboot the computer or restart the network, settings will be gathered from the files & the changes you made at the command line would be lost.

Man, I just brought down my last RH7 box about a month ago. I believe the files are located in /etc/sysconfig/network (just like the more recent Red Hats & Fedoras). there's probably something called ifup.eth0 (or something like that) in there that has all that you need.

All that said, what you're doing, albeit the hard way, does not seem to be wrong. There may be other problems at play here.

If I were you, I'd try to find those files, see what they contain, they try restarting the network through init.d.... i.e. as root, run "/etc/init.d/network restart" (where 'network' is the name of the network startup script - it may not be called network, but it will exist in /etc/init.d).

I know that's not much help... but... good luck!
 
Old 06-14-2006, 12:21 AM   #6
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
The only config file with any relevance to routing I have been able to find is "/etc/static-routes", and it is completely empty. There are many config files in /etc/sysconfig/networking, but a quick grep shows that none of them make any mention of "route", "gateway", or "ARP" (Case insensitive, all). Affecting the one session should be enough though. If I could even just reboot that sucker, it would have a new kernel two stable Y versions newer. It is strange that the routing table will reset in the middle of the ping. I find that very odd. It only lasts for a seemingly arbitrary (short) amount of time, then resets. Nobody knows why that might be happening?
 
Old 06-14-2006, 01:56 AM   #7
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
Could you post the results of:
Code:
#route -n
Then try to add the new route again, but this time specify the device used to reach the router.
Code:
#route add default gw 192.168.10.101 dev eth0
Then check the contents of the routing table again and post the results.
 
Old 06-14-2006, 02:39 PM   #8
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
This is all the same as before.

Code:
[root@lcmme /root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
Code:
[root@lcmme /root]# route add default gw 192.168.10.101 dev eth0
[root@lcmme /root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.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         192.168.10.101  0.0.0.0         UG    0      0        0 eth0
[root@lcmme /root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.0.0     U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
The table changes, but the new entry lasts for only seconds.

Last edited by pyrosim; 06-14-2006 at 04:43 PM.
 
Old 06-14-2006, 08:10 PM   #9
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
[Edit]
Not sure if this will actually help, but just noticed you're routing table says you're on class B network 192.168.0.0. Is this correct for your setup? Or should the machine be on the class C 192.168.10.0 network?
[/EDIT]

Last edited by Notwerk; 06-14-2006 at 08:26 PM.
 
Old 06-14-2006, 09:34 PM   #10
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
It is supposed to be on the class B subnet. The LAN has computers with different 3rd quads.

Nothing? Anyone?
 
Old 06-15-2006, 01:36 AM   #11
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
Again, another shot in the dark...
Quote:
default 192.168.10.101 0.0.0.0 UG 0 0 0 eth0
Shouldn't this be:
Code:
0.0.0.0   192.168.10.101  0.0.0.0     UG   0   0   0 eth0
Maybe you should look into the syntax for "route" for RH7???
 
Old 06-15-2006, 09:27 AM   #12
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
The manpage says that it should show up that way.

From the manpage:
Code:
EXAMPLES
...
       route add default gw mango-gw
              adds a default route (which will be used if no other route matches).  All packets using this route
              will be gatewayed through "mango-gw".
I am sure the fact that it is not a named host has nothing to do with it.

Last edited by pyrosim; 06-15-2006 at 09:28 AM.
 
Old 06-26-2006, 01:21 PM   #13
pyrosim
Member
 
Registered: Jul 2005
Location: Las Cruces, NM
Distribution: Fedora
Posts: 49

Original Poster
Rep: Reputation: 15
I have solved this problem, though I still do not understand it, by using the Redhat 'netcfg' GUI to add a gateway route. It seems to have changed the /etc/sysconfig/static-routes file. I was looking at editing that file manually earlier, but I could not find any explanations of the syntax of it. This is the line it added:
Code:
eth0 net default netmask 0.0.0.0 gw 192.168.10.101
It may have also made other changes, but if it did, I do not know about them.

In any case, the problem is solved.
 
Old 06-27-2006, 01:34 AM   #14
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
Glad to hear you got it working

Hmmm... this is a first... never realized RH7 behaved like this when it comes to routing.

Cheers
 
  


Reply

Tags
routing



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
External Hosts Resolve but Local Hosts Do Not kjm9 Linux - Networking 7 11-19-2005 03:51 PM
Can I route web traffic to 2 different hosts based on URL under 1 IP Address? Marshalle Linux - Networking 5 05-14-2005 03:02 AM
My gateway can't route michaelsanford Linux - Networking 0 04-20-2005 05:05 PM
dhclient not setting default gateway - no WAN route kadissie Linux - Networking 2 03-10-2005 04:55 AM
setting an external IP address and a gateway moreblessings Linux - Networking 1 01-24-2005 11:29 AM

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

All times are GMT -5. The time now is 07:23 PM.

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
Open Source Consulting | Domain Registration