How to create a PPPoE Server on Ubuntu? (Untested)
How to create a PPPoE Server on Ubuntu? (Untested)
How to create a PPPoE Server on Ubuntu?
March 30, 2011 Leave a comment Go to commentsFor 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
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- Network Configuration
Step #2: Install PPP and RP-PPPoE
> 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
/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
/etc/ppp/chap-secrets:
# Secrets for authentication using CHAP # client server secret IP addresses "alice" * "1234" 172.32.50.2
> 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
/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
/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
/etc/network/interfaces:
... auto eth1 iface eth1 inet manual post-up /etc/ppp/pppoe_start post-down /etc/ppp/pppoe_stop ...
Troubleshooting
/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 ...
评论暂时关闭