Eu tenho tentado por semanas para obter o meu servidor Ubuntu 16.04 para encaminhar o tráfego entre as duas interfaces de rede nele. Eu sei que essa pergunta já foi feita centenas de vezes nos fóruns anteriores, mas nada que eu tenha lido me ajudou.
Portanto, tenho a seguinte configuração em /etc/network/interfaces
# The loopback network interface
auto lo enp2s0
iface lo inet loopback
# The external interface (router)
iface enp2s0 inet static
address 192.168.0.20
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# This internal interface
auto enp3s0
iface enp3s0 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
# gateway 192.168.1.254
Eu defini net.ipv4.ip_forward = 1
Eu configurei meu UFW para passar o tráfego entre as interfaces
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
22/tcp ALLOW Anywhere
22/udp ALLOW Anywhere
10000 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
22/udp (v6) ALLOW Anywhere (v6)
10000 (v6) ALLOW Anywhere (v6)
Anywhere on enp3s0 ALLOW FWD Anywhere on enp2s0
Anywhere on enp2s0 ALLOW FWD Anywhere on enp3s0
Anywhere (v6) on enp3s0 ALLOW FWD Anywhere (v6) on enp2s0
Anywhere (v6) on enp2s0 ALLOW FWD Anywhere (v6) on enp3s0
Eu alterei as tabelas de roteamento para rotear o tráfego entre as interfaces, mas agora com sucesso.
Existe a tabela de roteamento.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 enp2s0
192.168.0.0 * 255.255.255.0 U 0 0 0 enp2s0
192.168.1.0 192.168.0.20 255.255.255.0 UG 0 0 0 enp2s0
192.168.1.0 * 255.255.255.0 U 0 0 0 enp3s0
Quando faço ping entre as duas interfaces, respondo a seguir
:~$ ping -I enp3s0 192.168.0.20
PING 192.168.0.20 (192.168.0.20) from 192.168.1.254 enp3s0: 56(84) bytes of data.
From 192.168.1.254 icmp_seq=1 Destination Host Unreachable
From 192.168.1.254 icmp_seq=2 Destination Host Unreachable
From 192.168.1.254 icmp_seq=3 Destination Host Unreachable
:~$ ping -I enp2s0 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.0.20 enp2s0: 56(84) bytes of data.
From 192.168.0.20 icmp_seq=1 Destination Host Unreachable
From 192.168.0.20 icmp_seq=2 Destination Host Unreachable
From 192.168.0.20 icmp_seq=3 Destination Host Unreachable
Por favor, alguém poderia me ajudar a resolver este problema?