I am trying to setup a router on a machine with Ubuntu server 18.04. The server how one NIC on the motherboard and two PCI network cards with 4 interfaces each. I have setup a DHCP server and DNS server on the same machine. I used this tutorial. My network setup is as follow:
When I execute ping 192.168.1.1
from 192.168.1.2 everything works fine,
however when I try to ping the ip of google using ping 172.217.17.36
I get no replies. nslookup google.com 192.168.1.1
times out as well.
However when I execute nslookup google.com 192.168.0.113
from my laptop
I do get the expected reply. Executing ping google.com
on the ubuntu router works fine as well.
My netplan setup is as follows:
network:
ethernets:
eno1:
dhcp4: true
enp9s0:
addresses:
- 192.168.1.1/24
dhcp4: false
nameservers:
addresses:
- 127.0.0.1
search: []
enp10s0:
addresses:
- 192.168.1.1/24
dhcp4: false
nameservers:
addresses:
- 127.0.0.1
search: []
enp11s0:
addresses:
- 192.168.1.1/24
dhcp4: false
nameservers:
addresses:
- 127.0.0.1
search: []
...same for other interfaces...
version: 2
My ip tables setup is as follows:
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE
My dhcp.conf is as follows:
option domain-name "example.com";
option domain-name-servers 127.0.0.1;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.254;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
}
I am using pi-hole for my DNS server.
ifconfig
on the ubuntu router results in:
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.113 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::12c3:7bff:fe6c:c81b prefixlen 64 scopeid 0x20<link>
inet6 2a02:1812:d38:c300:274d:5b5:ce56:bdf6 prefixlen 64 scopeid 0x0<global>
inet6 2a02:1812:d38:c300:12c3:7bff:fe6c:c81b prefixlen 64 scopeid 0x0<global>
ether 10:c3:7b:6c:c8:1b txqueuelen 1000 (Ethernet)
RX packets 13961 bytes 1287100 (1.2 MB)
RX errors 0 dropped 9010 overruns 0 frame 0
TX packets 2150 bytes 372856 (372.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xdfd00000-dfd20000
enp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::2e0:4cff:fe68:873e prefixlen 64 scopeid 0x20<link>
ether 00:e0:4c:68:87:3e txqueuelen 1000 (Ethernet)
RX packets 1041 bytes 233462 (233.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1427 bytes 460072 (460.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp11s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:e0:4c:68:87:3f txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
...
enp9s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:e0:4c:68:87:3d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 8029 bytes 524899 (524.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8029 bytes 524899 (524.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
How can I figure out why my router is not replying to ping and dns requests for external IP's when they are coming from 192.168.1.2 ?
Let me know if you would like me to post additional information.