DHCPv4 Server Basics

This chapter describes DHCPv4 server basics.

Topics in this chapter include:

Applicability

This chapter is applicable to SR OS routers and is based on SR OS Release 14.0.R4.

Overview

The Dynamic Host Configuration Protocol for IPv4 (DHCPv4) provides a method for assigning addresses to hosts, and conveys additional configuration data to these hosts.

DHCPv4 allows for a flexible mapping of addresses to devices; for example, identified through their MAC address. While the DHCPv4 server owns and manages addresses organized in one or more pools, a DHCPv4 client obtains an address from the DHCPv4 server, which creates a lease for that client. This provides the client the right to use the address, and the server ensures that the address will not be assigned to other clients.

The DHCPv4 server implemented in SR OS has the following features:

  • Address management. The DHCPv4 server keeps track of the used and unused addresses. For the used addresses, lease durations are maintained.

  • Configuration parameter management. The DHCPv4 server stores parameters that are to be used by clients when they connect.

  • Persistency. When enabled, the DHCPv4 server stores the leases on non-volatile storage so that the leases remain across potential node reboots.

  • Failover capability. In dual-homed DHCPv4 server scenarios, a primary DHCPv4 server can take over the responsibility of a failing peer.

The DHCPv4 server failover capability is beyond the scope of this chapter.

In this chapter, when DHCP is mentioned, it implies DHCPv4.

Characteristics

IPv4 addresses and parameters are provided by the DHCP server through the Discover – Offer – Request – Acknowledge (DORA) message sequence as explained in the IPv4 DHCP Hosts chapter.

IPoE clients use DORA messages to communicate with the DHCP server via a relay agent. PPP clients use Link Control Protocol (LCP) and Internet Protocol Control Protocol (IPCP) to communicate with the router, and a local (DHCP) client manages the communication with the DHCP server. IPoE clients and PPP clients are also referred to as native clients and simulated clients, respectively.

When the DHCP server and the relay agent are physically located in the same SR OS node, the server is referred to as a local DHCP server; when they are in different nodes, the server is considered remote. Clients can obtain an address from a local, remote, or (external) third-party DHCP server.

A DHCP server can be used for IPoE users and PPP users simultaneously. A DHCP server must be hosted by a VPRN service or the base router. It can be accessed in either of the following ways; see Accessing a DHCP server:

  • When a DHCP user connects, the DORA message sequence running between the DHCP client and the DHCP server also passes through a relay agent, adding and removing user-defined options along the way. The relay agent and the DHCP server can be located in the same or in a different (remote) node.

  • When a PPP user connects through LCP and IPCP on a service with an internal DHCP client (local client) configured, the local client manages the DORA communication toward the DHCP server, if the relay agent also has relaying enabled for PPP applications. The local client and the DHCP server can be located in the same or in a different (remote) node.

  • When a PPP user connects through LCP and IPCP on a service with local address assignment configured, the DHCP server is accessed through an API-call. See the ESM SLAAC Prefix Assignment via Local Address Server chapter for an explanation of the local address assignment concept, which also applies to PPP.

Figure 1. Accessing a DHCP server

A DHCP server is supported for the routed CO model as well as for the bridged CO model.

A DHCP server can be hosted by the base router or a VPRN service, for public or private use. Because multiple VPRN services can coexist in a single node, each having its own DHCP server, overlapping address ranges are supported.

DHCP Lease

The DHCP server maintains the following data for every allocation request in a lease:

  1. client-type (PPP or DHCP)

  2. IP address

  3. MAC address

  4. lease state

  5. option 82, if relevant

  6. option 60 (vendor class identifier), if relevant

  7. lease timer related data

  8. persistence key, if applicable

A lease for a single client is in one of the following states:

  1. offered: The IP address was offered to the client. The client still has to acknowledge the offer by sending a DHCP request.

  2. stable: The IP address is now in use by the client.

  3. force-renew-pending: The IP address is in use by the client, but the server sends a DHCP force-renew message to the client, because an option has changed at pool, subnet, or client (via LUDB) level.

  4. remove-pending: The IP address is in use by the client, but the corresponding subnet range is deleted. The server sends a force-renew message to the client to force the client to reinitialize in order to get a new IP address.

  5. held: The IP address has been used by the client but the lease has expired. The lease is now in the hold list so that the client can get the same IP address upon the next request for a lease.

  6. internal: The IP address has been leased via local address assignment and is in use.

  7. internal-orphan: The IP address has been leased via local address assignment and is in use. However, there is no configured subnet to which this lease belongs, because it has been removed or because this lease was installed through dual-homing.

  8. internal-offered: The IP address has been offered via local address assignment, but the client has not acknowledged the offer yet.

  9. internal-held: The IP address has been offered via local address assignment, but the lease is currently not active. The address is now in the hold list so that the same IP address can be offered to the same client upon request of a lease.

  10. sticky: The IP address is reserved for the client and will remain reserved until the reservation for it is cleared. The client will get the same IP address upon the next request for a lease.

User Identification

The key to the leases managed by the DHCP server is configured at server level, and can be set to one of the following values (the default value being mac-circuit-id):

configure (router | service vprn <service-id>) dhcp local-dhcp-server <server-name>
   user-ident {client-id|circuit-id|mac|mac-circuit-id|remote-id}

The client ID is DHCP option 61; the circuit ID and the remote ID are sub-options 1 and 2 of DHCP option 82, respectively.

Setting user-ident to, for example, circuit-id can provide a CPE the same IP address regardless of its MAC address; thereby facilitating CPE replacement scenarios.

Lease Hold Time

The usual way for a DHCP client to indicate to the DHCP server it does not need its lease anymore is by sending a release message to the server; this is referred to as a solicited release.

However, when a client gets disconnected, or loses power, no release message is received by the server and the lease ultimately expires; this is referred to as an unsolicited release.

Without a lease hold timer, a lease is immediately deleted when the client sends the release message, or when the lease expires. The corresponding address is returned back to the pool of free addresses, and can be assigned to different clients. There is no guarantee that a client gets the same address again.

With a lease hold timer defined, a lease (entry) is not immediately deleted when the lease timer expires. Instead, the lease is put in the held or internal-held state. The lease is deleted when the hold timer expires, and the address is returned back to the pool. When the client connects, renews, or rebinds its lease before the hold timer expires, the client gets its previous lease again. There is no guarantee that the client gets the same address.

A lease hold timer can optionally be defined at the DHCP server level using the following command:

configure (router | service vprn <service-id>) dhcp local-dhcp-server <server-name>
    lease-hold-time [days <days>] [hrs <hours>] [min <minutes>] [sec <seconds>]
 
 <days>               : [0..7305]
 <hours>              : [0..23]
 <minutes>            : [0..59]
 <seconds>            : [0..59]

If delayed deletion is also required on reception of a release message (solicited release), use the following command:

configure (router | service vprn <service-id>) dhcp local-dhcp-server <server-name> 
    lease-hold-time-for solicited-release

The same behavior can be applied to IPSec, but that is beyond the scope of this chapter.

Fixed address allocation using DHCP server

