A while ago I’ve added a third network to my system. The first two networks are directly connected to my server and so
a normal entry in /etc/network/interfaces
suffices for these interfaces to bring them up and configure routing, e.g.
auto eth1
iface eth1 inet static
address 192.168.1.1
gateway 192.168.1.61
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
mtu 1500
dns-search chaos chaos-hs
The third network 192.168.5.0
, however, is not directly visible to the server but is connected to the client
192.168.3.3
which is located in the 192.168.3.0
network. So, in this case I have to install a static route for
the third network to be visible to the server.
As I found out there is no configuration entry for declaring an additional static route per se. Instead, it has to be
done using the general configuration entry post-up
which takes a command to be executed after the interface has been
brought up. In this case it must a regular call to the standard route
command, as can be seen in the last line:
auto eth0
iface eth0 inet static
address 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
mtu 1500
dns-search chaos chaos-hs
post-up route add -net 192.168.5.0/24 gw 192.168.3.3