I have been trying for weeks now to get my Ubuntu 16.04 server to route traffic between the two network interfaces on it. I know this question has been asked a hundred times on the forums before, but nothing that I have read has helped me.
So I have the following set up in /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
I have set net.ipv4.ip_forward = 1
I've set my UFW to pass traffic between 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
I've change the routing tables to route traffic between the interfaces but now success.
There is the routing table.
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
When I ping between the two interfaces I the following reply
:~$ 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
Please could somebody help me to solve this problem.