Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
07-17-2003, 01:32 PM
|
#1
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Rep:
|
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.
|
|
|
07-17-2003, 01:37 PM
|
#2
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696
|
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
|
|
|
07-17-2003, 02:19 PM
|
#3
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
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.
|
|
|
07-17-2003, 05:43 PM
|
#4
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696
|
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...
|
|
|
07-17-2003, 05:47 PM
|
#5
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Try:
route -n
That shoud stop any name lookups.
|
|
|
07-17-2003, 05:51 PM
|
#6
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
Yeah, just a switch away.
It definitely hoses something when I switch it though. I can't telnet in or anything.
|
|
|
07-17-2003, 05:54 PM
|
#7
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
route -n does work just fine.
It return the info back quickly and it looks correct.
Now what do I do?
|
|
|
07-17-2003, 05:58 PM
|
#8
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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.
|
|
|
07-17-2003, 06:11 PM
|
#9
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
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.
|
|
|
07-18-2003, 01:48 PM
|
#10
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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).
|
|
|
07-22-2003, 03:32 PM
|
#11
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
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 . . . . . . . :
|
|
|
07-23-2003, 01:24 PM
|
#12
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
You don't actuallly have a default route in place though. Try:
route add default gw 192.168.1.1
|
|
|
07-23-2003, 01:30 PM
|
#13
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
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?
|
|
|
07-23-2003, 01:36 PM
|
#14
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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.
|
|
|
07-23-2003, 01:41 PM
|
#15
|
LQ Newbie
Registered: Jul 2003
Distribution: RedHat
Posts: 12
Original Poster
Rep:
|
"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...
|
|
|
All times are GMT -5. The time now is 08:01 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|