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.

***info***
server: pppoe local ip: 10.0.0.1
            pool ip for client: 10.0.0.2 - 10.0.0.255
            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
ms-dns 8.8.8.8
asyncmap 0
noauth
crtscts
lock
hide-password
modem
debug
proxyarp
lcp-echo-interval 10
lcp-echo-failure 2
noipx
require-chap
ktune
nobsdcomp
noccp
novj

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

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

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

***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 8.8.8.8



2 comments:

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

    pppoe: ioctl(SIOCGIFHWADDR): No such device

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

    ReplyDelete