Linux – Unable to change default route-Rhel 5.9

linuxredhatrhel5route

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

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.235.4.0      *               255.255.255.0   U     0      0        0 eth3
10.235.3.0      *               255.255.255.0   U     0      0        0 eth2
10.235.2.0      *               255.255.255.0   U     0      0        0 eth0
169.X.0.0     *               255.255.0.0     U     0      0        0 eth3
default         10.235.4.1      0.0.0.0         UG    0      0        0 eth3

IP ro sh – output

# ip ro sh
10.235.4.0/24 dev eth3  proto kernel  scope link  src 10.235.4.21
10.235.3.0/24 dev eth2  proto kernel  scope link  src 10.235.3.21
10.235.2.0/24 dev eth0  proto kernel  scope link  src 10.235.2.21
169.x.0.0/16 dev eth3  scope link
default via 10.235.4.1 dev eth3

What i am trying to do is

> Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.235.4.0      *               255.255.255.0   U     0      0        0 eth3
10.235.3.0      *               255.255.255.0   U     0      0        0 eth2
10.235.2.0      *               255.255.255.0   U     0      0        0 eth0
169.x.0.0       *               255.255.0.0     U     0      0        0 eth3
default         10.235.2.1      0.0.0.0         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

Best Answer

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

GATEWAY=10.235.2.1

And then restart the newtwork service

# service network restart