Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Persistent Static Routes

  1. #21
    Join Date
    Oct 2006
    Beans
    155

    Re: Persistent Static Routes

    sudo ifdown eth0
    sudo ifup eth0

  2. #22
    Join Date
    Jan 2005
    Beans
    250
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Persistent Static Routes

    when I try that, first I check to see what interface is running:

    danderso@PC095:/etc/network$ ifconfig
    eth0 Link encap:Ethernet HWaddr 00:1a:a0:8c:18:7d
    inet addr:10.206.201.144 Bcast:10.206.201.255 Mask:255.255.255.0
    inet6 addr: fe80::21a:a0ff:fe8c:187d/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:6399999 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4518479 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:2287236515 (2.1 GB) TX bytes:1932796336 (1.8 GB)
    Memory:fdfc0000-fdfe0000

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:22347 errors:0 dropped:0 overruns:0 frame:0
    TX packets:22347 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:2312613 (2.2 MB) TX bytes:2312613 (2.2 MB)

    So then I try your command:

    danderso@PC095:/etc/network$ sudo ifdown eth0
    ifdown: interface eth0 not configured

  3. #23
    Join Date
    Apr 2008
    Beans
    26

    Re: Persistent Static Routes

    FYI: I just got this working myself today.

    The answer to this will not be found by reading the man page for the route command, unfortunately. Since I have struggled with this I happen to know a little bit about how this works in ubuntu and other distros as well. The reason you will not find the answer in the route man page is because this is handled differently depending on the distribution.

    What is gathered together in RedHat's /etc/sysconfig dir is mostly in /etc/network in ubuntu so that is the best place to look first when you need to manually edit some networking or interface properties. And as to the very specific static-route file that you get in other distros, this does not exist anywhere in ubuntu. Rather, to add a static route in ubuntu you add it to the interfaces file immediately under the interface block that will be affected by it, as such:

    Code:
    root@isengard:/etc/network# more interfaces 
    auto lo
    iface lo inet loopback
    
    
    iface eth0 inet static
    address 10.80.80.1
    netmask 255.0.0.0
    gateway 10.44.65.1
    
    # static routes
    up route add -net 10.10.11.0/24 gw 10.0.0.1 dev eth0
    up route add -net 10.10.12.0/24 gw 10.0.0.1 dev eth0
    
    auto eth0
    Remember a couple of things though. If you add these routes simple using the route command, you will lose them next time your networking is restarted, machine is rebooted, etc. Also, if you go this route to make them permanent (or static) then you need to restart networking to make use of the new routes, via:

    Code:
    sudo /etc/init.d/networking restart
    If you get an error saying something to the effect that the interfaces file could not be read then you are dealing with either a syntax problem or a placement problem. Be careful to place the static routes under the interface you want them to affect.

  4. #24
    Join Date
    Jan 2005
    Beans
    250
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Persistent Static Routes

    I don't think there is a problem with adding static routes to static IP address, and yes you do add them just as you have shown (or any of the others listed in this post seem to work as well) if you are manually assigning an IP Address. However - if you let DHCP assigned the address, then the static routes are ignored and we have not yet found a way to get the static routes to work with the DHCP assigned address. Short of running a script after your connection is made.

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •