How to create a PPPoE Server on Ubuntu? (Untested)

时间:2022-12-29 12:48:03

How to create a PPPoE Server on Ubuntu?

For one reason or another, I needed to setup a PPPoE Server on my Ubuntu machine. Unfortunately almost all the guides found were talking about setting a PPPoE client connected to a PPPoE Server. So I spend a few days testing and trying out different configurations, until I finally found how to set it up from scratch. The below instructions will look similar to the guide I referenced, but there are some extra steps to ensure that your connection will be able to access Internet properly.

Step #1: Topology Setup

First of all, the topology needs to be setup as followed:
 
PC --- PPPoE Server (Ubuntu) --- Internet
 
You can add your typical cable modem and/or router into the mix. The
main issue here is to ensure that your PPPoE Server can access the
Internet without any problems. To verify this, just do a quick ping test
to google.com or yahoo.com.
 
> ping http://www.google.com

PING www.l.google.com (74.125.155.103) 56*84) bytes of data.
64 bytes from px-in-f103.1e100.net (74.125.155.103): icmp_req=1 ttl=52 time=36.9 ms
64 bytes from px-in-f103.1e100.net (74.125.155.103): icmp_req=2 ttl=52 time=37.5 ms
64 bytes from px-in-f103.1e100.net (74.125.155.103): icmp_req=3 ttl=52 time=34.3 ms
64 bytes from px-in-f103.1e100.net (74.125.155.103): icmp_req=4 ttl=52 time=37.6 ms
-- www.l.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss

If you cannot access this, check your interface. Most likely something is misconfigured there. There are several guides on how to enable your interface properly:
- Network Configuration

Step #2: Install PPP and RP-PPPoE

You will need to install these components
to get the PPPoE Server working. The first one is simple: just grab the
ppp package from Ubuntu:
 
> sudo apt-get install ppp
 
The second package (rp-pppoe) requires you to build it on your own. Start by grabbing the package from this website (Roaring Penguin)
 
> wget http://www.roaringpenguin.com/files/download/rp-pppoe-3.10.tar.gz
> tar -zxf rp-pppoe-3.10.tar.gz
> cd rp-pppoe-3.10/src
> ./configure
> make
> sudo make install

Step #3: Setup PPPoE Settings

Several files need to be created before we
can start PPPoE Server. First, modify the /etc/ppp/pppoe-server-options
and change it to the following:
 
/etc/ppp/pppoe-server-options:

# PPP options for the PPPoE Server
# LOC: GPL
#require-pap
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 4.2.2.1
ms-dns 4.2.2.3
netmask 255.255.255.0
defaultroute
noipdefault
usepeerdns

Next, add a username into the correct secrets file. Since we’re using require-chap, we will add it into /etc/ppp/chap-secrets. The syntax is simple: follow the example below to add a user (alice) with a simple password (1234).
 
/etc/ppp/chap-secrets:

# Secrets for authentication using CHAP
# client server secret IP addresses
"alice" * "1234" 172.32.50.2

One note: make sure that the file has the correct permissions. Sometimes the PPPoE Server won’t start if the file isn’t restricted enough. A simple chmod command will do here:
 
> sudo chmod 600 /etc/ppp/chap-secrets
 
Last of all, setup the IP addresses to lease for the PPPoE Server. We’re giving IP addresses 172.32.50.2 to 172.32.50.30:
 
/etc/ppp/ipaddress_pool:

172.32.50.2-30

Step #4: Set PPPoE Scripts

We are ready to start PPPoE Server. Several things to worry about: the firewall needs to be set properly so that the PPPoE Server will be able to transfer traffic from one interface to the other, and IP forwarding needs to be enabled. Since these options will have to set every time Ubuntu reboots, they’re part of the start PPPoE script. It’s placed under /etc/ppp/start_pppoe.
 
/etc/ppp/pppoe_start:

#!/bin/bash
##############################
# Simple script that starts PPPoE Server
############################## # Enable IP Forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward # Start PPPoE Server
pppoe-server -C isp -L 172.32.50.1 -p /etc/ppp/ipaddress_pool -I eth1 -m 1412 # Set Firewall rules
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The -m option for pppoe-server is needed so that the packets don’t go beyond MTU size after the PPPoE header is attached.

For complete purposes, below is a stop script to nicely tear down the PPPoE Server and revert any changes.
 
/etc/ppp/pppoe_stop:

#!/bin/bash
##############################
# Simple script that stops PPPoE Server
############################## # Disable IP Forwarding
echo 0 > /proc/sys/net/ipv4/ip_forward # Kill PPPoE Server
killall pppoe-server
killall pppd # Flush the IPtable rules.
iptables -t nat -F POSTROUTING

Step #5: Automatically start/stop PPPoE Server

All we have to do is add them into the /etc/network/interfaces so that once the computer boots and detects the interface is connected, it’ll boot up the PPPoE Server. The PPPoE Server resides in eth1 in this example below:
 
/etc/network/interfaces:

...
auto eth1
iface eth1 inet manual
post-up /etc/ppp/pppoe_start
post-down /etc/ppp/pppoe_stop
...

That’s it! Once that’s completed, then the PPPoE Server will boot up automatically and start handling traffic.

Troubleshooting

Usually, there’s always some sort of issue getting the PPPoE Server working. I found that using wireshark makes it easier to debug the situation. However, usually the interface (eth1) isn’t up for wireshark to sniff. Make the modifications below to bring up the interface without assigning an IP address to it:

/etc/network/interfaces:

...
auto eth1
iface eth1 inet manual
up ifconfig $IFACE 0.0.0.0 up
post-up /etc/ppp/pppoe_start
post-down /etc/ppp/pppoe_stop
down ifconfig $IFACE down
...

That should make it easier to debug.

How to create a PPPoE Server on Ubuntu? (Untested)的更多相关文章

  1. PPPoE Server Under Ubuntu/Debian

    http://imranasghar.blogspot.com/2009/05/pppoe-server-under-ubuntudebian.html ----------------------- ...

  2. Ubuntu上架设PPPoE Server

    一.安裝 PPPoE Server Software1)sudo apt-get install ppp2)rp-pppoe(非apt套件)wget -c http://www.roaringpeng ...

  3. How to set up an FTP server on Ubuntu 14.04

    How to set up an FTP server on Ubuntu 14.04 Setting up a fully-functional and highly secure FTP serv ...

  4. Ubuntu上配置SQL Server Always On Availability Group(Configure Always On Availability Group for SQL Server on Ubuntu)

    下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...

  5. How to Install and Configure Bind 9 (DNS Server) on Ubuntu / Debian System

    by Pradeep Kumar · Published November 19, 2017 · Updated November 19, 2017 DNS or Domain Name System ...

  6. Configure Always On Availability Group for SQL Server on Ubuntu——Ubuntu上配置SQL Server Always On Availability Group

    下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...

  7. Setup FTP server on Ubuntu 14.04

    Setup FTP server on Ubuntu 14.04 Step 1 » Update repositories .krizna@leela:~$ sudo apt-get updateSt ...

  8. pppoe server 搭建

    Ubuntu 上搭建 pppoe server sudo apt-get install pppoe $ cat /etc/ppp/pppoe-server-options # PPP options ...

  9. Configure Always On Availability Group for SQL Server on Ubuntu

    下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...

随机推荐

  1. android textview 自动换行 整齐排版

    一.问题在哪里? textview显示长文字时会进行自动折行,如果遇到一些特殊情况,自动折行会杯具成这个样子: 上述特殊情况包括: 1)全角/半角符号混排(一般是数字.字母.汉字混排) 2)全角/半角 ...

  2. oracle中批量生成字段类型的脚本

    select ' ALTER TABLE '||table_name || '  MODIFY( '|| column_name || ' DATE );' from USER_TAB_COLUMNS ...

  3. sql左连接,右连接,内连接

    1.sql查询时什么叫左连接和右连接    左连接和右连接都是外部连接,也就是区别于内部连接,它对不满足连接条件的行并不是象内部连接一样将数据完全过滤掉,而是保留一部分数据,行数不会减少.    左或 ...

  4. FusionCharts 3.2.1 flash 图表展示、数据钻取

    StackedColumn3DLineDY.swf 效果展示: 一.页面代码 <div id="chart2div" align="center" sty ...

  5. SVM原理(1)

    SVM即支持向量机,是一种机器学习内的二类分类方法,是有监督学习方法. 首先我们需要建立一个分类任务: 首先考虑线性可分的情况:(所谓线性可分就是在N维空间上的两类点,可以用N-1个未知数的函数(超平 ...

  6. 【足迹C&plus;&plus;primer】表达式求值

    表达式求值 /** * 功能:表达式求值(0到9) * 时间:2014年6月15日08:02:31 * 作者:cutter_point */ #include<stdlib.h> #inc ...

  7. Unity3D 游戏开发架构篇 ——性格一流的设计和持久性

    在游戏开发.游戏人物占了非常大的空间.所有内容都是由主角可以说游戏驱动. 下面来介绍一下一流的设计和持久性的作用. 一.应用场景 游戏中的角色类型不一而足,有不同的技能.有不同的属性等等.有些一个玩家 ...

  8. Spring Boot 系列教程16-数据国际化

    internationalization(i18n) 国际化(internationalization)是设计和制造容易适应不同区域要求的产品的一种方式. 它要求从产品中抽离所有地域语言,国家/地区和 ...

  9. Qt msvc 乱码如何解决?

    #ifdef Q_OS_WIN #pragma execution_character_set("UTF-8") #endif

  10. 你学会UI设计了吗?

    你学会UI设计了吗? UI设计师如何前驱? 关于产品 作为一个UI设计师,我们还在干巴巴的等着产品经理甚至交互提供的需求和原型再开始动手吗?这样被动的工作是永远无法提升自己的,当然你也永远只能拿到几千 ...