Devices using DHCPv4 but still require the same IPv4 (fixed) can be populated in a LUDB associated with a DHCPv4 server. Sometimes these devices are called static devices because they get a fixed IP addressed assigned each time they request a DHCP lease. See the Local User Database for DHCPv4 Server chapter.

The DHCPv4 server also supports lease reservation based on client identifiers provisioned at the time of reservation. After a lease is reserved, it is referred to as a sticky lease in the server.

This sticky lease will subsequently only be assigned to a DHCP client using the same identifiers, though it is not required for such a client to ever exist. Sticky leases are not removed via timeout or DHCP releases but can only be removed via the management interface (SNMP/CLI). Sticky leases are typically not used for devices using DHCPv4 but for applications like vRGW through SNMP.

A sticky lease requires a host name. Identification of the host can be through a MAC address, a circuit ID, a remote ID, or a combination of these. The IP address must be in the range of the parenting pool.

tools perform router <router-id> dhcp local-dhcp-server <server-name> pool <pool-name> create-sticky-lease <hostname>
   [mac <ieee-address>]
   [circuit-id <circuit-id>]
  [client-id <client-id>]
   [requested-ip-address <ip-address>]
   [circuit-id-hex <circuit-id-hex-string>]
   [client-id-hex <client-id-hex-string>]
<hostname> : [32 chars max]
<ieee-address> : xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx
<circuit-id> : [253 chars max]
<client-id> : [255 chars max]
<ip-address> : a.b.c.d
<circuit-id-hex-st*> : [0x0..0xFFFFFFFF...(max 506 hex nibbles)]
<client-id-hex-str*> : [0x0..0xFFFFFFFF...(max 510 hex nibbles)]

Address Allocation for Sticky Leases

Sticky leases provide a static mapping between a hardware address and an IP address. This means that a particular device always gets the same IP address.

A sticky lease requires a host name. Identification of the host can be through a MAC address, a circuit ID, a remote ID, or a combination of these. The IP address must be in the range of the parenting pool.

tools perform router <router-id> dhcp local-dhcp-server <server-name> 
    pool <pool-name> create-sticky-lease <hostname>
                                   [mac <ieee-address>] 
                                   [circuit-id <circuit-id>] 
                                   [client-id <client-id>] 
                                   [requested-ip-address <ip-address>] 
                                   [circuit-id-hex <circuit-id-hex-string>]
                                   [client-id-hex <client-id-hex-string>]
 <hostname>           : [32 chars max]
 <ieee-address>       : xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx
 <circuit-id>         : [253 chars max]
 <client-id>          : [255 chars max]
 <ip-address>         : a.b.c.d
 <circuit-id-hex-st*> : [0x0..0xFFFFFFFF...(max 506 hex nibbles)]
 <client-id-hex-str*> : [0x0..0xFFFFFFFF...(max 510 hex nibbles)]

As an alternative to sticky leases, an LUDB can also be used to provide a static mapping between a hardware address and an IP address. See the Local User Database for DHCPv4 Server chapter. However, hosts added to a local user database can only survive a reboot by saving the configuration through the admin save command.

Pool and Subnet Management

The DHCPv4 servers manage IPv4 addresses, subnets, and pools. These are hierarchically related to one another; see Addresses, Subnets, and Pools in a DHCPv4 Server.

Figure 2. Addresses, Subnets, and Pools in a DHCPv4 Server

A subnet is identified by an IP address and a netmask, and defines:

  • One or more address ranges – The ranges in the subnet that the server can allocate addresses from. Multiple address ranges cannot overlap.

  • One or more exclude address ranges (optional) – A sub-range of the preceding range that the server will not allocate addresses from.

  • Minimum-free – A notification is generated when the amount of free leases reaches this value (trap and log 99).

  • Maximum-declined – Security counter measure, to prevent rogue clients from depleting the subnet. When this maximum value is reached, the oldest declined address will be returned to the pool.

  • DHCP options:

    • default-router – up to four addresses can be defined

    • subnet-mask – subnet mask to be used by the clients

    • custom-options – additional options, when required

A pool is identified by name (maximum 32 characters), and defines:

  • One or more subnets

  • Min-lease-time – requests for a shorter lease time are set to this value; default is 10 min

  • Max-lease-time – requests for a longer lease time are set to this value; default is 10 days

  • Offer-time – a timer indicating how long an offer remains valid before the address offered is returned to the pool when no Request message is received (default 1 min)

  • Minimum-free – a notification is generated when the amount of free leases reaches this value (trap and log 99), with an optional trap when all leases are used

  • DHCP options:

    • dns-server – up to four DNS servers can be specified

    • domain-name – the domain to use for DNS resolution when clients provide unqualified host names.

    • lease-renew-time – defines when the client transitions to the renew state (T1)

    • lease-rebind-time – defines when the client transitions to the rebinding state (T2)

    • lease-time – the duration of time that the DHCP server grants to the DHCP client

    • netbios-name-server – defines up to four NetBIOS name servers

    • netbios-node-type – defines the NetBIOS node type (B, P, M, or H)

    • custom-option – additional options, when required

The options added by the DHCP server in response to an allocation request is a combination of the options provided by an LUDB (if applicable), subnet options, and pool options, in this sequence.

Lease Time

A DHCP client can request a specific lease time. The DHCP server checks for this value to be within the bounds as defined at pool level. If the requested lease time is out of bounds, it is set to either the minimum or the maximum value.

If a DHCP client does not request a specific lease time, the DHCP server takes the value from a matching LUDB entry, if available, or from the lease-time parameter defined at pool level, in this sequence. If the pool level lease time is not defined, the maximum lease time is used.

The best practice is to apply the following rule when defining values for the various timers:

    lease-time > lease-rebind-time > lease-renew-time

However, the server does not check consistency of these timers, because the final values offered to the DHCP clients can come from various sources, which are out of the control of the DHCP server.

The local DHCP client always requests a lease time of 1 h to the server for PPP users connecting via the local client.

Address Allocation

When a request arrives at the DHCPv4 server, the server accesses the lease state database using the user ID as a key, checking for an existing lease. If a lease is already available, that lease is used.

Assuming that no lease is present in the lease state database yet, and that the server has a local user database attached, a matching entry is searched for in that local user database; see the Local User Database for DHCPv4 Server chapter.

In terms of address assignment, an LUDB attached to a DHCP server can return:

  • an IP address – This (fixed) address is offered to the requester, where this address must not overlap with the address ranges configured in the local DHCP server.

  • a Gi address – This address overrules any Gi address received from the requester.

  • a pool name – A free address in one of the subnets in that pool is offered. Optionally, a secondary pool can be defined, which is used in case the primary pool is exhausted.

  • use-gi-address [scope <subnet | pool>] – When the scope is set to subnet, the server offers an address from the subnet that includes the Gi address. When the scope is set to pool, the server offers an address from the subnet that includes the Gi address, or from the other subnets belonging to the same pool.

  • use-pool-from-client [delimiter <delimiter>] – The pool name specified in the DHCP client message options and added by the relay agent is used. A free address in one of the subnets in that pool is offered. If two pools are available, the configured delimiting character identifies the splitting-point to find the names of both pools.

