0

I have installed the latest Jessie version 2017-08-16 on my Rpi3. I am confused about the network configuration. Jessie shipped with dhcpcd5 and isc-dhcp-client, right? Whether this meaning that, jessie has built-in dhcp server in it?

Or if we want to configure dhcp server on Rpi, do we need to install dnsmasq or something like that?

Now I am in a project in which Rpi has to be configured as an ethernet router (from eth0 to eth1). I have tried this in old version of raspbian and it worked. I have used dnsmasq for congiuring dhcp server and used /etc/network/interfaces for static ip configuration.

When I come to Jessie, I am confused whether it is required to use dnsmasq. I already understand how to configure static IP addresses in Jessie. But the problem is with dhcp server.

0

It seems that this link has some good info for the pi3. As you said that already done some steps, here it's a short version:

It says that you need to install dnsmasq with:

sudo apt-get install rpi-update dnsmasq -y

You said that already have wifi and a static ip setup, so, moving on those steps, into dnsmasq config.

First, save the old file and create a new one:

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig  
sudo nano /etc/dnsmasq.conf

and add:

interface=eth0      # Use interface eth0  
listen-address=172.24.1.1 # Explicitly specify the address to listen on  
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere  
server=8.8.8.8       # Forward DNS requests to Google DNS  
domain-needed        # Don't forward short names  
bogus-priv           # Never forward addresses in the non-routed address spaces.  
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time  

Enable IPv4 forwarding:

sudo nano /etc/sysctl.conf

Uncomment the following line:

net.ipv4.ip_forward=1

IP Tables Add this:

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE 

Configure it to load on reboot by first saving it to a file:

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Then create a 'hook' file with a line to restore the ip tables:

sudo nano /lib/dhcpcd/dhcpcd-hooks/70-ipv4-nat

Add:

iptables-restore < /etc/iptables.ipv4.nat

After a reboot you should automatically connect to your wifi and, assuming it has internet access, anything plugged into your Pi's ethernet port will have internet access as well.

  • why we need this file sudo nano /lib/dhcpcd/dhcpcd-hooks/70-ipv4-nat, We can restore tables in /etc/network/interfaces file, right? – vishnu m c Sep 1 '17 at 12:09
  • What about the dhcpcd in the Jessie? – vishnu m c Sep 1 '17 at 12:11
  • i followed mylinuxcode.com/how-to-make-static-ip-on-raspberry-pi tutorial for setting static IP. I think it have to work – vishnu m c Sep 1 '17 at 12:25
  • Cool! If it was helpful, please remember to mark as right. :) – Luis Diaz Sep 1 '17 at 19:14
  • Can you help me for setting static IP. The tutorial doesn't work for me – vishnu m c Sep 7 '17 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.