Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

am trying to change default to route to eth2 my present rout -n o/p--

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      *        U     0      0        0 eth3      *        U     0      0        0 eth2      *        U     0      0        0 eth0
169.X.0.0     *          U     0      0        0 eth3
default         UG    0      0        0 eth3

IP ro sh - output

# ip ro sh dev eth3  proto kernel  scope link  src dev eth2  proto kernel  scope link  src dev eth0  proto kernel  scope link  src
169.x.0.0/16 dev eth3  scope link
default via dev eth3

What i am trying to do is

> Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      *        U     0      0        0 eth3      *        U     0      0        0 eth2      *        U     0      0        0 eth0
169.x.0.0       *          U     0      0        0 eth3
default         UG    0      0        0 eth2

I tryed different ways a> add "gatewaydev=eth2" in/etc/sysconfig/network.
b> added route eth2 by command and deleted eth3 route entry.

after service network restart it going back to first output.

help me thanks

share|improve this question

4 Answers 4

Just add/replace default gateway ip address to/in the /etc/sysconfig/network


And then restart the newtwork service

# service network restart
share|improve this answer
I have as gateway=eth0 but still not working –  user1812956 Aug 30 '13 at 16:15
add output of the # ip ro sh to your question –  ALex_hha Aug 30 '13 at 16:28

You must have address from network on eth2 first, then you can change GATEWAY= value.

share|improve this answer
Yea , I have . I added eth0 interrface in dhcp server which is scope –  user1812956 Aug 31 '13 at 7:00

Open /etc/sysconfig/network file:

#vi  /etc/sysconfig/network

Setup GATEWAY={Router-IP}


You need to restart networking service:

# /etc/init.d/networking restart
share|improve this answer
It is working fine wirth i keep gateway address as , but iwant go by device not by gateway-ip –  user1812956 Aug 31 '13 at 6:51
Run command setup then go to menu network configuration and select the ethernet card(NIC) which you want to configure and setup gateway ip there. –  Shailesh Aug 31 '13 at 6:55

I tend to add the gateway to the /etc/sysconfig/network-scripts/ifcfg-ethX config file for the appropriate interface, eg:


I tend not to put it in /etc/sysconfig/network, though you certainly can. I do a lot of really complex bonding configurations, and it makes it easier if all the files are in one place.

If you do it like I do it, DO NOT declare the gateway interface in other IFCFG files. It will read them in order, resetting the gateway every time, and you won't get the expected behaviour.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.