If a unique address is found in the LUDB, that address is offered by the server to the requester.

For the general address allocation flow, see General Address Allocation for DHCP. The Local User Database for DHCPv4 Server chapter applies when an LUDB is attached to the DHCP server.

Figure 3. General Address Allocation for DHCP

Two additional parameters are available at the server level, controlling which pool and subnet an address is taken from, as follows:

    [no] use-pool-from-client [delimiter <delimiter>]
        <delimiter>          : [1 chars max]
 
    [no] use-gi-address [scope <scope>]
        <scope>              : subnet|pool

With a requester-provided pool name and use-pool-from-client active, the server checks for that pool to exist before selecting a free address from one of the subnets in that pool.

With a requester-provided Gi address and use-gi-address scope subnet active, a free address is taken from the subnet that includes the Gi address. With use-gi-address scope pool, another subnet in the pool is used if the original subnet is exhausted.

The following rules apply to the DHCP server address allocation flow:

  • Assume a DHCP server with an LUDB applied, and use-gi-address active:

    • A host lookup failure will not result in the request being dropped. The server sends an offer using an address selected based on the Gi address.

    • A successful host lookup, but returning a non-existent pool name, results in the server dropping the request, so no offer is sent.

  • Assume a DHCP server without an LUDB applied, but with use-pool-from-client and use-gi-address active:

    • A requester not providing a pool name results in the server sending an offer using an address selected based on the Gi address.

    • A requester providing a non-existent pool name results in the server dropping the request, so no offer is sent.

Therefore, use-pool-from-client takes precedence over use-gi-address. The DHCP server selects an address from a pool if that pool exists. If no pool name is provided to the DHCP server, address selection is based on the Gi address, when allowed through the use-gi-address directive.

The pool name provided by a relay agent can be a concatenation of two pool names, where the delimiter character is used to split the string apart in the original pool names.

Subnet Draining

When a subnet is put in the drained state through the drain command, no new leases can be assigned from that subnet. Existing leases are cleaned up upon renewal or rebinding of the client. This is useful in renumbering scenarios; see the Configuration section for an example.

Force Renew

Parameter force-renews enables DHCP servers to issue DHCP force-renew messages to stable clients, informing them about a configuration change.

With force-renews enabled, the server does not need to wait for a client to pass through its renew or rebind sequence to provide the reconfigured options, speeding up the configuration change.

Changes can be applied at the LUDB-level, subnet level, or pool-level.

DHCP Server Persistency

The DHCP protocol does not have a keep-alive mechanism to detect unavailability. Without precaution, a node reboot causes the loss of the DHCP lease state. Because DHCP clients only attempt a reinitialization sequence after expiration of the lease timer, service outages could become unacceptably long.

The DHCP server lease state can be made persistent across reboots. The lease state is then restored from a persistency file stored on the compact flash. Therefore, DHCP clients will only lose connectivity for the duration of the reboot, and no renew or rebind is needed.

Configuration

Starting a DHCP server up in an SR OS environment requires following steps:

  • Configure the DHCP server.

  • Configure the interfaces for the DHCP server to listen on.

  • Configure one or more relay agents.

The baseline configuration used in this chapter is shown in Baseline Service Configuration.

Figure 4. Baseline Service Configuration

Configure the DHCP Server

One or more DHCP servers can be configured in the base router or in any routed service. VPRN 1 from Baseline Service Configuration has a single DHCP server named dhcp4-VPRN1, with two pools: pool-1 and pool-2. The first pool contains two subnets; the second pool contains a single subnet.

Address selection is primarily based on a pool name (use-pool-from-client), and secondarily on the Gi address with the scope set to pool (use-gi-address scope pool). This means that address selection will be Gi address-based, if no pool name is provided to the server. Having the scope set to pool enables the server to allocate addresses from other subnets within the same pool.

Different options and custom options are defined at different levels. All subnets include an address range. Subnet 10.10.0.0/25 also has an exclusion range, as follows:

configure
    service
        vprn 1 customer 1 create
            dhcp
                local-dhcp-server dhcp4-VPRN1 create
                    use-gi-address scope pool
                    use-pool-from-client
                    pool "pool-1" create
                        options
                            dns-server 1.1.1.1 1.1.2.2
                            lease-time hrs 2
                            custom-option 150 address 1.1.1.1
                        exit
                        subnet 10.10.0.0/25 create
                            options
                                subnet-mask 255.255.255.128
                                default-router 10.10.0.1 10.10.0.2
                                custom-option 130 string "MyOption1"
                            exit
                            exclude-addresses 10.10.0.61 10.10.0.70
                            address-range 10.10.0.11 10.10.0.126
                        exit
                        subnet 10.11.0.0/24 create
                            options
                                subnet-mask 255.255.255.0
                                default-router 10.11.0.1
                                custom-option 130 string "MyOption2"
                            exit
                            address-range 10.11.0.11 10.11.0.20
                        exit
                    exit
                    pool "pool-2" create
                        subnet 10.20.0.0/16 create
                            options
                                subnet-mask 255.255.0.0
                                default-router 10.20.0.1
                            exit
                            address-range 10.20.0.21 10.20.0.120
                        exit
                    exit
                    no shutdown
                exit
            exit
        exit
    exit
exit

Configure the DHCP Interface

The DHCP server needs to be listening on one or more interfaces. In the example from General Address Allocation for DHCP, the DHCP server is associated with interface int-DHCP, with loopback address 10.11.11.1, as follows. The DHCP server cannot be applied to a group interface.

configure
    service
        vprn 1 create
            interface "int-DHCP" create
                address 10.11.11.1/24
                local-dhcp-server "dhcp4-VPRN1"
                loopback
            exit
        exit
    exit
exit

Configure Relay Agents

The configuration of the DHCP server must align with the configuration of the relay agents for the server to assign addresses correctly. For example, defining the server to allocate addresses based on a pool name, but not providing a pool name toward the server, might not provide the expected result, because this will not necessarily lead to addresses being assigned and offered to clients.

The DHCP relay agent is configured in the dhcp context, as follows:

  • gi-address – the gateway IPv4 address used by the relay agent

  • server – up to 8 DHCP servers can be defined by their IPv4 address; only 10.11.11.11 is used in this example

  • client-applications dhcp ppp – the DHCP server will allocate addresses for DHCP and PPP clients

  • option – the options added/removed to/from messages toward the server. In the example, the circuit-id, the remote-id, and the pool-name are added.

  • trusted – this parameter ensures that DHCP messages with option 82 included and the gi-address set to zero are being processed instead of being dropped

configure
    service
        vprn 1 customer 1 create
            subscriber-interface "int-SUB" create
                group-interface "int-GRP" create
                    dhcp
                        option
                            action replace
                            circuit-id
                            remote-id
                            vendor-specific-option
                                pool-name
                            exit
                        exit
                        server 10.11.11.1
                        lease-populate 100
                        client-applications dhcp ppp
                        gi-address 10.10.0.1
                        no shutdown
                    exit
                exit
            exit
        exit
    exit
exit

Configure DHCP Server Persistency

The following configuration stores the DHCP server lease-state persistency file on cf1:

