rawandnet
asked on
add pemananet static route under RHEL5
Hi guys,
I have two network interfaces
Eth0 10.1.0.202 255.255.0.0 gw 10.1.0.1
Eth1 192.168.1.22 255.255.255.0 gw 192.168.1.1
Default internet route is 10.1.0.1
I want to add a permanent route for eth1 192.168.1.122 to be forwarded to 192.168.1.1
I did some search they say open file /etc/sysconfig/network-scr ipts/route -eth0 and add static route there example:
192.168.1.0/24 via 192.168.1.1
But I don’t have that file under that directory, I am using RHEL5, where is that file?
I have two network interfaces
Eth0 10.1.0.202 255.255.0.0 gw 10.1.0.1
Eth1 192.168.1.22 255.255.255.0 gw 192.168.1.1
Default internet route is 10.1.0.1
I want to add a permanent route for eth1 192.168.1.122 to be forwarded to 192.168.1.1
I did some search they say open file /etc/sysconfig/network-scr
192.168.1.0/24 via 192.168.1.1
But I don’t have that file under that directory, I am using RHEL5, where is that file?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, I know what you mean, but mean while, just for the same of learning, i did wwhat you said after restarting network service i got following error
Bringing up interface eth1: RTNETLINK answers: Invalid argument
i did following:
#vi route-eth1
GATEWAY0=192.168.1.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.1.122
Bringing up interface eth1: RTNETLINK answers: Invalid argument
i did following:
#vi route-eth1
GATEWAY0=192.168.1.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.1.122
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that is true under command line this will create the route, but it wan't stay after restarting network services. I even created a file under /etc/sysconfig/network-scr ipts, named route-eth1 and added your line (ip route add 192.168.1.0 via 192.168.1.1), but i got error
(Bringing up interface eth1: Error: an inet prefix is expected rather than "ip") how can i make that route permanent?
(Bringing up interface eth1: Error: an inet prefix is expected rather than "ip") how can i make that route permanent?
Ok under the file you created the syntax should be
192.168.1.0/24 via 192.168.1.1
This should be the only line under your file
Restart network and try
/etc/init.d/network restart
192.168.1.0/24 via 192.168.1.1
This should be the only line under your file
Restart network and try
/etc/init.d/network restart
ASKER
thanks for your comment, it solved what I needed
Cheers,
K.