Discovered that in recent Ubuntu versions, the following is the "official" way to up and down interfaces cleanly.

  1. Edit /etc/network/interfaces adding your entry similar to below:

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
            address 10.1.24.30
            netmask 255.255.254.0
            network 10.1.24.0
            broadcast 10.1.25.255
            gateway 10.1.24.1
            # dns-* options are implemented by the resolvconf package, if installed
            dns-nameservers 10.11.11.11
            dns-search herpderp.com
    
    
    auto eth3
    iface eth3 inet static
            address 192.168.24.29
            netmask 255.255.254.0
            mtu 9000
    
  2. ifup eth3 to bring up eth3 with its new configuration.

  3. Want to fully clean an interface:

    ifdown eth3
    # For the following, sometimes flushing helps ;P
    # http://unix.stackexchange.com/questions/100588/using-ip-addr-instead-of-ifconfig-reports-rtnetlink-answers-file-exists-on-de
    ip addr flush dev eth3
    
Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview