Use p command
If you want to know more about what pppoeconf do, you can try to configure pppoe by hand on a laptop first, then do the exaclty same thing on rpi.
Step 1: Fill in the password and username
Change *-secrets
file in/etc/ppp
,usually you need to modify 2 files:
$ cd /etc/ppp/
$ sudo vi chap-secrets
$ sudo vi pap-secrets
Replace the USERNAME
and PASSWORD
in *-secrets
assigned by your ISP.
# Secrets for authentication using CHAP/PAP
# client server secret IP addresses
"USERNAME" * "PASSWORD" *
Step 2: Create a peer file
Create a Peer file that contains the settings for connecting to your ISP.
$ cd /etc/ppp/peers
# This file can be named whatever you want.We name it test_a for example
$ sudo vi test_a
If you look into the directory, you can see a file named provider, which provided by ubuntu, we don't use it currently.
$ ls /etc/ppp/peers
dsl-provider provider
Then edit/save test_a to look like this:
# example configuration for a dialup connection authenticated with PAP or CHAP
#
# This is the default configuration used by pon(1) and poff(1).
# See the manual page pppd(8) for information on all the options.
# MUST CHANGE: replace myusername@realm with the PPP login name given to
# your by your provider.
# There should be a matching entry with the password in /etc/ppp/pap-secrets
# and/or /etc/ppp/chap-secrets.
user "username"
# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute
replacedefaultroute
# Makes pppd "dial again" when the connection is lost.
persist
# Do not ask the remote to authenticate.
noauth
# you should specify which interface is connected to the ISP gateway,for me it is eth0
plugin rp-pppoe.so eth0
hide-password
For more info about setting refer to pppd doc.
Step 3 : Modify interfaces
Change/etc/network/interfaces
to look like this:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
#source-directory /etc/network/interfaces.d
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
reboot
$ sudo reboot
Step 4 : Dail up
$ sudo pon test_a
Plugin rp-pppoe.so loaded.
# To stop dailing
$ sudo poff test_a
Verification
Get the IP.
open the terminal with
Ctrl
+Alt
+T
and tap the command below:$ ifconfig
you will see a interface named
ppp0
.Check ip route
$ ip route default dev ppp0 scope link
Resolve domain
$ nslookup DOMAIN
Visit website
$ curl DOMAIN
Trouble shooting
Firstly, check whether you got a public IP on ppp0 interface, then you can follow the trouble shooting tree to find out what is wrong:
How to check whether DNS is woking fine
# use nslookup to check whether ip address can be got for a specific domain
$ nslookup www.baidu.com
Server: 114.23.33.1
Address: 114.23.33.1#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 115.239.211.112
Name: www.a.shifen.com
Address: 115.239.210.27
# check /etc/resolv.conf, you should see dns servers
$ vi /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 114.23.33.1
nameserver 114.23.32.1
How to check whether PAP or CHAP protocol is used for authentication
Method 1
$ plog PAP authentication succeeded ----> PAP is used
Method 2
Delete char-secrets/pap-secrets to check whether authetincation is passed
Method 3
Add
require-char
orrequire-pap
in /etc/ppp/peers/test_a to check whether authetication is passed or refused
How to check whether ip route is working fine
$ ip route
default dev ppp0 scope link