---
# System prepended metadata

title: PPPoE server
tags: [4. Software development]

---

# WWC (W-AGF) Environment Design 
###### tags: `free5gc` `openairinterface`

:::info
- **Location:** RT LAB
- **Date:** Des 9, 2024
- **Agenda**
1. Open5GS
    - VM OS : Ubuntu 22.04.6
    - IP : 192.168.60.2
    - ogstun : 10.45.0.1 
1. UERANSIM & PPPoE server
    - VM OS : Ubuntu 22.04.6
    1. For client 1 
    - enp0s9 102.168.58.3
    - uesimtun0 : 10.45.0.2
    - ppp0 : 10.45.0.99
    1. For Client 2
    - enp0s8 192.168.60.3
    - uesimtun1 : 10.45.0.3
    - ppp1 : 10.45.0.98

1. PPPoE client 1
    - VM OS : Ubuntu 22.04.6
    - enp0s8 192.168.58.95
    - ppp0 : 10.45.0.95
1. PPPoE client 1
    - VM OS : Ubuntu 22.04.6
    - enp0s8 192.168.60.97
    - ppp0 : 10.45.0.97

- **Author:** Saffana Zyan DINI
- **Contact:** Zyzy <M11102815@gapps.ntust.edu.tw>
- **Reference:** 
    - [End to End test open5gs and Openairinterface CU/DU split](https://hackmd.io/@HMiZWWkbRWe7Lksri7E63g/SyaWXi3ZJe)

:::
![open5gs oai-design and architecture PPPoE.drawio](https://hackmd.io/_uploads/HJDS8qBVke.png)

# PPPoE server 

## Install Requirement
```
sudo apt update
sudo apt install build-essential ppp libpcap-dev ppp-dev pppoeconf
```

## git clone
```
sudo git clone https://salsa.debian.org/dskoll/rp-pppoe.git
cd rp-pppoe/src
sudo ./configure --enable-plugin
sudo make
sudo make install
```

## config
**Server Config**
```
sudo nano /etc/ppp/pppoe-server-options
```

```
noauth
logfile /var/log/pppoe.log
ms-dns 8.8.8.8          
mtu 1492
mru 1492
default-asyncmap
e-password
lcp-echo-interval 10
lcp-echo-failure 2
```
**Chap Password**
```
sudo nano /etc/ppp/chap-secrets
```
```
"001" * "123" *
"circuitID" * "123456" *
```

```
sudo nano /etc/ppp/options
```

## run pppoe server
```
sudo pppoe-server -I enp0s9 -L 10.45.0.99 -R 10.45.0.95 -N 1
```

## check interface
```
ifconfig ppp0
```

## check log
```
sudo tail -f /var/log/syslog
sudo tail -f /var/log/pppoe.log
```

## kill pppoe
```
sudo pkill pppoe-server
```

## remove pppoe
```
cd ~/rp-pppoe/src
sudo make clean
sudo rm -rf /etc/ppp/
```

## ip forwarding
```
sudo sysctl -w net.ipv4.ip_forward=1
sudo nano /etc/sysctl.conf
net.ipv4.ip_forward=1
```

## NAT Configuration
```

sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/24 -o oaitun_ue1 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/24 -o uesimtun0 -j MASQUERADE
```

## ip rule route
```
sudo ip route add 10.45.0.0/24 dev oaitun_ue1
sudo ip route add 10.45.0.0/24 dev uesimtun0
sudo ip rule add from <RG IP> table 97 
sudo ip rule add from 10.45.0.97 table 97 
sudo ip route add 10.45.0.0/24 dev uesimtun1 table 97
ip route show table 97
```
# PPPoE client

```
sudo apt update
sudo apt install build-essential ppp libpcap-dev ppp-dev pppoeconf
```

```
sudo git clone https://salsa.debian.org/dskoll/rp-pppoe.git
cd rp-pppoe/src
sudo ./configure --enable-plugin
sudo make
sudo make install
cd /etc/ppp
```

```
sudo nano /etc/ppp/peers/rg
```

```
plugin rp-pppoe.so
enp0s9                # Interface Ethernet
user "circuitID"      # CircuitID
remotename RemoteID   # RemoteID
persist
noauth
defaultroute
hide-password
mtu 1492
mru 1492
```

## Kernel
```
    plugin /etc/ppp/plugins/rp-pppoe.so
    nic-enp0s9 # Interface Ethernet
    noauth
    remotename RemoteID # RemoteID 
    name circuitID # CircuitID
    noipdefault
    nodetach
    noaccomp
    nodeflate
    nopcomp
    novj
    novjccomp
    lcp-echo-interval 10
```

## auth
```
sudo nano /etc/ppp/pap-secrets
sudo nano /etc/ppp/chap-secrets

```
## Config IP 
```
sudo nano /etc/netplan/00-installer-config.yaml
sudo netplan apply
```

## running RG
```
sudo pppd call rg
```

## stop RG
```
sudo pkill pppd
```
## set route
```
sudo ip route add 10.45.0.0/24 via 10.45.0.99
```

### **Verifikasi**
from RG
```
   ping 10.45.0.1

   traceroute 10.45.0.1

```

:dart: Open5gs test result
---
UE 1 log PDU session established
![image](https://hackmd.io/_uploads/HykR0bE4Je.png)
UE 2 Log PDU session established
![image](https://hackmd.io/_uploads/SJBMRZNNke.png)

:books: UERANSIM & PPPoE server test result
---
UE 1 log PDU session established
![image](https://hackmd.io/_uploads/rJ7N1zVVkl.png)
UE 2 Log PDU session established
![image](https://hackmd.io/_uploads/HJ7BkG4Eye.png)
active interface, for UE 1 and UE 2 
![image](https://hackmd.io/_uploads/HktO1G441e.png)
config IP rule for routing path
![image](https://hackmd.io/_uploads/ryueeGVVJe.png)
![image](https://hackmd.io/_uploads/HkdRvf4Nkl.png)

:mag: PPPoE client 1 test result
---
PPPoE client 1 log
![image](https://hackmd.io/_uploads/SkMpZzENJg.png)
check connection with ping
![image](https://hackmd.io/_uploads/Bk4wGGEEyx.png)
check connection with traceroute
![image](https://hackmd.io/_uploads/SJJFzz4Vyl.png)



:closed_book: PPPoE client 2 test result
--
PPPoE client 2 log
![image](https://hackmd.io/_uploads/H1zAZGEVyg.png)
wireshark of req-resp pppoe
![image](https://hackmd.io/_uploads/SJazLGN41g.png)

check connection with ping
![image](https://hackmd.io/_uploads/H1P6zGVVyl.png)
check connection with traceroute
![image](https://hackmd.io/_uploads/HyFzQzEEJl.png)
pppoe authentication prosedure
![image](https://hackmd.io/_uploads/S1Ikcc9Vye.png)

:closed_book: Wireshark E2E test 
--
this tcpdump catch from open5gs
![image](https://hackmd.io/_uploads/HJJ9ibV41l.png)

==Importance== this is still on going
