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.
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug eth1 iface eth1 inet static address 192.168.2.1 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 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 # elsewhere bind-interfaces server=188.8.131.52 # Forward DNS requests to Google DNS domain-needed # Don't forward short names # Never forward addresses in the non-routed address spaces. bogus-priv # Assign IP addresses between 192.168.2.2 and 192.168.2.100 with a # 12 hours lease time dhcp-range=192.168.2.2,192.168.2.100,12h
kernel.printk = 3 4 1 3 net.ipv4.ip_forward=1 vm.swappiness=1 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?