JUNOS subscriber management devices, such as MX series, can be used as DHCP-Local-Server to provide internet service for end clients. The DHCP subscriber can get its ip address and gateway either from a configure dynamic address pool or from RADIUS.
It is a challenge to assign a static IP address by RADIUS to the DHCP subscriber and make it work. As different residential-gateway devices(RGW, or say CPE) have different behaviors for DHCP, some of them do not support a netmask of 255.255.255.255, some of them do not support a gateway ip address not in the same subnet.
This article describes a solution on how to use RADIUS standard and vendor specific attributes to send the suitable DHCP options to work with most of the RGW devices.
In this article, MX will be used to represent JUNOS subscriber management device. RGW will be used to represent the end client’s modem.
Usually, a standard RADIUS IETF attribute 8 and attribute 9 can be used together to assign a static IP address to the subscriber.
8
Framed-IP-Address
• IP address to be configured for the user.
• 0.0.0.0 or absence is interpreted as 255.255.255.254.
9
Framed-IP-Netmask
• IP network to be configured for the user when the user is a router or switch to a network.
• Absence implies 255.255.255.255.
But the gateway IP address is an interesting part, some of the RGWs do not support a gateway in a different subnet.
There has 2 ways to handle this.
Option 1: Create pools on the MX for each subnet with a gateway IP set. The MX automatically selects the pool based on the Framed-IP-Address. The netmask and gateway IP address will also be retrieved from this pool.
Option 2: JunOS lets you set a vendor specific attribute [26-55]DHCP-Options in Access-Accept, and send raw RADIUS attributes. It supports setting the Router DHCP option that way.
This article will focus on the option 2.
Here is from Juniper public document https://www.juniper.net/documentation/us/en/software/junos/subscriber-mgmt-sessions/topics/topic-map/radius-std-attributes-vsas-support.html
26- 55
DHCP- Options
Client DHCP options.
Starting in Junos OS Release 17.4R1, includes only DHCPv4 options. In earlier releases, includes both DHCPv4 and DHCPv6 options.
hexadecimal string: dhcp- options
An example of freeRADIUS configure as this:
DEFAULT User-Name == "DHCP.1", Cleartext-Password := "123"
ERX-Virtual-Router-Name = "default:vrf-broadband-cgnat",
ERX-Local-Loopback-Interface = lo0.21,
Framed-IP-Address = 203.46.170.52,
Framed-IP-Netmask = 255.255.255.0,
ERX-Dhcp-Options = 0x0304d232e001,
Session-Timeout = 600,
Delegated-IPv6-Prefix = 2402:1b80:14:3400::/56,
Framed-IPv6-Prefix = 2402:1b80:12:3::34/128,band-cgnat-pd-v6-1,
ERX-Primary-Dns = 111.222.1.1,
ERX-Secondary-Dns = 111.222.2.2,
ERX-Ipv6-Primary-DNS = 2403:4800:1::1,
ERX-Ipv6-Secondary-DNS = 2403:4800:2::2,
Service-Type = "Framed"
Explanation of the “ERX-Dhcp-Options = 0x0304d232e001”, as below.
0x — indicates it’s a hex string format.
Noted, some RADIUS applications may treat it as port the string, so be careful and check with the RADIUS document.
03 — DHCP option 3,
04 — length of this option,
232e001 — the IP address 210.50.224.1 in hex format. Noted, in real world, it should be a gateway IP address in the same subnet as the framed-ip-address, like 203.46.170.1.
The output as following.
op@MX> show subscribers
Interface IP Address/VLAN ID User Name LS:RI
demux0.3221225474 0x8100.76 0x8100.1 VLAN.1 default:vrf-broadband-cgnat
demux0.3221225474 203.46.170.52 DHCP.1 default:vrf-broadband-cgnat
op@MX> show subscribers extensive
Type: DHCP
User Name: DHCP.1
IP Address: 203.46.170.52
IP Netmask: 255.255.255.0
Primary DNS Address: 111.222.1.1
Secondary DNS Address: 111.222.2.2
Logical System: default
Routing Instance: vrf-broadband-cgnat
Interface: demux0.3221225474
Interface type: Static
Interface Set: ifset-vt-nsw-ps0-1
Underlying Interface: demux0.3221225474
Dynamic Profile Name: DHCP
Dynamic Profile Version: 1
MAC Address: 00:10:94:02:9c:0b
State: Active
Radius Accounting ID: 7
Session ID: 7
PFE Flow ID: 46
Stacked VLAN Id: 76
VLAN Id: 1
Agent Remote ID: 1
Login Time: 2024-12-12 11:11:40 AEDT
Service Sessions: 1
DHCP Options: len 85
35 01 01 39 02 02 40 3d 07 01 00 10 94 02 9c 0b 33 04 00 00
00 3c 0c 34 63 6c 69 65 6e 74 5f 50 6f 72 74 20 2f 2f 34 2f
35 20 5b 36 34 3a 43 33 3a 44 36 3a 35 33 3a 32 37 3a 34 30
2f 78 65 2d 30 2f 31 2f 34 3a 30 5d 2d 36 2d 30 37 07 01 03
06 0f 21 2c 33
Server DHCP Options: len 6
03 04 d2 32 e0 01
DHCP Header: len 44
01 01 06 00 00 56 00 45 00 00 80 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 10 94 02 9c 0b 00 00 00 00 00 00
00 00 00 00
Accounting interval: 3600
Access Line Attributes:
Dynamic configuration:
junos-cos-shaping-rate: 115M
junos-cos-shaping-rate-burst: 143750
junos-interface-set-name: ifset-vt-nsw-ps0-1
No. Time Source Destination Protocol Length Info
6 22.342323 100.72.0.1 255.255.255.255 DHCP 338 DHCP Offer - Transaction ID 0x560045
Frame 6: 338 bytes on wire (2704 bits), 338 bytes captured (2704 bits) on interface \\.\pipe\view_capture_10-219-45-203_4_5_12122024_111231, id 0
Ethernet II, Src: 1e:9c:8c:18:c8:73 (1e:9c:8c:18:c8:73), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 76
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 1
Internet Protocol Version 4, Src: 100.72.0.1, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 67, Dst Port: 68
Dynamic Host Configuration Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x00560045
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
Client IP address: 0.0.0.0
Your (client) IP address: 203.46.170.52
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: Performa_02:9c:0b (00:10:94:02:9c:0b)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (600s) 10 minutes
Option: (1) Subnet Mask (255.255.255.0)
Subnet Mask: 255.255.255.0
Option: (54) DHCP Server Identifier (100.72.0.1)
DHCP Server Identifier: 100.72.0.1
Option: (3) Router
Router: 210.50.224.1
Option: (6) Domain Name Server
Length: 8
Domain Name Server: 111.222.1.1
Domain Name Server: 111.222.2.2
Option: (82) Agent Information Option
Length: 3
Option 82 Suboption: (2) Agent Remote ID
Option: (255) End
Option End: 255
Padding: 00
Noted, in this example, it’s just to demonstrate how to use [26-55] attribute to return the DHCP options. As far as the router ip address, it actually should be in the same subnet as the framed-ip-address.
For DHCPv6, [26-207] can be used.
26-207
DHCPv6-Options
DHCPv6 client and server options exchanged with the RADIUS server as TLV options.
In releases earlier than Junos OS Release 17.4.1R1, this VSA is not supported. DHCPv6 options are included instead in 26-55, DHCP-Options.
hexadecimal string