Macro 32 Ramblings

Mind Archive

Debian: Multiple interfaces and permanent routes

# /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 10.2.2.1
netmask 255.255.255.0
network 10.2.2.0
broadcast 10.2.2.255
gateway 10.2.2.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 10.2.2.1
dns-search test.com
# The telemetry network interface
allow-hotplug eth1
iface eth1 inet static
address 10.9.100.121
netmask 255.255.254.0
network 10.9.100.0
broadcast 10.9.101.255
# dns-* options are implemented by the resolvconf package, if installed
#dns-nameservers 10.2.2.1
#dns-search test.com
post-up route add -net 10.9.103.0 netmask 255.255.255.0 gw 10.9.103.1
post-up route add -net 10.9.144.0 netmask 255.255.255.0 gw 10.9.103.1
post-up route add -net 10.9.145.0 netmask 255.255.255.0 gw 10.9.103.1
pre-down route del -net 10.9.103.0 netmask 255.255.255.0 gw 10.9.103.1
pre-down route del -net 10.9.144.0 netmask 255.255.255.0 gw 10.9.103.1
pre-down route del -net 10.9.145.0 netmask 255.255.255.0 gw 10.9.103.1