iconAll times are GMT +2. The time now is 02:59 AM. | Welcome to Forum, please register to access all of our features.
Sonic Informed (Wholesaler)     Landmark (PC Sales) Digital Addiction (PC Sales) PC-Direct (PC Sales) Wootware (PC Sales) Pc Labs (PC Sales) Prophecy (PC Sales + Forums)

» PCBUYERSGUIDE » General IT Discussion, Support, Reviews and Guides » Linux Operating System » HOWTO: Adding static routes in Ubuntu.

Linux Operating System The Linux Operating System Discussion, Support and Guides.

Reply
 
Thread Tools
Old 2007-10-29   #1
TitanKing
Administrator
Points: 2,318, Level: 31
Points: 2,318, Level: 31 Points: 2,318, Level: 31 Points: 2,318, Level: 31
Activity: 76%
Activity: 76% Activity: 76% Activity: 76%
User owns 1x The Good Poster User owns 1x Political Relic User owns 1x Noob Destroyer User owns 1x PCBG Ghost User owns 1x Taking it Slow User owns 1x Standing Tall
User owns 1x PCBG Agent
 
TitanKing's Avatar
 
Join Date: 2005 Feb
Location: Cape Town
Posts: 6,242
TitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judgedTitanKing has not done enough here to be judged
Default HOWTO: Adding static routes in Ubuntu.

There are many ways to do this, however I will show the one I use most often.

When adding a route in Ubuntu/Linux you would normally just run this for instance:

Code:
$ route add -net 10.0.0.0 gw 10.2.5.1 netmask 255.0.0.0 dev eth0
However, when rebooting this route will not be active, this is way you need to add static routes.

Create a file called "static-route" in /etc/network/if-up.d

Now make the file look like this and change the example routing as you would require it:

Code:
#!/bin/sh
# Set static routes
#

# Below are examples of how it should look to add static routes.
/sbin/route del -net default gw 10.2.5.1 netmask 0.0.0.0 dev eth0
/sbin/route add -net 10.0.0.0 gw 10.2.5.1 netmask 255.0.0.0 dev eth0
Well there you go, you could now create multiple static routes in one simple file.
__________________
"The fact of the matter is, Open Source is better."
"Linux users are not pirates, we're ninjas."

Follow me on Twitter.
TitanKing is offline   Reply With Quote
Old 2007-10-29   #2
DiSSaRRaY
VIP
Points: 2,497, Level: 32
Points: 2,497, Level: 32 Points: 2,497, Level: 32 Points: 2,497, Level: 32
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
User owns 1x Coffee Relic User owns 1x PCBG Agent User owns 1x Short Temper Relic
 
DiSSaRRaY's Avatar
 
Join Date: 2006 Jul
Location: K-Pax
Posts: 2,559
DiSSaRRaY has been very helpfulDiSSaRRaY has been very helpfulDiSSaRRaY has been very helpfulDiSSaRRaY has been very helpfulDiSSaRRaY has been very helpful
Send a message via ICQ to DiSSaRRaY Send a message via AIM to DiSSaRRaY Send a message via MSN to DiSSaRRaY Send a message via Yahoo to DiSSaRRaY Send a message via Skype™ to DiSSaRRaY
Default Re: HOWTO: Adding static routes in Ubuntu.

*takes notes*
__________________
May his rest be long and placid,
he who adds water to acid.

>> Code Cafè <<
>> NASA Database <<
>> Wikipedia Data Dumps <<
>> DiSS-Assembler <<
>> Database of Periodic Tables <<
>> GPU Review <<


Make this folder (Windows 7 only):
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Firmware 7200.11, do you take this Seagate TB Drive to be your lawfully wedded victim, to have and to hold, until failure do you part, and to forever lose your data?
DiSSaRRaY is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off

Forum Jump