configure
    system
        persistence
            dhcp-server
                location cf1:
            exit
        exit
    exit
exit

The persistency file is pre-allocated, providing space for the maximum number of allowed leases, which avoids file system space issues during normal operation, as follows:

*A:PE1>file cf1:\ # dir

Volume in drive cf1 on slot A has no label.

Volume in drive cf1 on slot A is formatted as FAT32

Directory of cf1:\

09/19/2016  04:29p      <DIR>          .ssh/
09/21/2016  01:58p           248513024 dhcp_serv.006
09/21/2016  01:58p             5825024 dhcp_serv.i06
               2 File(s)              254338048 bytes.
               1 Dir(s)              7759888384 bytes free.

*A:PE1>file cf1:\ #

A message is issued to log-id 99 to indicate that the persistence file is ready for use, as follows:

*A:PE1# show log log-id 99

===============================================================================
Event Log 99
===============================================================================
Description : Default System Log
Memory Log contents  [size=500   next event=10722  (wrapped)]
10721 2016/09/21 12:44:58.24 CEST WARNING: SYSTEM #2037 Base dhcp-server Persistence Report
"Persistency event: dhcp-server persistence file ready for use"

The tools dump persistence summary command provides persistency information. The following example shows that the file cf1:\dhcp_serv.006 is used for storing persistency records for the DHCP server:

*A:PE1# tools dump persistence summary
================================================================================
Persistence Summary on Slot A (active)
================================================================================
Client           Location               #Registrations   File State
                 Avg Nr Fragments       #Entries         Subsystem State
                 File Fill Level        #Entries Queued
--------------------------------------------------------------------------------
dhcp-server      cf1:\dhcp_serv.006     5                ACTIVE
                 1.0                    5                OK
                 0%                     0
--------------------------------------------------------------------------------
Total for cf1:    3% in use
--------------------------------------------------------------------------------
 
*A:PE1#

Persistency records are identified using the persistence key. This key is part of the lease state. The following command shows the persistence key for lease 10.11.0.14:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases 10.11.0.14 detail
 
===============================================================================
Lease for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP-address                   : 10.11.0.14
Lease-state                  : stable
Lease started                : 2016/10/17 15:28:36
 
---snip---
 
User-db Address Type         : N/A
Persistence Key              : 0x00000004
Lease Remaining Hold Time    : 0h0m0s
 
===============================================================================
*A:PE1#

The DHCP server lease state records can be shown using the following command. This example shows the record for key 0x00000004:

*A:PE1# tools dump persistence dhcp-server record 0x00000004
----------------------------------------
Persistence Record
----------------------------------------
Client      : dhcp-server
Persist-Key : 0x00000004
Filename    : cf1:\dhcp_serv.006
Entries     : Index  FedHandle  Last Update               Action Valid
              004289 0x00000079 2016/10/17 14:48:46 (UTC) UPDATE Yes
Data        : 151 bytes
 
 type       : V4 lease
 service Id : 1
 server     : dhcp4-VPRN1
 IP         : 10.11.0.14
 MAC        : 00:00:00:01:01:03
 XID        : 0x00000020
 state      : stable
 lease mode : ET
 start time : 2016/10/17 13:28:36 (UTC)
 last renew : 2016/10/17 14:48:46 (UTC)
 expires    : 2016/10/17 14:58:46 (UTC)
 failctrl   : local
 opt60 len  : 0
 opt61 len  : 0
 opt82 len  : 0
 sticky name:
*A:PE1#

DHCP server lease state persistency is typically used together with subscriber management persistency if the DHCP server and subscriber management functions are managed by the same network node; see the IPv4 DHCP Hosts chapter.

Configure a Sticky Lease

The following command creates a sticky lease with name me-010101, using MAC address 00:00:00:01:02:02 and IP address 10.11.0.20:

*A:PE1# tools perform router 1 dhcp local-dhcp-server "dhcp4-VPRN1" pool "pool-1" create-sticky-lease me-010202 mac 00:00:00:01:02:02 requested-ip-address 10.11.0.20
 
===============================================================================
Sticky lease creation result
===============================================================================
Result                  : Success
IP-address              : 10.11.0.20
Lease-state             : sticky
Lease started           : 2016/10/17 17:07:00
Remaining LifeTime      : N/A
Sticky-lease Host Name  : me-010202
MAC address             : 00:00:00:01:02:02
Persistence Key         : N/A
===============================================================================
*A:PE1#

No user database may be assigned to the DHCP server to create sticky leases.

A clear command can be used to delete a sticky lease, as follows:

clear router 1 dhcp local-dhcp-server "dhcp4-VPRN1" sticky-leases hostname "me-010202"

Operation and Verification

The following command shows all DHCP servers defined in the system. The maximum and active number of leases are shown. The router and services where the DHCP servers are hosted are listed, together with the server name and an indication whether this server is in- or out-of-service.

*A:PE1# show router dhcp servers all
 
==================================================================
Overview of DHCP Servers
==================================================================
Active Leases:      5
Maximum Leases:     159744
 
Router              Server                           Admin State
------------------------------------------------------------------
Service: 1          dhcp4-VPRN1                      inService
==================================================================
*A:PE1#

The following command shows all leases currently allocated by DHCP server dhcp4-VPRN1 in VPRN-1. In this example, the leases for the DHCP and PPP clients are all ‟stable”. Sticky leases are always shown, even when they are not online.

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases
 
===============================================================================
Leases for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP Address      Lease State       Mac Address       Remaining   Clnt  Fail
  PPP user name/Opt82 Circuit Id                    LifeTime    Type  Ctrl
  User-db/Sticky-lease Hostname
-------------------------------------------------------------------------------
10.10.0.11      stable            00:00:00:01:01:01 0h9m16s     dhcp  local
 
10.10.0.12      stable            00:00:00:01:01:02 0h7m36s     dhcp  local
 
10.11.0.14      stable            00:00:00:01:01:03 0h9m9s      dhcp  local
 
10.11.0.17      stable            00:00:00:00:00:33 0h59m55s    ppp   local
  PE1|1|int-GRP|1/1/1:1
10.11.0.20      sticky            00:00:00:01:02:02 N/A         dhcp  N/A
 
  me-010202
-------------------------------------------------------------------------------
5 leases found
===============================================================================
*A:PE1#

The following command shows the leases on the same server allocated from the 10.11.0.0/24 subnet:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases 10.11.0.0/24
 
===============================================================================
Leases for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP Address      Lease State       Mac Address       Remaining   Clnt  Fail
  PPP user name/Opt82 Circuit Id                    LifeTime    Type  Ctrl
  User-db/Sticky-lease Hostname
-------------------------------------------------------------------------------
10.11.0.14      stable            00:00:00:01:01:03 0h7m31s     dhcp  local
 
10.11.0.18      stable            00:00:00:00:00:33 0h59m40s    ppp   local
  PE1|1|int-GRP|1/1/1:1
10.11.0.20      sticky            00:00:00:01:02:02 N/A         dhcp  N/A
 
  me-010202
-------------------------------------------------------------------------------
3 leases found
===============================================================================
*A:PE1#

The following command shows the details of a single lease:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases 10.11.0.18/32 detail
 
===============================================================================
Lease for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP-address                   : 10.11.0.18
Lease-state                  : stable
Lease started                : 2016/10/17 17:15:57
Last renew                   : N/A
Remaining LifeTime           : 0h57m55s
Remaining Potential Exp. Time: 0h0m0s
Sticky-lease Host Name       : N/A
MAC address                  : 00:00:00:00:00:33
Xid                          : 0x8bf01670
Failover Control             : local
Client Type                  : ppp
User-db Host Name            : N/A
User-db Address Type         : N/A
Persistence Key              : 0x00000005
Opt82 Hex Dump               : (length=71)
                             : 52 45 01 15 50 45 31 7c 31 7c 69 6e 74 2d 47 52
                             : 50 7c 31 2f 31 2f 31 3a 31 02 06 00 00 00 00 00
                             : 33 09 24 00 00 19 7f 1f 02 06 00 00 00 00 00 33
                             : 06 01 01 01 03 50 45 31 03 04 00 00 00 01 04 07
                             : 31 2f 31 2f 31 3a 31
Opt82 Circuit Id             : PE1|1|int-GRP|1/1/1:1
Opt82 Remote Id              : (hex) 00 00 00 00 00 33
Opt82 VS System              : PE1
Opt82 VS Clnt MAC            : 00:00:00:00:00:33
Opt82 VS Service             : (hex) 00 00 00 01
Opt82 VS SAP                 : 1/1/1:1
Opt82 VS String              :
Opt82 VS PPPoE Session ID    :
Opt60 Hex Dump               : (length=10)
                             : 41 4c 55 37 58 58 58 53 42 4d
Lease Remaining Hold Time    : 0h0m0s
 
===============================================================================
*A:PE1#

Troubleshooting

The following command shows summary data for the DHCP server:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" summary
===============================================================================
DHCP server dhcp4-VPRN1  router 1
===============================================================================
Admin State            : inService
Operational State      : inService
Persistency State      : ok
User Data Base         : N/A
Use gateway IP address : enabled (scope pool)
Use pool from client   : enabled
Send force-renewals    : disabled
Creation Origin        : manual
Lease Hold Time        : 0h10m0s
Lease Hold Time For    : (Not specified)
User-ident             : mac-circuit-id
 
Failover Admin State   : outOfService
Failover Oper State    : shutdown
Failover Persist Key   : 0x00000003
Administrative MCLT    : 0h10m0s
Operational MCLT       : 0h10m0s
Startup wait time      : 0h2m0s
Partner down delay     : 23h59m59s
  Ignore MCLT          : disabled
 
-------------------------------------------------------------------------------
Pool name : pool-1
-------------------------------------------------------------------------------
Failover Admin State   : outOfService
Failover Oper State    : shutdown
Failover Persist Key   : 0x00000001
Administrative MCLT    : 0h10m0s
Operational MCLT       : 0h10m0s
Startup wait time      : 0h2m0s
Partner down delay     : 23h59m59s
  Ignore MCLT          : disabled
-------------------------------------------------------------------------------
Subnet                 Free     %    Stable   Declined Offered  Rem-pend Drain
-------------------------------------------------------------------------------
10.10.0.0/25           0        0%   2        0        0        0        N
10.11.0.0/24           241      98%  3        0        0        0        N
Totals for pool        241      97%  5        0        0        0
-------------------------------------------------------------------------------
 
-------------------------------------------------------------------------------
Pool name : pool-2
-------------------------------------------------------------------------------
Failover Admin State   : outOfService
Failover Oper State    : shutdown
Failover Persist Key   : 0x00000007
Administrative MCLT    : 0h10m0s
Operational MCLT       : 0h10m0s
Startup wait time      : 0h2m0s
Partner down delay     : 23h59m59s
  Ignore MCLT          : disabled
-------------------------------------------------------------------------------
Subnet                 Free     %    Stable   Declined Offered  Rem-pend Drain
-------------------------------------------------------------------------------
10.20.0.0/16           100      100% 0        0        0        0        N
Totals for pool        100      100% 0        0        0        0
-------------------------------------------------------------------------------
 
Totals for server      341      98%  5        0        0        0
 
-------------------------------------------------------------------------------
Interface associations
Interface                        Admin
-------------------------------------------------------------------------------
int-VPRN1-DHCPv4                 Up
 
-------------------------------------------------------------------------------
Local Address Assignment associations
Group interface                  Admin
-------------------------------------------------------------------------------
===============================================================================
*A:PE1#

The following command shows DHCP server statistics:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" server-stats
 
===============================================================================
Statistics for DHCP Server dhcp4-VPRN1 router 1
===============================================================================
Rx Discover Packets           : 2449
Rx Request Packets            : 12752
Rx Release Packets            : 53
Rx Decline Packets            : 0
Rx Inform Packets             : 0
 
Tx Offer Packets              : 177
Tx Ack Packets                : 1184
Tx Nak Packets                : 63
Tx Forcerenew Packets         : 58
 
Client Ignored Offers         : 0
Leases Timed Out              : 2
 
Dropped Bad Packet            : 11205
Dropped Invalid Type          : 0
Dropped No User Database      : 0
Dropped Unknown Host          : 0
Dropped User Not Allowed      : 0
Dropped Lease Not Ready       : 0
Dropped Lease Not Found       : 5
Dropped Not Serving Pool      : 2297
Dropped Invalid User          : 0
Dropped Overload              : 0
Dropped Persistence Overload  : 0
Dropped Generic Error         : 0
Dropped Destined To Other     : 0
Dropped Address Unavailable   : 300
Dropped Max Leases Reached    : 0
Dropped Server Shutdown       : 0
Dropped No Subnet For Fixed IP: 0
Dropped Duplicate From Diff GI: 0
Dropped busy primary audit    : 0
Dropped transmission failed   : 0
 
Rx Internal Requests          : 0
Rx Internal Releases          : 0
Dropped Internal w/LUDB       : 0
Dropped Internal w/Failover   : 0
Dropped Internal w/Conflicts  : 0
 
Failover statistics
-------------------------------------------------------------------------------
Dropped Invalid Packets       : 0
Failover Shutdown             : 0
Lease Already Expired         : 0
Maximum Lease Count Reached   : 0
Subnet Not Found              : 0
Range Not Found               : 0
Host Conflict                 : 0
Address Conflict              : 0
Peer conflict                 : 0
Persistence congestion        : 0
No Lease Hold Time Configured : 0
Invalid Prefix Length         : 0
Lease Not Found               : 0
===============================================================================
*A:PE1#

The following command shows extended server statistics:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" pool-ext-stats
 
===============================================================================
Extended pool statistics for server "dhcp4-VPRN1"
===============================================================================
                           Current         Peak            Peak Timestamp
-------------------------------------------------------------------------------
Pool                       pool-1
Local:
  Offered Leases           0               1               10/17/2016 17:15:57
  Stable Leases            5               5               10/17/2016 17:15:57
  Provisioned Addresses    246
  Used Addresses           5               5               10/17/2016 17:21:24
  Free Addresses           241             241             10/17/2016 17:21:24
  Used Pct                 3               3               10/17/2016 17:21:24
  Free Pct                 97              97              10/17/2016 17:21:24
Last Reset Time                                            10/17/2016 15:26:31
-------------------------------------------------------------------------------
Pool                       pool-2
Local:
  Offered Leases           0               0               10/17/2016 17:22:15
  Stable Leases            0               0               10/17/2016 17:22:15
  Provisioned Addresses    100
  Used Addresses           0               0               10/17/2016 17:22:15
  Free Addresses           100             100             10/17/2016 17:22:15
  Used Pct                 0               0               10/17/2016 17:22:15
  Free Pct                 100             100             10/17/2016 17:22:15
Last Reset Time                                            10/17/2016 17:22:15
-------------------------------------------------------------------------------
Number of entries          2
===============================================================================
*A:PE1#

The following command shows the addresses that are still free in a particular subnet:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" free-addresses 10.11.0.0/24
 
===============================================================================
Free addresses
===============================================================================
IP Address      Fail Ctrl
-------------------------------------------------------------------------------
10.11.0.11      local
10.11.0.12      local
10.11.0.13      local
10.11.0.15      local
10.11.0.16      local
---snip---
10.11.0.253     local
10.11.0.254     local
-------------------------------------------------------------------------------
No. of free addresses: 241
===============================================================================
*A:PE1#

The following command shows the DHCP server associations; this is the list of interfaces that the DHCP server is listening on:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" associations
===============================================================================
DHCP server dhcp4-VPRN1  router 1
===============================================================================
Interface associations
Interface                        Admin
-------------------------------------------------------------------------------
int-VPRN1-DHCPv4                 Up
 
-------------------------------------------------------------------------------
Local Address Assignment associations
Group interface                  Admin
-------------------------------------------------------------------------------
===============================================================================
*A:PE1#

The following configuration enables debugging for DHCP server dhcp4-VPRN1 on VPRN 1:

debug
    router "1"
        local-dhcp-server "dhcp4-VPRN1"
            detail-level high
            mode egr-ingr-and-dropped
        exit
    exit
exit

To ensure that the debug output is sent to a session, the following additional configuration is needed:

configure
    log 
        log-id 1
            description "Send debug log to the current telnet/ssh session"
            from debug-trace 
            to session
            no shutdown
        exit
    exit
exit

With this configuration, the following output is shown when the IPoE host with MAC address 00:00:00:01:01:01 connects:

13 2016/10/17 18:51:12.30 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Discover
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x21
 
   DHCP options:
   [82] Relay agent information: len = 23
      [1] Circuit-id: PE1|1|int-GRP|1/1/1:1
   [53] Message type: Discover
   [255] End
 
   Hex Packet Dump:
   01 01 06 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a
   ---snip---
   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
"
 
14 2016/10/17 18:51:12.30 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease added for 10.10.0.12 state=offer
"

15 2016/10/17 18:51:12.30 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Tx DHCP Offer to local relay agent 10.10.0.1 vrId=2
 
   ciaddr: 0.0.0.0           yiaddr: 10.10.0.12
   siaddr: 10.11.11.1        giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x21
 
   DHCP options:
   [82] Relay agent information: len = 23
      [1] Circuit-id: PE1|1|int-GRP|1/1/1:1
   [53] Message type: Offer
   [54] DHCP server addr: 10.11.11.1
   [51] Lease time: 600
   [1] Subnet mask: 255.255.255.0
   [3] Router: 10.10.0.1
   [130] Unknown option: len = 9, value = 4d 79 4f 70 74 69 6f 6e 31
   [6] Domain name server: length = 8
             1.1.1.1
             1.1.2.2
   [150] Unknown option: len = 4, value = 01 01 01 01
   [255] End
 
   Hex Packet Dump:
   02 01 06 00 00 00 00 21 00 00 00 00 00 00 00 00 0a 0a 00 0c 0a 0b 0b 01 0a
   ---snip---
   31 7c 31 7c 69 6e 74 2d 47 52 50 7c 31 2f 31 2f 31 3a 31 ff
"
 
 
16 2016/10/17 18:51:12.32 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Request
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x21
 
   DHCP options:
   [82] Relay agent information: len = 23
      [1] Circuit-id: PE1|1|int-GRP|1/1/1:1
   [53] Message type: Request
   [50] Requested IP addr: 10.10.0.12
   [54] DHCP server addr: 10.11.11.1
   [255] End
 
   Hex Packet Dump:
   01 01 06 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a
   ---snip---
   31 2f 31 3a 31 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
"
 
 
17 2016/10/17 18:51:12.32 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease update for 10.10.0.12 state=stable
"
 
 
18 2016/10/17 18:51:12.52 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Tx DHCP Ack to local relay agent 10.10.0.1 vrId=2
 
   ciaddr: 0.0.0.0           yiaddr: 10.10.0.12
   siaddr: 10.11.11.1        giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x21
 
   DHCP options:
   [82] Relay agent information: len = 23
      [1] Circuit-id: PE1|1|int-GRP|1/1/1:1
   [53] Message type: Ack
   [54] DHCP server addr: 10.11.11.1
   [51] Lease time: 600
   [1] Subnet mask: 255.255.255.0
   [3] Router: 10.10.0.1
   [130] Unknown option: len = 9, value = 4d 79 4f 70 74 69 6f 6e 31
   [6] Domain name server: length = 8
             1.1.1.1
             1.1.2.2
   [150] Unknown option: len = 4, value = 01 01 01 01
   [255] End
 
   Hex Packet Dump:
   02 01 06 00 00 00 00 21 00 00 00 00 00 00 00 00 0a 0a 00 0c 0a 0b 0b 01 0a
   ---snip---
   31 7c 31 7c 69 6e 74 2d 47 52 50 7c 31 2f 31 2f 31 3a 31 ff
"

When a client terminates its connection, the following output is shown:

19 2016/10/17 18:52:05.97 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Release
 
   ciaddr: 10.10.0.12        yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 0.0.0.0
   chaddr: 00:00:00:01:01:01    xid: 0x21
 
   DHCP options:
   [82] Relay agent information: len = 23
      [1] Circuit-id: PE1|1|int-GRP|1/1/1:1
   [53] Message type: Release
   [54] DHCP server addr: 10.11.11.1
   [255] End
 
   Hex Packet Dump:
   01 01 06 00 00 00 00 21 00 00 00 00 0a 0a 00 0c 00 00 00 00 00 00 00 00 00
   ---snip---
   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
"
 
 
20 2016/10/17 18:52:05.96 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease deleted for 10.10.0.12 (rxd release)
"

A PPP user connecting via local address assignment shows the following messages:

21 2016/10/17 18:52:15.97 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx internal Request
   primary pool  : pool-2
   ciaddr        : 0.0.0.0          
"
      
22 2016/10/17 18:52:15.97 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease added for 10.20.0.22 state=internal
"

When this user terminates the PPP session, the following messages are shown:

23 2016/10/17 18:52:26.41 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx internal Release
   ciaddr        : 10.20.0.22       
