I our lab we have a small network of 4 Debian machines, connected through a router in a LAN. One of these machines (the server) have internet connection provided by the bigger network of the building. I want to give internet to the inner machines on LAN using NAT. I followed this guide but I cannot get a working connection from clients.
The IP of the server at eth0 is 192.168.2.248 (connected to the internet); and the eth1 is 192.168.200.1 (connected to the LAN). I setup bind9 (with standard conf, but adding the correct DNS addresses to /etc/bind/named.conf.options) to forward the DNS but I not sure if this is absolutely necessary.
$ iptables-save
# Generated by iptables-save v1.4.21 on Mon Aug 22 16:06:21 2016
*nat
:PREROUTING ACCEPT [46792:8129746]
:INPUT ACCEPT [46302:8099043]
:OUTPUT ACCEPT [2752:190850]
:POSTROUTING ACCEPT [1472:88500]
-A POSTROUTING -o eth0 -j SNAT --to-source 192.168.2.248
COMMIT
# Completed on Mon Aug 22 16:06:21 2016
# Generated by iptables-save v1.4.21 on Mon Aug 22 16:06:21 2016
*filter
:INPUT ACCEPT [61997:8558568]
:FORWARD ACCEPT [11:836]
:OUTPUT ACCEPT [9258:2611777]
-A FORWARD -i eth1 -j ACCEPT
COMMIT
# Completed on Mon Aug 22 16:06:21 2016
I can connect the machines using ssh or ping between them, but I still cannot connect or ping the internet from the client machine (eth0 IP 192.168.200.2). This is the gateway on this:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.200.1 0.0.0.0 UG 0 0 0 eth0
192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
/proc/sys/net/ipv4/ip_forward is 1
Any help are welcome
192.168.200.1
? – kasperd Aug 22 '16 at 19:36