Skip to main content

Session Lifecycle

Detailed walkthrough of PPPoE and DHCP session establishment and termination.

PPPoE Session Lifecycle

Phase 1: VLAN Interface Creation

1. Subscriber sends PPPoE PADI (broadcast)
└─ Frame: Ethernet → VLAN tags → PPPoE PADI

2. abng-demux captures PADI
└─ AF_PACKET socket with BPF filter
└─ Parses Ethernet header and VLAN tags
└─ Matches outer VLAN against configured VLANs

3. abng-demux creates VLAN interface
└─ Interface name: eth1.111.500.100
└─ Brings interface up
└─ Notifies abngd: interface_created event

4. abngd receives interface_created event
└─ Adds interface to session manager
└─ Tells accel-ppp to bind to interface
└─ Tells abng-dhcpd to listen on interface

Phase 2: PPPoE Discovery

5. accel-ppp sends PPPoE PADO (offer)
└─ AC name: "AthenaBNG"
└─ Service name: (empty)

6. Subscriber receives PADO
└─ Sends PPPoE PADR (request)

7. accel-ppp sends PPPoE PADS (session confirmation)
└─ Session ID assigned
└─ Creates PPP interface: ppp0

Phase 3: PPP Negotiation

8. LCP (Link Control Protocol) negotiation
└─ MTU/MRU: 1492
└─ LCP echo: 30s interval, 3 failures

9. IPCP (IP Control Protocol) negotiation
└─ Subscriber requests IP address
└─ accel-ppp requests from RADIUS

Phase 4: RADIUS Authentication

10. accel-ppp sends RADIUS Access-Request
└─ User-Name: "user1"
└─ User-Password: "password" (PAP)
└─ NAS-Identifier: "AthenaBNG"
└─ NAS-Port-Id: "eth1.111.500.100" (Circuit ID)

11. RADIUS server processes request
└─ Validates credentials
└─ Returns Access-Accept with attributes:
├─ Framed-IP-Address: 203.0.113.10
├─ Session-Timeout: 3600
├─ Athena-Rate-Down: 100mbit
└─ Athena-Rate-Up: 40mbit

12. accel-ppp receives Access-Accept
└─ Completes IPCP negotiation
└─ Assigns IP to subscriber
└─ Triggers ip-up script

Phase 5: Session Registration

13. accel-ppp ip-up script calls abng-notify
└─ Passes session details:
├─ Interface: eth1.111.500.100
├─ PPP interface: ppp0
├─ Username: user1
├─ IP address: 203.0.113.10
├─ RADIUS attributes
└─ Session ID

14. abng-notify sends IPC request to abngd
└─ Method: session.pppoe_up
└─ Abngd creates session in database

15. abngd notifies abng-qos
└─ Session ID: 1
└─ Interface: ppp0
└─ Download rate: 100mbit
└─ Upload rate: 40mbit
└─ Overhead profile: pppoe_ethernet

Phase 6: QoS Application

16. abng-qos creates CAKE qdisc on ppp0
└─ Egress (download) shaping: 100mbit
└─ Overhead: 34 bytes
└─ MPU: 64 bytes

17. abng-qos creates IFB device: ifb-ppp0
└─ Redirects ingress to IFB
└─ Creates CAKE qdisc on IFB
└─ Ingress (upload) shaping: 40mbit

18. Session active
└─ Subscriber can send/receive traffic
└─ Traffic shaped by CAKE
└─ Accounting data collected

Phase 7: Session Termination

19. Subscriber disconnects or timeout
└─ Sends PPPoE PADT (terminate)
└─ Or session timeout reached

20. accel-ppp terminates session
└─ Triggers ip-down script
└─ Removes PPP interface

21. accel-ppp ip-down script calls abng-notify
└─ Method: session.pppoe_down
└─ Passes session ID and termination reason

22. abng-notify sends IPC request to abngd
└─ Abngd removes session from database
└─ Notifies abng-qos of session removal

23. abng-qos removes CAKE qdisc
└─ Removes egress CAKE from ppp0
└─ Removes IFB device: ifb-ppp0
└─ Removes ingress CAKE

24. abngd sends RADIUS Accounting-Stop
└─ Acct-Session-Id: abng-1709312400-1
└─ Acct-Status-Type: Stop
└─ Acct-Input-Octets: (bytes received)
└─ Acct-Output-Octets: (bytes sent)
└─ Acct-Session-Time: (duration)

25. VLAN interface cleanup
└─ abng-demux background task runs every 60s
└─ Checks for active sessions on VLAN interface
└─ If no sessions and no traffic for idle_timeout:
└─ Removes VLAN interface
└─ Notifies abngd: interface_removed event

DHCP/IPoE Session Lifecycle

Phase 1: VLAN Interface Creation