"
  
24 2016/10/17 18:52:26.41 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease deleted for 10.20.0.22 (rxd internal release)
" 

Renumbering – Subnet Mask Change

The baseline configuration has the subnet 10.10.0.0/25 defined, providing address space for up to 126 addresses. The range that the server can take free addresses from starts at 10.10.0.11, and ends at 10.10.0.126, excluding the 10.10.0.61 to 10.10.70 sub-range.

Assume that subnet 10.10.0.128/25 was removed from a different BNG, and now can be used in this BNG. This subnet can be aggregated with the 10.10.0.0/25 network to become subnet 10.10.0.0/24. At the same time, the requirement is to not disrupt services for already connected users.

The following steps are required at the DHCP server:

  • ensure that no force-renews is active

  • delete the original subnet

  • create the new subnet

Preventing the DHCP server from sending force-renew messages is important so that already connected users do not lose their connection, as follows:

*A:PE1# configure service vprn 1 dhcp local-dhcp-server dhcp4-VPRN1 no force-renews

The following command deletes the original subnet:

*A:PE1# configure service vprn 1 dhcp local-dhcp-server "dhcp4-VPRN1" 
                                         pool "pool-1" no subnet 10.10.0.0/25

Leases are not deleted when the subnet is deleted; their status changes from stable to removePending, as follows:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases
 
===============================================================================
Leases for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP Address      Lease State       Mac Address       Remaining   Clnt  Fail
  PPP user name/Opt82 Circuit Id                    LifeTime    Type  Ctrl
  User-db/Sticky-lease Hostname
-------------------------------------------------------------------------------
10.10.0.11      removePending     00:00:00:01:01:01 1h57m25s    dhcp  local
 
10.10.0.12      removePending     00:00:00:03:01:01 0h57m30s    ppp   local
  PE1|1|int-GRP|1/1/1:1
-------------------------------------------------------------------------------
2 leases found
===============================================================================
*A:PE1#

This status change is also shown in the debug log, as follows:

132 2016/10/14 14:10:57.66 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1
lease 10.10.0.11 scheduled for removal
"
 
133 2016/10/14 14:10:57.66 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1
lease 10.10.0.12 scheduled for removal
"
 
134 2016/10/14 14:10:57.66 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1
lease 10.10.0.11 scheduled for removal
"
 
135 2016/10/14 14:10:57.66 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1
lease 10.10.0.12 scheduled for removal
"

Users trying to renew or connect will not get an address as long as no new subnet is defined.

Create the new 10.10.0.0/24 subnet, with the new address range starting at 10.10.0.11 and ending at 10.10.0.254, as follows. The original exclusion range still applies, but a new exclusion address 10.10.0.129 is added, to be described later:

configure
    service
        vprn 1 customer 1 create
            dhcp
                local-dhcp-server dhcp4-VPRN1 create
                    use-gi-address scope pool
                    no force-renews
                    pool "pool-1" create
                        options
                            dns-server 1.1.1.1 1.1.2.2
                            lease-time hrs 2
                            custom-option 150 address 1.1.1.1
                        exit
                        subnet 10.10.0.0/24 create
                            options
                                subnet-mask 255.255.255.0
                                default-router 10.10.0.1
                            exit
                            exclude-addresses 10.10.0.61 10.10.0.70
                            exclude-addresses 10.10.0.129 10.10.0.129
                            address-range 10.10.0.11 10.10.0.254
                        exit
                    exit
                exit
            exit
        exit
    exit
exit

Leases that were in use before return to the stable state, if they are not in the exclusion range, as follows:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" leases
 
===============================================================================
Leases for DHCP server dhcp4-VPRN1 router 1
===============================================================================
IP Address      Lease State       Mac Address       Remaining   Clnt  Fail
  PPP user name/Opt82 Circuit Id                    LifeTime    Type  Ctrl
  User-db/Sticky-lease Hostname
-------------------------------------------------------------------------------
10.10.0.11      stable            00:00:00:01:01:01 1h49m43s    dhcp  local
 
10.10.0.12      stable            00:00:00:03:01:01 0h49m48s    ppp   local
  PE1|1|int-GRP|1/1/1:1
-------------------------------------------------------------------------------
2 leases found
===============================================================================
*A:PE1#

The following command adds the 10.10.0.129/25 address to the int-SUB subscriber interface, so that offers in the 10.10.0.128/25 range will not get dropped by the relay agent. Any address in the 10.10.0.128/25 subnet could be used; the lowest one is used in this example. Because this address is in use by the subscriber interface, it must be added to the exclusion list in the DHCP server, as follows:

*A:PE1# configure service vprn 1 subscriber-interface int-SUB address 10.10.0.129/25

This configuration ensures service continuity for already connected subscribers. They will get their new /24 subnet when they renew or rebind their lease. No change is needed at the relay agent.

Merging the two subnets at the subscriber interface is only possible with a service interruption, because the subscriber interface addresses cannot be deleted when leases are in use. Also the Gi address configured in the dhcp context must be deleted.

*A:PE1>config>service>vprn>sub-if# no address 10.10.0.1/25
INFO: PIP #1398 Cannot delete/change address when managed ARPs or leases defined for this subnet exist - 1 managed-arps or leases exist
*A:PE1>config>service>vprn>sub-if#

To also merge the subnets at the subscriber interface, all the leases in these subnets must be deleted. When the address defined at the subscriber interface is also used as the Gi address by the relay agent, the Gi address must be removed first. Then, the subscriber interface address can be deleted and recreated with the correct netmask. Also, the Gi address can be redefined after that. The changes at the DHCP server are similar to the ones defined previously.

Renumbering – Subnet Migration

The following changes to the baseline configuration have to be made to support the migration of DHCP clients from the 10.10.0.0/25 and 10.11.0.0/24 subnets to the 10.12.0.0/20 subnet. For that purpose, the 10.10.0.0/25 and the 10.11.0.0/24 subnets have the keyword drain added, so that leases in the corresponding address ranges will not be extended.

This new 10.12.0.0/20 subnet has a new subnet mask, a new default router, and three address ranges. New clients connecting will automatically get addresses from this new subnet. To ensure existing clients will not lose their connection, the use-gi-address scope is set to pool, so that they get a new lease from the new subnet when renewing or rebinding.

In scenarios where lease times are long (an order of magnitude of months or even years), it can take a considerable time before all clients have a lease in the new subnet. Having DHCP clients supporting force-renew can help speed up the migration process. The following configuration has force-renews enabled.

Address 10.12.0.1 is used as the default router for this subnet, so this address is added to the int-SUB subscriber-interface. This address will later be used as the Gi address.

