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-17-2003, 01:32 PM   #1
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Rep: Reputation: 0
Cannot change default gateway


I'm hoping this is an easy one for somebody out there...

I have a RedHat 6.2 server that has recently been connected to the outside world. The server was initially installed with a bogus gateway from a different subnet than what they are currently on. Now that we have a firewall in place I need to change the gateway.

I run linuxconf and change the default gateway. I reboot the server. I can ping the server from another machine but cannot ping out from the server. Not even to any machines on the LAN. I try to telnet into the machine and the session fails to connect. I run the route command and it hangs for a couple if minutes and finally gives me some output. It looks like it took the settings but something is getting screwed up in the process.

The /etc/sysconfig/network file looks fine and has the gateway defined.

The only way I can make it work again is by changing the default gateway back to the original IP address.

There is only one adapter on the machine.

I have found some info on the web about this but I must be missing something.
 
Old 07-17-2003, 01:37 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,601

Rep: Reputation: 202Reputation: 202Reputation: 202
What do you get when you run the command 'route'? BTW A console command to change default gateway is:
route del default
route add default gw your_gateway_here
 
Old 07-17-2003, 02:19 PM   #3
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
When the I run 'route' with the non working gateway in place, this is what I get:

[root@creek_linux /sbin]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.51 * 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
[root@creek_linux /sbin]#

When I put the new gateway in place, it hangs at:

Destination Gateway Genmask Flags Metric Ref Use Iface


for about 2 minutes then gives me the rest of the output including the new line with the default gateway.

(I can't get the exact line that it outputs right now)

I tried using the commands that you said when I was troubleshooting earlier. Whenever I monkey'd with the gateway though is when everything stopped working.
 
Old 07-17-2003, 05:43 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,601

Rep: Reputation: 202Reputation: 202Reputation: 202
It looks OK and it can take some time for 'route' to show the table with gateway. Is the gateway close to the machine? It shouldn't take 2 min...
 
Old 07-17-2003, 05:47 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Try:
route -n

That shoud stop any name lookups.
 
Old 07-17-2003, 05:51 PM   #6
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
Yeah, just a switch away.

It definitely hoses something when I switch it though. I can't telnet in or anything.
 
Old 07-17-2003, 05:54 PM   #7
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
route -n does work just fine.

It return the info back quickly and it looks correct.

Now what do I do?
 
Old 07-17-2003, 05:58 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Does it have a lines starting with:
0.0.0.0

That is your default route. Is the gateway right? There should be a G in the Flags column too.
 
Old 07-17-2003, 06:11 PM   #9
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
When I put in the correct gateway and do a route -n it has this line at the end:

0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

This is the correct gateway.
 
Old 07-18-2003, 01:48 PM   #10
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Can you post the output of:
ifconfig

Can you do the same on one of the other machines on the network ("ipconfig /all" if you do it from windows).
 
Old 07-22-2003, 03:32 PM   #11
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
You will see that the gateway is currently set up wrong. The gateway address is 192.168.37.5 and it should be 192.168.1.1. When I change this address or even change the network file to reference the correct gateway device, it hoses the machine and no one can connect. Here is the output you requested:

[root@creek_linux /sbin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:AC:5D:CC:BB
inet addr:192.168.1.51 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:120066 errors:0 dropped:0 overruns:0 frame:0
TX packets:120817 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:15 Base address:0x2000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

[root@creek_linux /sbin]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.51 * 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo

[root@creek_linux /sbin]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.51 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

[root@creek_linux sysconfig]# more network
NETWORKING=yes
HOSTNAME="creek_linux"
GATEWAY="192.168.37.5"
GATEWAYDEV=""
FORWARD_IPV4="no"


Windows 98 IP Configuration



Host Name . . . . . . . . . : Hugh

DNS Servers . . . . . . . . : 209.20.130.33

209.20.130.35

Node Type . . . . . . . . . : Broadcast

NetBIOS Scope ID. . . . . . :

IP Routing Enabled. . . . . : No

WINS Proxy Enabled. . . . . : No

NetBIOS Resolution Uses DNS : Yes



0 Ethernet adapter :



Description . . . . . . . . : The PCI Fast Ethernet Adapter.

Physical Address. . . . . . : 00-E0-7D-01-EF-BC

DHCP Enabled. . . . . . . . : No

IP Address. . . . . . . . . : 192.168.1.102

Subnet Mask . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . : 192.168.1.1

Primary WINS Server . . . . :

Secondary WINS Server . . . :

Lease Obtained. . . . . . . :

Lease Expires . . . . . . . :
 
Old 07-23-2003, 01:24 PM   #12
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You don't actuallly have a default route in place though. Try:
route add default gw 192.168.1.1
 
Old 07-23-2003, 01:30 PM   #13
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
I have tried that and as soon as I do, it messes up the networking. Anytime I add or change a gateway in any shape or form, it kills networking. Do you think it could be driver related?
 
Old 07-23-2003, 01:36 PM   #14
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
how do you mean it messes up the networking? Do you get net access but nothing else? Can you post your route and ifconfig outputs in this state.
 
Old 07-23-2003, 01:41 PM   #15
parr
LQ Newbie
 
Registered: Jul 2003
Distribution: RedHat
Posts: 12

Original Poster
Rep: Reputation: 0
"I have a RedHat 6.2 server that has recently been connected to the outside world. The server was initially installed with a bogus gateway from a different subnet than what they are currently on. Now that we have a firewall in place I need to change the gateway.

I run linuxconf and change the default gateway. I reboot the server. I can ping the server from another machine but cannot ping out from the server. Not even to any machines on the LAN. I try to telnet into the machine and the session fails to connect. I run the route command and it hangs for a couple if minutes and finally gives me some output. It looks like it took the settings but something is getting screwed up in the process.

The /etc/sysconfig/network file looks fine and has the gateway defined.

The only way I can make it work again is by changing the default gateway back to the original IP address.

There is only one adapter on the machine."


It messes it up by killing TCP/IP in some way. I'm not at the location of the server right now, but when I do change the gateway to be correct, it shows up in the routes eventually (2 minutes). Everything looks perfect but can't ping out and can't connect to it via telnet. I'm beginning to think that it's a lost cause...
 
  


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
How do I change the default gateway? tbruer1138 Linux - Networking 3 03-10-2005 09:21 PM
HELP default gateway MrSavage Linux - Newbie 2 01-10-2005 08:46 AM
default gateway avikosan Linux - Networking 3 12-09-2003 06:47 PM
commit default gateway change complus Linux - Networking 5 09-04-2003 04:58 PM
want to change default gateway juanb Linux - General 1 03-12-2003 11:28 AM

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

All times are GMT -5. The time now is 10:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration