I am configuring my Rpi 3 as ethernet router. I have used dnsmasq for configuring dns and dhcp server. The configuration files are given below.
iface lo inet loopback
iface eth0 inet dhcp
iface eth1 inet static
up iptables-restore < /etc/iptables.ipv4.nat
interface=eth1 #listen only to interface eth1
listen-address=192.168.2.1 # listen on
# Bind to the interface to make sure we aren't sending things
server=18.104.22.168 # Forward DNS requests to Google DNS
domain-needed # Don't forward short names
# Never forward addresses in the non-routed address spaces.
# Assign IP addresses between 192.168.2.2 and 192.168.2.100 with a
# 12 hours lease time
kernel.printk = 3 4 1 3
vm.min_free_kbytes = 8192
At last iptables configuration for seting nat is given below
sudo iptables -F
sudo iptables -t nat -F
#Connect a LAN to the internet
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#forward only the packets that are associated with an established #connection
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
#forward all packets from eth1 to eth0
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sh -c "iptables-save > /etc/iptables.ipv4.nat"
These configuration perfectly works for older wheezy versions and jessie lite version too but in jessie full version( 2017-08-16) its not working.
When i configured the files above, rpi won't get connected to my external router (router and rpi are connected through a lan cable). I think this is because configuration for eth0 is changed when i configured the files as above.
In Raspbian jessie version, i don't know where to configure the network interfaces. Also they shipped with inbuilt bind9 and dhcpcd, hence is there any conflict with dnsmasq server.
sudo service dnsmasq status throws an exit-code error.
Can anyone please help me to solve this?
How to configure Rpi 3 with raspbian jessie for the ethernet router?