configure
    service
        vprn 1
            dhcp
                local-dhcp-server "dhcp4-VPRN1" create
                    use-gi-address scope pool
                    force-renews
                    pool "pool-1" create
                        options
                            dns-server 1.1.1.1 1.1.2.2
                            lease-time hrs 2
                        exit
                        subnet 10.10.0.0/25 create
                            drain
                            options
                                subnet-mask 255.255.255.0
                                default-router 10.10.0.1
                            exit
                            address-range 10.10.0.11 10.10.0.12
                        exit
                        subnet 10.11.0.0/24 create
                            drain
                            options
                                subnet-mask 255.255.255.0
                                default-router 10.10.0.1
                            exit
                            address-range 10.11.0.11 10.11.0.254
                        exit
                        subnet 10.12.0.0/20 create
                            options
                                subnet-mask 255.255.240.0
                                default-router 10.12.0.1
                            exit
                            address-range 10.12.0.10 10.12.12.255
                            address-range 10.12.13.1 10.12.14.255
                            address-range 10.12.15.10 10.12.15.254
                        exit
                    exit
                    no shutdown
                exit
            exit
            subscriber-interface "int-SUB"
                address 10.12.0.1/20
            exit
        exit
    exit
exit 

The following command shows that the original subnets are in the drained state:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" summary
===============================================================================
DHCP server dhcp4-VPRN1  router 1
===============================================================================
Admin State            : inService
Operational State      : inService
Persistency State      : ok
 
---snip---
 
-------------------------------------------------------------------------------
Pool name : pool-1
-------------------------------------------------------------------------------
Failover Admin State   : outOfService
Failover Oper State    : shutdown
Failover Persist Key   : 0x00000001
Administrative MCLT    : 0h10m0s
Operational MCLT       : 0h10m0s
Startup wait time      : 0h2m0s
Partner down delay     : 23h59m59s
  Ignore MCLT          : disabled
-------------------------------------------------------------------------------
Subnet                 Free     %    Stable   Declined Offered  Rem-pend Drain
-------------------------------------------------------------------------------
10.10.0.0/25           2        100% 0        0        0        0        Y
10.11.0.0/24           244      100% 0        0        0        0        Y
10.12.0.0/20           4072     99%  3        0        0        0        N
Totals for pool        4318     99%  3        0        0        0
-------------------------------------------------------------------------------
 
Totals for server      4318     99%  3        0        0        0
 
---snip---
 
===============================================================================
*A:PE1#

Because the DHCP server is configured with force-renew, connected clients are sent a force-renew message. In response, the client tries to extend its lease by sending a request message using the current address. The DHCP server sends a negative-acknowledgement (NAK) to the requesting client, because the subnet is in the draining state. This forces the client to go through the DHCP initialization process; a new DORA message sequence is initiated. Therefore, the client gets a free address in the new subnet, with a new netmask, and a new default router, as follows. The same DNS servers are offered, because these pool options were not changed.

1 2016/10/15 19:19:36.04 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Tx DHCP ForceRenew to client at 10.10.0.12 vrId=2
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 10.11.11.1        giaddr: 0.0.0.0
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: ForceRenew
   [54] DHCP server addr: 10.11.11.1
   [255] End
"
   
2 2016/10/15 19:19:36.05 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Request
 
   ciaddr: 10.10.0.12        yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 0.0.0.0
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Request
   [255] End
"
   
3 2016/10/15 19:19:36.05 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
subnet is draining
Tx DHCP Nak to client 10.10.0.12 vrId=2 (via snooping function)
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 0.0.0.0
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Nak
   [54] DHCP server addr: 10.11.11.1
   [255] End
"
  
4 2016/10/15 19:19:36.06 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Discover
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Discover
   [255] End
"
  
5 2016/10/15 19:19:36.06 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease added for 10.12.0.17 state=offer
"
  
6 2016/10/15 19:19:36.06 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Tx DHCP Offer to local relay agent 10.10.0.1 vrId=2
 
   ciaddr: 0.0.0.0           yiaddr: 10.12.0.17
   siaddr: 10.11.11.1        giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Offer
   [54] DHCP server addr: 10.11.11.1
   [51] Lease time: 7200
   [1] Subnet mask: 255.255.240.0
   [3] Router: 10.12.0.1
   [6] Domain name server: length = 8
             1.1.1.1
             1.1.2.2
   [150] Unknown option: len = 4, value = 01 01 01 01
   [255] End
"
  
7 2016/10/15 19:19:36.07 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Rx DHCP Request
 
   ciaddr: 0.0.0.0           yiaddr: 0.0.0.0
   siaddr: 0.0.0.0           giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Request
   [50] Requested IP addr: 10.12.0.17
   [54] DHCP server addr: 10.11.11.1
   [255] End
"
  
8 2016/10/15 19:19:36.07 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
lease update for 10.12.0.17 state=stable
"
  
9 2016/10/15 19:19:36.24 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1 
Tx DHCP Ack to local relay agent 10.10.0.1 vrId=2
 
   ciaddr: 0.0.0.0           yiaddr: 10.12.0.17
   siaddr: 10.11.11.1        giaddr: 10.10.0.1
   chaddr: 00:00:00:01:01:01    xid: 0x1f
 
   DHCP options:
   [53] Message type: Ack
   [54] DHCP server addr: 10.11.11.1
   [51] Lease time: 7200
   [1] Subnet mask: 255.255.240.0
   [3] Router: 10.12.0.1
   [6] Domain name server: length = 8
             1.1.1.1
             1.1.2.2
   [150] Unknown option: len = 4, value = 01 01 01 01
   [255] End
"

When the original DHCP server subnets are fully drained, they can be safely deleted. However, deleting a subnet from a pool before it is fully drained results in the remaining leases being scheduled for removal, as follows:

140 2016/10/10 15:12:42.87 CEST MINOR: DEBUG #2001 vprn1 DHCP server
"DHCP server:  dhcp4-VPRN1
lease 10.11.0.11 scheduled for removal
"

The number of leases pending for removal can be shown using following command:

*A:PE1# show router 1 dhcp local-dhcp-server "dhcp4-VPRN1" summary
===============================================================================
DHCP server dhcp4-VPRN1  router 1
===============================================================================
Admin State            : inService
Operational State      : inService
 
---snip---
 
-------------------------------------------------------------------------------
Pool name : pool-1
-------------------------------------------------------------------------------
Failover Admin State   : outOfService
Failover Oper State    : shutdown
Failover Persist Key   : 0x00000001
Administrative MCLT    : 0h10m0s
Operational MCLT       : 0h10m0s
Startup wait time      : 0h2m0s
Partner down delay     : 23h59m59s
  Ignore MCLT          : disabled
-------------------------------------------------------------------------------
Subnet                 Free     %    Stable   Declined Offered  Rem-pend Drain
-------------------------------------------------------------------------------
10.11.0.0/24           244      100% 0        0        0        0        Y
10.12.0.0/20           4075     100% 0        0        0        0        N
Totals for pool        4319     100% 0        0        0        0
-------------------------------------------------------------------------------
Not subnet related                                              Rem-pend
-------------------------------------------------------------------------------
                                                                1
-------------------------------------------------------------------------------
 
Totals for server      4319     100% 0        0        0        1
 
---snip---
 
===============================================================================
*A:PE1#

This lease will be deleted when the lease expires.

The relay agent can then have the Gi address updated (10.12.0.1) and the old subnets can be removed from the group interface.

Conclusion

SR OS supports DHCPv4 servers on any routing instance (VPRN or base router), offering pool, subnet, and address management, combined with configuration parameter management and persistency.