Link to home
Start Free TrialLog in
Avatar of pcrequest
pcrequestFlag for United States of America

asked on

change default gateway, check static routes

I'm running a few versions (from the last few years) of CentOS.  I want to check and adjust if necessary my default gateways.  I have root access via ssh from the same subnet, so i won't lose connection if i bungle the default gateway.  I know enough to check ifconfig, but that tells me everything except the default gateway.

How would I check for static routes?  I'm familiar with windows route print command.  I may need to delete a route.

Assume I'm very clumsy with linux.
SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pcrequest

ASKER

Actually there is one machine that is being stubborn and I can't get it to take a new gateway.  tty2, your commands work, and give a new gateway.  However, if I /etc/init.d/network restart then it reverts to the old gateway :(  

I want the gateway to be 192.168.0.1.  It keeps reverting to 192.168.0.3.


[x@z ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=zulu.tridecap.com
GATEWAY=192.168.0.1

[x@ ~]# cat /proc/version
Linux version 2.6.18-194.17.1.el5 (mockbuild@builder10.centos.org) (gcc version
4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Wed Sep 29 12:51:33 EDT 2010

[x@z ~]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

Open in new window

Admin, I tried closing this too soon.  Can you reset to to open please, and cancel the point distribution?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
GUI is evil. Better use "Method #3: Edit configuration files stored in /etc/sysconfig/network-scripts/" on the link you mentioned.
/etc/init.d/network is a bash script, and you can check step by step what is playing when you run it.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i fixed the problem by editing default gateway in the gui.  i had to plug kvm in.