Setting Up PPPoE Connection in Linux

By | October 22, 2009

Broadband access and Next Generation Networks (NGN) conception became part of everyday life. According to Parks Associates the number of households worldwide with broadband is approaching to 500 million and it may reach close to 650 million by 2013. The demand for speed of data transferring always increases, just as the amount of users who are connected by means Ethernet, which allows them to connect to the network with the speed up to 10Gb/sec.
Internet Service Providers (ISP) that provide users with Ethernet-channel generally use the following technologies for user authentication and billing:

  • User account binding to the physical line, for example, using MAC-address of the network interface. Linux user has to configure network interfaces to establish such a connection;
  • VPN-technologies allowing user authentication and secure connection. For example, PPTP, L2TP or IpSec;
  • PPPoE (Point-to-Point Protocol over Ethernet) which this article is about.

PPPoE represents a network protocol for encapsulating Point-to-Point Protocol (PPP) frames inside Ethernet frames. PPPoE expands the capability of PPP allowing a virtual Point-to-Point connection over a multipoint Ethernet network architecture. Given protocol was published by IETF in 1999 and its specification is RFC 2516.

In fact PPPoE does not have important advantages in comparison to the above mentioned alternatives. However the following ones can be emphasized:

  • It’s significantly more secure than MAC-binding and allows user to change network interfaces connected to the provider without appealing to provider’s customer support; still it slightly reduces the bandwidth of the network interface;
  • Its configuration is simpler that the one of VPN-connection and requires less parameters to be introduced by user. In particular there is no need to configure IP-address or to specify the address of VPN-server.

Thus, most likely you will encounter PPPoE just because you ISP will provide the Internet via this technology. Although provider’s technical support generally can help you just with Windows, you can easily connect your PC with Linux operating system following our instructions.

The best way to use PPPoE on Linux is to do it with the help of pppd (Point-to-Point Protocol daemon) package, which supports PPPoE since version 2.4.2, and is usually pre-installed (in case it’s not, you can easily get and install it). PPPD is used to manage network connections between two nodes on Unix-like operating systems. The role of pppd is to manage PPP session establishment and session termination.

In addition to that there must be in-kernel PPPoE support. Most likely you already have it because it’s included in all modern distributions by default. However if you don’t, we will discuss how to add it a little bit later.

For now let’s see how you can set up a PPPoE connection using graphical interface (in this certain case we will use Ubuntu 9.04, though Ubuntu 9.10 beta is already available). Open: System – Preferences – Network Connection. Choose DSL tab and press “Add”:

pic01-for-blog

Fill in the “Connection name” (anything you want), “Username” and “Password” fields, check or leave uncheck “Connect automatically”, “Show password” and “Available to all users” boxes:

Pic02-for-blog

NOTE: In case you are going to use this connection just for the Internet, you can leave “Service” field empty.

Choose Ipv4 Settings tab and make sure that the Method is Automatic (PPPoE):

pic03-for-blog

That’s it! Now you can connect to the Internet without any problems.

However if you don’t really like using graphical interface or simply haven’t it (for example, on the server), there is another way to configure it.

First of all you need to check if there is in-kernel PPPoE support:

modprobe pppoe

In case the module wasn’t found, we need to create a kernel module. Make sure that you have kernel sources by going to the source directory – /usr/src/linux-x.x.x and run the following command:

make menuconfig

In the configuration window that will appear after the previous command open Network device support -> PPP over Ethernet (Experimental) and set “M” value there;

Or you can directly change .config (that can be found in the source directory /usr/src/linux-x.x.x/):

CONFIG_PPPOE=m

Now we need to compile modules:

make modules

In case you get some compile errors like “field pppox have not defined in union…”, just as I did, try to make some changes in the following two files:

/usr/src/linux-x.x.x/drivers/net/pppoe.c

/usr/src/linux-x.x.x/drivers/net/pppox.c

– Add just after the comments (before any of #include directives) the following line:

#define CONFIG_PPPOE_MODULE

– Save the above mentioned files and retry compiling with

make modules

After successful compiling copy files

/usr/src/linux-x.x.x/drivers/net/pppoe.o

/usr/src/linux-x.x.x/drivers/net/pppox.o

(pay attention to “.o” extention!) to /lib/modules/x.x.x/kernel/drivers/net

Refresh the file with dependencies:

depmod -a

Now check one more time if the following command is working:

modprobe pppoe

In case it’s ok, we can go ahead with pppd configuration.

1) We need to add to /etc/ppp/chap-secrets our login and password.

If you plan to use pppd for more than one connection, than there is a necessity to introduce a unique ID along with login and password. For example, “PROV”:

ourlogin PROV ourpassword *

(of course, instead of “ourlogin” and “ourpassword” we need to write true values)

2) We have to create a file (let it be “myprov”) in /etc/ppp/peers.

Here are the things we need to write in this file:

user ourlogin (ourlogin – the same login as we introduced in chap-secrets)

plugin rp-pppoe.so

eth0 (your interface via which you want to receive pppoe)

noipdefault (in case your ISP provides dynamic IP)

usepeerdns (to receive DNS from provider)

defaultroute (while connecting to the Internet the provider’s router will be used as a gateway by default)

persist (fixed connection)

remotename PROV (PROV – an ID we introduced in chap-secrets)

3) Finally we need to save everything. To call the connection we use the command:

pppd call myprov

If pppd displays that it can’t load, for example, /usr/lib/pppd/2.4.3/rp-pppoe.so, we need to check where pppd is:

whereis pppd

–  After that we should make a link in /usr/lib/pppd/2.4.3 to our rp-pppoe.so:

ln –s [our rp-pppoe.so] [/usr/lib/pppd/2.4.3/rp-pppoe.so]

If pppd loads, but fails to create PPPoE socket, check log, maybe there are some messages like:

modprobe: can’t locate module net-pf-24

–  If there are, we need to write in /etc/modules.conf:

alias net-pf-24 pppoe

No doubt using PPPoE in Linux is as simple as it is in other operating systems. Graphical interface allows you to connect it in a very fast and intuitive way. However if you want be able to solve different kind of problems that may appear, it’s a great idea to make use of command line. Anyway it won’t take you more than 5-10 minutes to setup the connection, so check it out right now in order to see how easy it is.

8 thoughts on “Setting Up PPPoE Connection in Linux

  1. jacks

    My LAN connects & disconnects after a 1 or 2 seconds
    please helppppp…

  2. Metallic Sandals

    there are many different operating systems but of course i would still prefer to use linux for stability ,~-

  3. Pingback: How to use usb-modeswitch Slackware

  4. Tanmoy

    Hello
    I have tried the graphical method in Ubuntu 9.04 and other linux distros – but there always seems some problem with the performance – like I can’t view certain site like yahoo mail, Goal.com etc. But configuring the connection by using rp-pppoe via cmdline don’t have such problem. Can you kindly tell me what wrong I am committing to get such error?
    Thanks.

  5. Pingback: Building Linux L3 switch/router on x86 – Part5 – Connecting Box to the Internet – PPPoE Configuration « Brezular's Technical Blog

  6. Lucian Stroe

    I did everything as you said here, but after the final click on “Apply” I got the error message saying:

    “Connection add failed

    Saving connection failed: (0) Can’t write connection type ‘pppoe’ ”

    WHY is that???

  7. Rakib

    hi, i am using zorin os. after doing as you said here nothing happens ! any idea?

Comments are closed.