static route how?

Discussion regarding the installation and configuration of Linux distributions.
sonn33
Naik
Posts: 57
Joined: Wed Aug 25, 2004 3:20 pm
Location: Philippines
Contact:

static route how?

Postby sonn33 » Tue Jan 22, 2008 5:54 am

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
sonn33

mudasir
Captain
Posts: 565
Joined: Tue Oct 17, 2006 5:23 am
Location: Dubai
Contact:

Postby mudasir » Tue Jan 22, 2008 8:38 am

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.
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com

LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Postby LinuxFreaK » Tue Jan 22, 2008 8:48 am

Dear sonn33,
Salam,

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

Best Regards.
Farrukh Ahmed

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Sat Jan 26, 2008 3:38 am

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
Muhammad Usman
+92-321-6640501
Chemonics International
http://usmanpk.com

ghulam yaseen
Naik
Posts: 68
Joined: Thu Aug 07, 2008 6:09 pm
Location: karachi

Yaseen

Postby ghulam yaseen » Mon Oct 06, 2008 6:05 am

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)

mudasir
Captain
Posts: 565
Joined: Tue Oct 17, 2006 5:23 am
Location: Dubai
Contact:

Postby mudasir » Mon Oct 06, 2008 7:26 pm

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.
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com

ghulam yaseen
Naik
Posts: 68
Joined: Thu Aug 07, 2008 6:09 pm
Location: karachi

Postby ghulam yaseen » Tue Oct 07, 2008 1:28 am

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.

kbukhari
Major General
Posts: 1222
Joined: Sat Dec 31, 2005 12:29 am
Location: Lahore
Contact:

Postby kbukhari » Tue Oct 07, 2008 11:18 am

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.
--
Syed Kashif Ali Bukhari
+92-345-8444420
http://sysadminsline.com
http://kashifbukhari.com

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Wed Oct 08, 2008 9:40 am

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
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com

ghulam yaseen
Naik
Posts: 68
Joined: Thu Aug 07, 2008 6:09 pm
Location: karachi

Yaseen

Postby ghulam yaseen » Fri Oct 10, 2008 5:20 am

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

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Fri Oct 10, 2008 10:09 am

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:
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com

kbukhari
Major General
Posts: 1222
Joined: Sat Dec 31, 2005 12:29 am
Location: Lahore
Contact:

Postby kbukhari » Fri Oct 10, 2008 11:11 am

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
--

Syed Kashif Ali Bukhari

+92-345-8444420

http://sysadminsline.com

http://kashifbukhari.com

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Fri Oct 10, 2008 5:28 pm

Thats why we don't own IP... what does that means ???
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com

kbukhari
Major General
Posts: 1222
Joined: Sat Dec 31, 2005 12:29 am
Location: Lahore
Contact:

Postby kbukhari » Fri Oct 10, 2008 7:17 pm

x2oxen wrote:Thats why we don't own IP... what does that means ???

Intellectual Property.
--

Syed Kashif Ali Bukhari

+92-345-8444420

http://sysadminsline.com

http://kashifbukhari.com

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Sat Oct 11, 2008 12:37 pm

Lolzzz! :P
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com


Return to “Installation”

Who is online

Users browsing this forum: No registered users and 0 guests