A small explanation of the /etc/network/interfaces file as found in modern debian distributions. I wrote this because I didn't find a comprenhensive document on how to use this file in more complex network situations. If you have more information and/or additions, please contact(dirkjan me so I can add them here.

For reference information check the man page. Man interfaces - Manpage of interfaces


first I auto load a couple of interfaces:

auto lo eth0 eth1

And I define the loopback interface, should always be there...

iface lo inet loopback

then I define eth0, which is my external interface, connecting to a cablemodem with _dhcp_:

iface eth0 inet dhcp

next is my internal network device, since the machine is a dhcp server it has a _static_ address, note that also a ipv6 address is added:

iface eth1 inet static
iface eth1 inet6 static
address 2001:7b8:331:1::1
netmask 48

The ipv4 part is pretty standard stuff, the ipv6 address is in a delegated subnet.

Adding a GRE tunnel

So course before trying this in the interfaces file, check that your kernel supports gre tunnels. The configuration on both sides of the tunnel would be mirrored. Here's an example of one endpoint:

iface zeus inet static
pre-up ip tunnel add zeus mode gre remote local ttl 255
up ip link set mtu 1500 dev zeus
up ip ro add dev zeus
up ip ro del dev zeus
post-down ip tunnel del zeus

The trick is in the pre-up rule, this defines the tunnel by calling the 'ip tunnel' command after which the tunnel can be treated like any other interface. The post-down rule makes sure the tunnel get destroyed when downed. I also had to add a route fix, but this is rather site specific...