LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-19-2009, 08:14 PM   #1
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Rep: Reputation: 15
How to add a route and keep it


Hi,

I have a server in the office and when I need to connect via cable I have to start up a root terminal and type in:

route add -net 0.0.0.0 gw 10.0.1.10 dev eth0

Is there a way to have this saved so I don't have to re-type it every time ?

I already tried adding the command in /etc/rc.local and also in /etc/network/interfaces but it doesn't seem to help.
 
Old 01-19-2009, 10:15 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quick google for "debian static route" turned up: http://www.debian.org/doc/manuals/re...ateway.en.html

I think you want 10.6.1.1.
 
Old 01-20-2009, 09:20 PM   #3
vieraci
Member
 
Registered: Mar 2007
Location: Darwin, Australia
Distribution: Debian Lenny (testing)
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by anomie View Post
Quick google for "debian static route" turned up: http://www.debian.org/doc/manuals/re...ateway.en.html

I think you want 10.6.1.1.
Nope, it didn't work for me.
I disconnected the cable, added the suggested lines, saved the file and then re-connected the cable. Then ping times out. If I take the lines out again and re-save the file then the network is unreachable.

Bash commands in a su terminal results:

ifup eth0
Ignoring unknown interface eth0=eth0.

ifdown eth0
ifdown: interface eth0 not configured

I have to reboot the computer to restore the connection.

This may be relevant, the server has 2 nics, one for the internal network and the other for the adsl connection.

Here is my /etc/network/interfaces file with the modifications, (have tried it with commenting out the dhcp as well):

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp


# These lines added...
iface eth0 inet static
address 0.0.0.0
netmask 255.255.255.0
# netmask 0.0.0.0 doesn't work either !!
gateway 10.0.1.10
 
  


Reply

Tags
net, route


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
noob: ip route add vs route add jCash Linux - Networking 1 07-19-2007 11:12 AM
How to add a route rust8y Linux - General 3 12-16-2006 03:58 AM
route add jay123 Linux - Networking 8 07-07-2006 12:58 PM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
ip route add ducati620 Linux - Networking 0 06-06-2004 06:11 AM


All times are GMT -5. The time now is 01:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration