Page 1 of 1

static route how?

Posted: Tue Jan 22, 2008 5:54 am
by sonn33
Hi! Guys,

How will i add my static route permanently to my linux box i have encountered problem that everytime i reboot my machine static route has gone. That's is why i have to re type it again.

# /sbin/route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.0.3

ThankS in advance.

Sonn

Posted: Tue Jan 22, 2008 8:38 am
by mudasir
AOA,

Dear son33,

Two methods by which it can be done are as follows
Method 1.

echo "/sbin/route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.0.3" >> /etc/rc.local

Easy and quick
Method 2.

Create a file /etc/sysconfig/network-scripts/route-ethX where X corresponds to the network interface you wish to use the alternate route. This file deals with three fields: GATEWAY, NETMASK, and ADDRESS. Each field should have a number appended to it indicating what route it relates to. The example below shows two static routes configured for the eth0 network interface.

touch /etc/sysconfig/network-scripts/route-eth0
vi /etc/sysconfig/network-scripts/route-eth0

GATEWAY=192.168.0.3
NETMASK=255.255.255.0
ADDRESS=192.168.5.0

save and exit by :wq

then

service network restart
Now its up to you which method will you choose.

Note: Method 2 only works on RedHat.

Re:

Posted: Tue Jan 22, 2008 8:48 am
by LinuxFreaK
Dear sonn33,
Salam,

Duplicate post for the same question will not help you sir.

Best Regards.

Posted: Sat Jan 26, 2008 3:38 am
by x2oxen
add your route command in /etc/rc.local

/sbin/route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.0.3

Yaseen

Posted: Mon Oct 06, 2008 6:05 am
by ghulam yaseen
Hello :) ,

In addition to all above, please use this for changing route permenantly
------------
--> vi /etc/conf.d/net and add these lines

routes_eth1=(
"192.168.5.0 via 192.168.0.3"
)

I hope this will solve your issue 8)

Posted: Mon Oct 06, 2008 7:26 pm
by mudasir
AOA,

Dear Ghulam Yaseen,

I would request you to please discuss latest topics, these topics are very old and has been discussed many times.

Hope you dont mind.

Posted: Tue Oct 07, 2008 1:28 am
by ghulam yaseen
Hi :),

I am new cadet at linux PK, so i was just for knowledge and if you dont mind, you can make me correct for any issue if i am wrong. I hope you will help this CADET8)
mudasir wrote:AOA,

Dear Ghulam Yaseen,

I would request you to please discuss latest topics, these topics are very old and has been discussed many times.

Hope you dont mind.

Posted: Tue Oct 07, 2008 11:18 am
by kbukhari
ghulam yaseen wrote:I hope you will help this CADET8)
this is army and we don't help cadets except push them to make us honorable.

This is not me, this is whole LP.

Posted: Wed Oct 08, 2008 9:40 am
by x2oxen
kbukhari wrote:
ghulam yaseen wrote:I hope you will help this CADET8)
this is army and we don't help cadets except push them to make us honorable.

This is not me, this is whole LP.
Was that a first attack????
:P

Yaseen

Posted: Fri Oct 10, 2008 5:20 am
by ghulam yaseen
Yea 8)
x2oxen wrote:
kbukhari wrote:
ghulam yaseen wrote:I hope you will help this CADET8)
this is army and we don't help cadets except push them to make us honorable.

This is not me, this is whole LP.
Was that a first attack????
:P

Posted: Fri Oct 10, 2008 10:09 am
by x2oxen
Then always try to save your a** as its going to be hard for newbie cause seniors out here are very strict and you will be criticized for every wrong move. :lol:

Posted: Fri Oct 10, 2008 11:11 am
by kbukhari
x2oxen wrote:Then always try to save your a** as its going to be hard for newbie cause seniors out here are very strict and you will be criticized for every wrong move. :lol:

thats why we don't own IP

Posted: Fri Oct 10, 2008 5:28 pm
by x2oxen
Thats why we don't own IP... what does that means ???

Posted: Fri Oct 10, 2008 7:17 pm
by kbukhari
x2oxen wrote:Thats why we don't own IP... what does that means ???
Intellectual Property.

Posted: Sat Oct 11, 2008 12:37 pm
by x2oxen
Lolzzz! :P