Lab 08-02 · PPPoE server: become the Internet provider¶
MTCNA
Module 8 · Tunnels. Theory on official course slides 318–328 (IP pool, PPP profile, PPP secret, PPPoE server, PPP status, point-to-point addresses); this lab is the LAB on slides 329–331.
In Lab 08-01 your router logged in to the provider. Have you ever wondered what the provider's side looks like? Somewhere there is a machine with a list of every customer, a stack of free addresses, and a rule book that says what each customer gets.
Today that machine is your router. A hotel, a campus residence or a small village Internet provider does exactly this with a MikroTik: every room or house logs in with its own username, gets an address from a pool, and the owner can see who is connected right now and cut anyone off.
What you will learn
- Build the four pieces of a PPP server: IP pool, PPP profile, PPP secret and the PPPoE server
- Explain why a PPPoE server must not run on a bridge port and should not have an IP address on its interface
- Connect a Linux laptop as a PPPoE client with
pppdand read its point-to-point address - Watch and end sessions from PPP → Active Connections
- Defuse the trap: the laptop browses by IP, but DNS to the router times out, because the tunnel interface is not in the list LAN
The pneumatic tube, seen from the station¶
In Lab 08-01 we imagined the network as a big public building, and a tunnel as a private pneumatic tube inside it: your packets travel in a capsule from one end to the other, and the corridors only see the capsule (that wrapping is called encapsulation).
Now you run the tube station. To open tubes for other people you need four things:
| Station needs... | RouterOS piece | Menu |
|---|---|---|
| A rack of mailbox numbers to hand out | IP pool | IP → Pool |
| One rule card that applies to every tube | PPP profile | PPP → Profiles |
| The list of people allowed in, with their passwords | PPP secret | PPP → Secrets |
| The door where people knock | PPPoE server | PPP → PPPoE Servers |
IP pool: the rack of addresses¶
An IP pool is a named range of addresses that RouterOS services hand out automatically.
DHCP servers, PPP servers and HotSpot all take their addresses from pools (slide 318). You already used one in Module 4 for DHCP. Here the pool pppoe-pool holds 10.88.0.10–10.88.0.50: 41 addresses for 41 simultaneous customers.
PPP profile: the rule card¶
A PPP profile is a set of settings applied to every client that uses it: the server's own tunnel address, which pool to take client addresses from, DNS, encryption...
Writing the rules once in a profile and pointing many users at it is much easier than configuring each user (slide 320). The important fields:
| Field | Value in this lab | Meaning |
|---|---|---|
| Local Address | 10.88.0.1 | The router's end of every tube |
| Remote Address | pppoe-pool | Where each client's address comes from |
| DNS Server | 10.88.0.1 | DNS announced to the clients (the router itself) |
| Use Encryption | yes | Offer encryption to clients that can use it (slide 321 suggests it) |
| Interface List | LAN | Every new tube interface joins the list LAN (see the trap in Step 3) |
All tubes share the same local address 10.88.0.1. That is fine: with point-to-point addresses each tube is a separate /32 link with only two ends, so there is no subnet to clash (slides 327–328).
PPP secret: the guest list¶
A PPP secret is one entry in the router's local user database: a username, a password, the profile to use and, optionally, settings for that user only.
If a secret sets something that the profile also sets (for example a fixed remote address for one VIP customer), the secret wins (slide 322). In this lab there is one secret: student / mtcnalab. Its service stays any, so the same account will also work for PPTP and SSTP in Lab 08-03.
PPPoE server: the door¶
The PPPoE server (the access concentrator) listens on one interface for PPPoE discovery and opens a session for every client that logs in correctly.
Two rules from slide 324:
- It cannot run on an interface that is a bridge port. A bridge port is no longer an independent interface: the bridge owns its traffic. Either take the port out of the bridge, or run the server on the bridge itself.
- For security, that interface should not have an IP address. Then the only way in is to log in: someone who plugs in a cable and just sets an IP by hand gets nothing.
Authentication is how the client proves its password. Use MS-CHAPv2 (mschap2): PAP sends the password as plain text, and MPPE encryption only works with MS-CHAP.
The scenario¶
Your laptop pc1 is plugged into ether5 of your router. At the start ether5 is an ordinary LAN port in bridge1, so the laptop gets 192.168.88.x by DHCP. In the lab you turn ether5 into a PPPoE "door" (in class you would move the laptop's cable to the PPPoE port; here the cable already sits in the right place).
flowchart LR
INET["<b>internet</b><br>198.51.100.10"]
AP["<b>class-ap</b><br>10.0.0.1<br>class gateway"]
subgraph R1["r1 · your router = the provider"]
WAN["ether2 · WAN<br>DHCP 10.0.0.x"]
BR["bridge1<br>192.168.88.1/24<br>ether3, ether4"]
E5["ether5 · no IP<br><b>PPPoE server 'mtcna'</b><br>tube end 10.88.0.1"]
end
PC1["<b>pc1</b> · your laptop<br>pppd: user student<br>gets 10.88.0.x/32"]
INET --- AP
AP ---|"10.0.0.0/24"| WAN
E5 ===|"PPPoE tube"| PC1
| Node | Role | Address |
|---|---|---|
internet |
"The Internet": web server, answers ping | 198.51.100.10/24 |
class-ap |
Trainer's router, class gateway | 10.0.0.1/24 |
r1 |
Your router, today the PPPoE server | WAN ether2 by DHCP · LAN 192.168.88.1/24 · tube end 10.88.0.1 |
pc1 |
Your laptop (Debian, with pppd and pppoe) |
192.168.88.x at the start · 10.88.0.10–50 after the lab |
On a real hAP the Internet port is ether1; in the virtual lab ether1 is reserved for the lab itself, so the Internet port is ether2 and the LAN ports start at ether3.
Start the lab¶
Download the lab files and unzip them: 08-02-pppoe-server.zip. Open a terminal inside the 08-02-pppoe-server folder.
Wait about a minute for RouterOS, then:
ssh admin@clab-mtcna-08-02-r1 # your router, password: admin
docker exec -it clab-mtcna-08-02-pc1 bash # your laptop
Step 1 · Free ether5 from the bridge¶
The door must be an independent interface with no address. Check both conditions, then take ether5 out of the bridge (slide 329; in RouterOS v6 this was "master port: none", in v7 it is a bridge port).
WinBox: Bridge → Ports, select ether5, click − (remove). Check IP → Addresses.
/interface bridge port print
/interface bridge port remove [find interface=ether5]
/interface bridge port print
/ip address print where interface=ether5
ether5 no longer appears among the ports, and it has no address. On the laptop, the old connection is now dead:
100% packet loss: the laptop is now on a port that only speaks PPPoE, and nothing is listening yet.
Check yourself
- Why can a PPPoE server not run on a port that belongs to a bridge?
- Why is it safer if ether5 has no IP address?
Done when ether5 is not a bridge port and has no IP address.
Step 2 · Create the pool and the profile¶
First the rack of addresses, then the rule card that uses it.
WinBox: IP → Pool → +: Name pppoe-pool, Addresses 10.88.0.10-10.88.0.50. Then PPP → Profiles → +: Name pppoe-profile, Local Address 10.88.0.1, Remote Address pppoe-pool, DNS Server 10.88.0.1, Protocols tab: Use Encryption yes; General tab: Interface List LAN.
/ip pool add name=pppoe-pool ranges=10.88.0.10-10.88.0.50
/ppp profile add name=pppoe-profile local-address=10.88.0.1 remote-address=pppoe-pool \
dns-server=10.88.0.1 use-encryption=yes interface-list=LAN
/ppp profile print detail where name=pppoe-profile
The trap: why interface-list=LAN?
Your router has the default input firewall: it only answers DNS, WinBox and SSH from interfaces in the list LAN (/ip firewall filter print, rule "drop all not coming from LAN"). Each client tube appears as a new dynamic interface, for example <pppoe-student>, which is in no list. Without interface-list=LAN, the laptop can ping and browse by IP (ICMP is accepted, and forwarding is not filtered), but every DNS question to 10.88.0.1 times out, so "the Internet does not work" by name. We tested it: exactly that happens.
Check yourself
- Why can all clients share the same local address 10.88.0.1 without a conflict?
- In your own words, what does the profile save you compared with configuring every user separately?
Done when the profile shows local-address=10.88.0.1 remote-address=pppoe-pool and interface-list=LAN.
Step 3 · Add the secret (the guest list)¶
WinBox: PPP → Secrets → +: Name student, Password mtcnalab, Service any, Profile pppoe-profile.
Check yourself
- If this secret had
remote-address=10.88.0.99and the profile used the pool, which address wouldstudentget? Why?
Done when the secret student is listed with the profile pppoe-profile.
Step 4 · Open the door: the PPPoE server¶
WinBox: PPP → PPPoE Servers → +: Service Name mtcna, Interface ether5, Default Profile pppoe-profile, One Session Per Host ticked, Authentication: only mschap2.
/interface pppoe-server server add service-name=mtcna interface=ether5 \
default-profile=pppoe-profile authentication=mschap2 one-session-per-host=yes disabled=no
/interface pppoe-server server print
One session per host stops the same laptop (same MAC address) from opening two tubes at once.
Check yourself
- Why do we leave PAP out of the authentication list?
Done when the server is listed without the X (disabled) flag.
Step 5 · Dial in from the laptop¶
Linux has a PPPoE client: pppd (the PPP daemon) with its pppoe.so plugin. First, forget the old DHCP address and look for the door:
Now write a small peer file (the client's settings) and dial:
cat > /etc/ppp/peers/mtcna <<'EOF'
plugin pppoe.so
nic-eth1
rp_pppoe_service mtcna
user "student"
password "mtcnalab"
noauth
defaultroute
usepeerdns
persist
EOF
pppd call mtcna
sleep 5
ip -4 addr show ppp0
ip route
Expected:
ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492
inet 10.88.0.50 peer 10.88.0.1/32 scope global ppp0
default dev ppp0 scope link
noauth means "I do not ask the server to prove who it is"; defaultroute and usepeerdns are the Linux twins of RouterOS's add-default-route and use-peer-dns. pppd stores the announced DNS in /etc/ppp/resolv.conf; copy it so the laptop uses it, then test:
cp /etc/ppp/resolv.conf /etc/resolv.conf
dig +short www.mikrotik.com
curl -m 5 http://www.mikrotik.com/
You get 198.51.100.10 and <h1>Welcome to the Internet</h1>. Your laptop reaches the Internet through your tube, and your router masquerades it out of ether2 like any LAN device.
Check yourself
- The laptop's address is
10.88.0.50withpeer 10.88.0.1/32. Which end is which? - Pool addresses go from .10 to .50. Which one did you get? Is that what you expected?
Done when pc1 has a 10.88.0.x address on ppp0 and the web page loads by name.
Step 6 · Watch your customers¶
A provider must see who is online. In class you would also connect with MAC WinBox (Module 1) from the laptop to watch this live.
WinBox: PPP → Active Connections; Interfaces shows the dynamic <pppoe-student>; Interfaces → Interface List shows it inside LAN.
CALLER-ID is the laptop's MAC address, because PPPoE works on Ethernet.
Now run the automatic check from the lab folder on your Ubuntu PC; every line must say PASS:
Check yourself
- Which column tells you where the customer is physically connected from?
Done when you see student in the active connections and check.sh passes.
Step 7 · Hang up and put things back¶
The course ends by disconnecting and moving the laptop back to its usual port (slide 331). Hang up from the laptop, and watch the session disappear on the router:
The list is empty. To kick a customer from the router side instead: PPP → Active Connections → −, or /ppp active remove [find name=student] (with persist, pppd dials again a few seconds later).
Keep the pool, profile and secret: Lab 08-03 reuses them. On a real router you would now put ether5 back in the bridge (/interface bridge port add bridge=bridge1 interface=ether5) and the laptop would get its 192.168.88.x address again.
Done when /ppp active print is empty.
If something goes wrong¶
| Symptom | Likely cause | Fix |
|---|---|---|
pppoe-discovery prints nothing ("Timeout waiting for PADO") |
Server disabled, on the wrong interface, or ether5 still in the bridge | Step 1 and Step 4 |
pppd log: authentication failed |
Wrong user/password, or the server only allows a method the client does not use | Secret student / mtcnalab; server authentication=mschap2 |
| Laptop connects but gets no address | Pool missing or profile without remote-address |
Step 2 |
| Laptop pings 198.51.100.10 but names do not resolve | Tube interface not in the list LAN, so the input firewall drops DNS | /ppp profile set pppoe-profile interface-list=LAN, then reconnect |
| Names still fail with the tube up | /etc/resolv.conf still points to the old DHCP DNS |
cp /etc/ppp/resolv.conf /etc/resolv.conf |
| Laptop reaches the router but not the Internet | No masquerade towards the WAN | /ip firewall nat print: masquerade out-interface-list=WAN |
Clean up¶
Key takeaways¶
- A PPP server is four pieces: an IP pool (addresses), a PPP profile (shared rules), PPP secrets (users) and the server itself on one interface.
- A secret overrides its profile: the profile is the default, the secret is the exception.
- The PPPoE server cannot run on a bridge port, and its interface should carry no IP address, so logging in is the only way in.
- Every client tube becomes a dynamic interface (
<pppoe-student>); put it in the right interface list or the firewall will treat it as a stranger. - PPP → Active Connections shows who is online (name, MAC as caller-id, address, uptime) and lets you disconnect them.
Quick check¶
1. Which RouterOS piece holds the username and password of one PPP customer?
- PPP secret
- PPP profile
- IP pool
- PPPoE server
A PPP secret is one entry in the local user database: name, password, profile and optional per-user settings. The profile holds rules shared by many users; the pool holds addresses.
2. You try to create a PPPoE server on ether5, which is a port of bridge1. What does the course say?
- It cannot run on a bridge port: remove ether5 from the bridge or use the bridge itself
- It works, but only for one client at a time
- It works if ether5 also gets an IP address from the LAN
- It works after a reboot, because bridges are rebuilt at startup
A bridge port is not an independent interface any more: the bridge handles its traffic. Slide 324: take the port out of the bridge, or configure the server on the bridge.
3. The profile sets remote-address=pppoe-pool, but the secret of user ana sets remote-address=10.88.0.99. Which address does ana get?
- 10.88.0.99, because the secret overrides the profile
- An address from pppoe-pool, because the profile overrides the secret
- Both addresses, one for each direction of the tunnel
- None, because the conflict stops ana from logging in
The profile gives defaults for everyone; a setting in the secret is specific to that user and wins (slide 322). That is how you give one customer a fixed address.
4. Why should the interface running the PPPoE server have no IP address?
- So that a device cannot reach the router just by setting an address by hand
- Because PPPoE discovery fails on any interface that has an address
- Because the pool would hand out that same address to a client
- Because the router would answer DHCP and PPPoE at the same time
With no IP on the interface, the only way to get any IP connectivity there is to log in and get a tube. Someone who plugs in and types a static address gets nothing (slide 324).
5. A laptop connected over PPPoE pings 198.51.100.10, but DNS questions to the router time out. The router has the default input firewall. What is missing?
- The tube interface is not in the list LAN, so the router drops DNS from it
- The pool is too small, so the laptop got a duplicate address
- The secret uses service any instead of service pppoe
- The PPPoE server needs an IP address on ether5 to answer DNS
Each client gets a dynamic interface such as <pppoe-student>. The input rule "drop all not coming from LAN" drops its DNS queries, while ICMP and forwarded traffic still pass. Setting interface-list=LAN in the profile fixes it.
6. In PPP → Active Connections, what does the caller-id column show for a PPPoE client?
- The client's MAC address
- The client's phone number
- The client's public IP address
- The name of the profile it uses
PPPoE runs over Ethernet, so the server identifies the caller by its MAC address. (For PPTP and SSTP, which run over IP, you will see an IP address instead.)
7. A residence hall gives each room a PPPoE login. A student tries to open a second session from the same laptop at the same time. Which server option stops this?
- One Session Per Host
- Use Encryption
- Default Profile
- Keepalive Timeout
one-session-per-host allows only one session per client MAC address. Use Encryption is about scrambling data, and the default profile only chooses the rule card.
Next, in Lab 08-03 you reuse this pool, profile and secret to build tunnels between two routers across the network, with PPTP and SSTP.