LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to add a route and keep it (https://www.linuxquestions.org/questions/linux-networking-3/how-to-add-a-route-and-keep-it-698482/)

vieraci 01-19-2009 08:14 PM

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.

anomie 01-19-2009 10:15 PM

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.

vieraci 01-20-2009 09:20 PM

Quote:

Originally Posted by anomie (Post 3414568)
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


All times are GMT -5. The time now is 11:03 PM.