I need to configure an Ubuntu 16 installation as a gateway (it's a kind of a hometask) but I have run into a hitch. Sorry for asking it here, but I mainly use Manjaro and I have a suspicion that the solution will be as simple as
route add ...
So, I have several VMs with Ubuntu 16, one of them is supposed to be a gateway, it has 2 interfaces: a bridged one, via which it is connected to the Internet, and a host-only adapter, which is for its LAN with other VMs.
One other VM is supposed to be a client, and one, a server, they both have only one (host-only) adapter.
LAN address is 192.168.56.0 with the gate address being 192.168.56.1, server 192.168.56.10, and dynamically assigned range for clients (well, there is only one actually).
The gate has the following
# The LAN network interface auto enp0s8 iface enp0s8 inet static address 192.168.56.1/24 #dns-nameservers 126.96.36.199 # The WAN network interface auto enp0s3 iface enp0s3 inet dhcp dns-search corp56.un
The server has this:
# The LAN network interface auto enp0s3 iface enp0s3 inet static address 192.168.56.10/24 #dns-nameservers 192.168.56.1 gateway 192.168.56.1
I can ping each other with their 192.168.56.X addresses, and the gate has the connection to the Internet, but I can't connect to the Internet from either server or client (I'm concerned with the server at this point).
route executed on the server gives this:
Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.56.1 0.0.0.0 UG 0 0 0 enp0s3 192.168.56.0 * 255.255.255.0 U 0 0 0 enp0s3
On the gate it gives this:
Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.1 0.0.0.0 UG 0 0 0 enp0s3 192.168.1.0 * 255.255.255.0 U 0 0 0 enp0s3 192.168.56.0 * 255.255.255.0 U 0 0 0 enp0s8
Also, on the gate
tracepath -b 188.8.131.52 returns some responding addresses from ISP:
1?: [LOCALHOST] pmtu 1500 1: 192.168.1.1 (192.168.1.1) 0.841ms asymm 64 1: 192.168.1.1 (192.168.1.1) 0.487ms asymm 64 2: 184.108.40.206 (220.127.116.11) 58.631ms 3: 10.2.251.126 (10.2.251.126) 1.617ms 4: m9-crs-be14.corbina.net (18.104.22.168) 2.076ms asymm 6 5: m9-br2-be5.corbina.net (22.214.171.124) 2.589ms
And on the server it returns:
1?: [LOCALHOST] pmtu 1500 1: 192.168.56.1 (192.168.56.1) 0.824ms 1: 192.168.56.1 (192.168.56.1) 0.690ms 2: no reply
Then just "no-replies". So, am I right in thinking that I need to add some route? I have tried
route add -net 192.168.1.0/24 gw 192.168.1.1 enp0s3 on the gate VM, but it did not change anything.
Oh, and I forgot to tell that I did set
sysctl -w net.ipv4.ip_forward=1 on the gate and that ip tables are empty (for now).