Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a ldirectord/heartbeat HA setup between a gentoo load balancer and gentoo real servers. Due to the limitations of my host I have the load balancing working via ipip tunnel.

I have the following settings on the gentoo real server:

(appended to the end of...) /etc/conf.d/net

iptunnel_tunl0="mode ipip"

config_tunl0=( 
        "xxx.xxx.xxx.xxx netmask 255.255.255.255"
        "yyy.yyy.yyy.yyy netmask 255.255.255.255"
        "zzz.zzz.zzz.zzz netmask 255.255.255.255"
)

Those xxx/yyy/zzz ips are my shared ip addresses.

'ip address show' yields this:

4: tunl0: <NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN 
    link/ipip 0.0.0.0 brd 0.0.0.0
    inet xxx.xxx.xxx.xxx/32 scope global tunl0
    inet yyy.yyy.yyy.yyy/32 scope global tunl0:1
    inet zzz.zzz.zzz.zzz/32 scope global tunl0:2

This all works fine.

I'm now trying to setup ipip tunnelling to an Ubuntu real server.

I can get the interface to appear using:

ip tunnel add tunl0 mode ipip

and then add IP addresses to it by appending this to /etc/network/interfaces

auto tunl0
  iface tunl0 inet static
  address xxx.xxx.xxx.xxx
  netmask 255.255.255.255

Then my "ip addr show" command shows the same as on the gentoo machine

The problem is that the ip tunnel add.. doesn't persist across reboots, so the next time the networking tries to load we get this

# /etc/init.d/networking restart
* Reconfiguring network interfaces...
ssh stop/waiting
ssh start/running, process 2442
ssh stop/waiting
ssh start/running, process 2482
SIOCSIFADDR: No such device
tunl0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
tunl0: ERROR while getting interface flags: No such device
Failed to bring up tunl0.
   ...done.

How can I make the tunnel interface persist in the same way that it did in Gentoo?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There's two ways to handle this. If all you need is the one simple command, the easiest way is to add lines for pre-up and pre-down to your entry in /etc/network/interfaces:

auto tunl0

iface tunl0 inet static
  pre-up ip tunnel add tunl0 mode ipip
  post-down ip tunnel del tunl0 mode ipip
  address xxx.xxx.xxx.xxx
  netmask 255.255.255.255

Alternately, if you want to do anything more complicated, you can add scripts to /etc/network/if-pre-up.d/ and /etc/network/if-post-down.d/ that are run prior to starting up, and after shutting down, the network, respectively.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.