1. Subscriber sends DHCP Discover (broadcast)
└─ Frame: Ethernet → VLAN tags → DHCP Discover

2. abng-demux captures Discover
└─ AF_PACKET socket with BPF filter
└─ Parses Ethernet header and VLAN tags
└─ Matches outer VLAN against configured VLANs

3. abng-demux creates VLAN interface
└─ Interface name: eth1.111.500.100
└─ Brings interface up
└─ Notifies abngd: interface_created event

4. abngd receives interface_created event
└─ Adds interface to session manager
└─ Tells abng-dhcpd to listen on interface

Phase 2: DHCP Relay

5. abng-dhcpd relay captures DHCP Discover
└─ AF_PACKET socket with BPF filter
└─ Injects Option 82 Circuit ID: "eth1.111.500.100"
└─ Forwards to DHCP server

Phase 3: RADIUS Authentication

6. abng-dhcpd sends RADIUS Access-Request
└─ User-Name: "aa:bb:cc:dd:ee:ff" (MAC)
└─ Calling-Station-Id: "aa:bb:cc:dd:ee:ff"
└─ NAS-Port-Id: "eth1.111.500.100" (Circuit ID)
└─ NAS-Identifier: "AthenaBNG"

7. RADIUS server processes request
└─ Validates MAC address
└─ Returns Access-Accept with attributes:
├─ Framed-IP-Address: 203.0.113.20
├─ Framed-IP-Netmask: 255.255.255.255
├─ Session-Timeout: 3600
├─ Athena-Rate-Down: 50mbit
└─ Athena-Rate-Up: 20mbit

Phase 4: DHCP Offer

8. DHCP server sends DHCP Offer
└─ IP address: 203.0.113.20
└─ Lease time: 3600 seconds

9. abng-dhcpd relay receives Offer
└─ Forwards back to subscriber on correct VLAN

Phase 5: DHCP Request/ACK

10. Subscriber sends DHCP Request
└─ abng-dhcpd relay captures and forwards

11. DHCP server sends DHCP ACK
└─ abng-dhcpd relay receives and forwards

12. abng-dhcpd notifies abngd
└─ Method: session.dhcp_up
└─ Passes session details:
├─ Interface: eth1.111.500.100
├─ MAC address: aa:bb:cc:dd:ee:ff
├─ IP address: 203.0.113.20
├─ Lease time: 3600
├─ RADIUS attributes
└─ Session ID

13. abngd creates session in database

Phase 6: QoS Application

14. abng-qos creates CAKE qdisc on eth1.111.500.100
└─ Egress (download) shaping: 50mbit
└─ Overhead: 22 bytes (IPoE)
└─ MPU: 64 bytes

15. abng-qos creates IFB device: ifb-eth1.111.500.100
└─ Redirects ingress to IFB
└─ Creates CAKE qdisc on IFB
└─ Ingress (upload) shaping: 20mbit

16. Session active
└─ Subscriber can send/receive traffic
└─ Traffic shaped by CAKE
└─ Accounting data collected

Phase 7: Session Termination

17. Lease expires or subscriber releases
└─ Subscriber sends DHCP Release
└─ Or lease timeout reached

18. abng-dhcpd terminates session
└─ Removes lease from database
└─ Notifies abngd: session.dhcp_down

19. abngd removes session from database
└─ Notifies abng-qos of session removal

20. abng-qos removes CAKE qdisc
└─ Removes egress CAKE from eth1.111.500.100
└─ Removes IFB device: ifb-eth1.111.500.100
└─ Removes ingress CAKE

21. abngd sends RADIUS Accounting-Stop
└─ Acct-Session-Id: abng-1709312400-2
└─ Acct-Status-Type: Stop
└─ Acct-Input-Octets: (bytes received)
└─ Acct-Output-Octets: (bytes sent)
└─ Acct-Session-Time: (duration)

22. VLAN interface cleanup
└─ abng-demux background task runs every 60s
└─ Checks for active sessions on VLAN interface
└─ If no sessions and no traffic for idle_timeout:
└─ Removes VLAN interface
└─ Notifies abngd: interface_removed event

Change of Authorization (CoA)

1. RADIUS server sends CoA-Request
└─ Acct-Session-Id: abng-1709312400-1
└─ Athena-Rate-Down: 25mbit
└─ Athena-Rate-Up: 10mbit

2. abngd receives CoA-Request on UDP 3799
└─ Looks up session by Acct-Session-Id
└─ Updates session rates in database
└─ Notifies abng-qos of rate change

3. abng-qos updates CAKE qdisc
└─ Uses tc qdisc change (not replace)
└─ Updates egress CAKE: 25mbit
└─ Updates ingress CAKE: 10mbit
└─ No packet loss during update

4. abngd sends CoA-ACK to RADIUS server
└─ Confirms rate change accepted

Next Steps