LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2005, 11:52 AM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
add routes for good


How can I add a route for good on a machine so that when it boots up it has that route in its routing table?
 
Old 12-14-2005, 12:33 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,762
Blog Entries: 4

Rep: Reputation: 78
Add the 'route' line to either your network startup script, or rc.local file...

Of course how elegantly you can do this depends on your distro.
 
Old 12-21-2005, 05:46 PM   #3
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
I use SUSE. would I add this to boot.local

would this work in boot.local

route add -net 192.168.3.0 netmask 255.255.255.128 dev eth0

or is there another format?
 
Old 12-21-2005, 05:58 PM   #4
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
Quote:
Originally Posted by metallica1973
I use SUSE. would I add this to boot.local

would this work in boot.local

route add -net 192.168.3.0 netmask 255.255.255.128 dev eth0

or is there another format?
Linux usually adds directly connected networks to the routing table automatically. If eth0 has an IP address on the 192.168.3.0 network then it should show up in the routing table.

If the network is not directly connected, then you need to specify the router that is connected to it, not just the interface that is connected to that router:
Code:
/sbin/route add -net 192.168.3.0 netmask 255.255.255.128 gw 192.168.2.1
Oh and FYI, if these are the numbers for your actual network, they may not work. 192.168.x.y is a class C network and it needs to be subnetted into at least 4 networks, since you can't use the first and last. 255.255.255.128 creates two subnets, minus the first and last leaves none.
 
Old 12-22-2005, 05:34 PM   #5
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
It works. Why would it work if I dont have enough networks?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Routes Obie Linux - Networking 16 04-28-2005 10:15 PM
I'm not able to add new routes peter_mclein Linux - Networking 4 04-04-2005 09:37 AM
routes himyuza *BSD 6 08-03-2004 10:41 AM
I need some routes |Drakehash| Linux - Newbie 1 06-08-2003 12:22 AM
I need some routes |Drakehash| Linux - Networking 1 06-07-2003 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration