Vamos começar
Topologia
--------- | pc1 |--- 192.168.0.10------192.168.0.250/eth1--|---------| --------- Private | | | server |--172.20.20.20/eth0 --------- | | Public | pc2 |--- 192.168.1.10------192.168.1.250/eth2--|---------| --------- Management
Como eu digo, se o seu servidor não precisar se comunicar através de eth1
exceto as máquinas de 192.168.0.0/24
network e se não precisar se comunicar através de eth2
exceto as máquinas de 192.168.1.0/24
network você não precisa de gateways neste interfaces. Configuração bem ser
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 172.20.20.250 netmask 255.255.255.0 gateway 172.20.20.1 auto eth1 iface eth1 inet static address 192.168.0.250 netmask 255.255.255.0 auto eth2 iface eth2 inet static address 192.168.2.250 netmask 255.255.255.0
Para adicionar mais rota a alguma interface
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 172.20.20.250 netmask 255.255.255.0 gateway 172.20.20.1 auto eth1 iface eth1 inet static address 192.168.0.250 netmask 255.255.255.0 up route add -net 192.168.18.0/24 dev eth1 auto eth2 iface eth2 inet static address 192.168.2.250 netmask 255.255.255.0
Ou, se você precisar de gateways em interfaces, poderá adicionar métricas. Interface com menos métrica tem prioridade
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 172.20.20.250 netmask 255.255.255.0 gateway 172.20.20.1 auto eth1 iface eth1 inet static address 192.168.0.250 netmask 255.255.255.0 gateway 192.168.0.1 metric 400 up route add -net 192.168.18.0/24 dev eth1 auto eth2 iface eth2 inet static address 192.168.2.250 netmask 255.255.255.0 gateway 192.168.2.1 metric 800
Este é um exemplo de configuração. Mude com o seu ip net, métrica, rotas por interfaces ....
Quando você fizer a configuração, salve /etc/network/interfaces
, reinicie a rede
sudo service networking restart
ou você pode reiniciar server