Monday, April 11, 2016

setup your own pppoe server on linux system

PPPoE protocol (Point-to-Point Protocol over Ethernet) use to encapsulate PPP frames inside Ethernet frames. It is  the solution for tunneling packets over the DSL connection to the ISP's IP network, and from there to the rest of the Internet. PPPoE authentication is with username and password in the form of CHAP and PAP protocol.

The following will show how to setup pppoe server on linux system and use mikrotik as the pppoe client dial to the pppoe server.

server: pppoe local ip:
            pool ip for client: -
            username/password: user1:pass1
            pppoe interface to client: eth1
            pppoe to internet: eth0
            authentication protocol: chap
client: interface connect to server: ether3

    if you want to test that let client access to internet type the following command on pppoe server for enabling ip forward and nat for our client because we provide only private ip addresses
$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

***pppoe server ***
1- install pppoe package, it provide both driver and pppoe-server software
$ sudo apt-get install pppoe

2- create pppoe server configuration file with filename /etc/ppp/pppoe-server-options with the following content
asyncmap 0
lcp-echo-interval 10
lcp-echo-failure 2

3- create ip pool file with name /etc/ppp/pppoe1-pool with following content

4- add username and password to file /etc/ppp/chap-secrets
"user1" * "pass1" *
# if you want to fix ip address
"user1" * "pass1"

5- start running our pppoe server with the following command
$ sudo pppoe-server -I eth1 -p /etc/ppp/pppoe1-pool  -L

***mikrotik client dial pppoe  connection ***
1- on terminal run the the following command to create pppoe client
/ interface pppoe-client add name="pppoeclient1" interface=ether3 user="user1" password="pass1" disabled=no

2- verify pppoe connection use ip address print to see the newly dynamic ip address mapped to pppoeclient1 interface
/ip address print

-screenshot of ip address print and pint to google dns ip address


  1. Hello,
    I am getting below error , could you please help me ?.

    pppoe: ioctl(SIOCGIFHWADDR): No such device

  2. what produced that output?,
    if this command "sudo pppoe-server -I eth1 -p /etc/ppp/pppoe1-pool -L", produced the output, check your system, whether you have eth1 interface.

  3. Hello
    Could you please clear my doubts on this.
    1. Are we running the pppoe-client in the same machine?
    If yes, the system I use doesn't have two ethernet interfaces. What can I do now to overcome this limitation.

    Kindly correct me, if I understood the things wrongly.

    1. Hi Mathi,

      pppoe-client runs on another machine, as a client which will connect to the pppoe server.
      pppoe-client connected to pppoe server, which will route the packages of the client to internet.