Use Raspberry Pi as Router with PPPoE


The router at my home has been troubled by the high temperature during summer days, and its performance has brought me headaches whenever I needed smooth network. Raspberry Pi is a robust mini-computer and I soon committed to the idea to turn a Raspi 3 into my new router. After 8-hour trial-and-error I finally managed to make it work on a PPPoE network and hence would like to share my experience. The following tutorial is largely based on Turn a RaspBerryPi 3 into a WiFi router-hotspot.

The Raspi I used is a Raspberry Pi 3 Model B. I expect Model B+ and Zero W to work but I didn’t test. If you are using an older version of Raspi you might need a wifi dongle.

First thing first, let’s make sure the Raspi can connect to the Internet with PPPoE. Download pppoeconf from here, and install it with sudo dpkg -i pppoeconf_1.21_all.deb. Now connect the Ethernet cable to Raspi and open pppoeconf with sudo pppoeconf. Follow the instruction and by the end you should be able to access the Internet.

Now let’s set up DHCP. Feel free to change the parameters like IP address or DNS in the following code if you know what’s going on, otherwise you can safely copy&paste all the code here to proceed. Execute the following command

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install hostapd isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf

Comment these two lines:

option domain-name "";
option domain-name-servers,;

Uncomment this line:


Copy and paste the following code to the end of the file:

subnet netmask {
option broadcast-address;
option routers;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers,;

press ctrl+x to exit, y to save and enter to confirm.

sudo nano /etc/default/isc-dhcp-server

Change INTERFACES=”” to INTERFACES=”wlan0″. Save&exit.

sudo ifdown wlan0
sudo nano /etc/network/interfaces

Add the following lines to the end:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
post-up iw dev $IFACE set power_save off


Configure ip of the router:

sudo ifconfig wlan0

DHCP setting is done. Time to handle wifi.

sudo nano /etc/hostapd/hostapd.conf

Add the following lines to the file:

ssid=RaspiPoweredWifi #change to name of your wifi
channel=6 #change to others if you know what you are doing
wpa_passphrase=12345678 #change to your wifi password

Save&exit. Now we can set up forwarding

sudo nano /etc/sysctl.conf

Jump to the very end and add:


Set up iptables:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

Add to startup:

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

Go to the end and add:

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

Start two services:

sudo service hostapd start
sudo service isc-dhcp-server start

Reboot. Mission accomplished.

3 Replies to “Use Raspberry Pi as Router with PPPoE”

    1. Sorry I didn’t see your comments earlier. There was an issue with WordPress comment function that I just noticed… If anyone else has encountered the similar error as the services couldn’t be started, make sure you have both hostapd and isc-dhcp-server successfully installed. Try rebooting the machine then starting the services. If it still doesn’t work, feel free to comment under this thread and I’ll try my best to troubleshoot for you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.