How to Reserve an IP Address Within DHCP on Junos

How to Reserve an IP Address Within DHCP on Junos

April 23, 2025 Configuration Juniper Networking 0

When managing a network, it is often necessary to assign specific IP addresses to certain devices to ensure consistency, such as when dealing with servers, printers, or other devices that need a fixed address. Junos, the operating system used on Juniper Networks devices, provides a simple way to reserve IP addresses within the DHCP (Dynamic Host Configuration Protocol) service by creating static mappings.


Prerequisites

Before reserving an IP address, you must have:

  1. Access to a Junos device (e.g., router or switch) via SSH or console connection.
  2. The MAC address of the device you wish to reserve an IP address for.
  3. Knowledge of the DHCP pool configuration that you are using for address allocation.

Steps to Reserve an IP Address in DHCP on Junos

1. Obtain the MAC Address

The first step is to determine the MAC address of the device that you want to assign a reserved IP address to. You can typically find the MAC address through the device settings or by running network discovery tools.

2. Login to the Junos Device

Access your Junos device by logging in through SSH or a direct console connection.

3. Enter Configuration Mode

To make changes to the device configuration, enter configuration mode by typing the following command:

configure

This will allow you to make changes to the system settings.

4. Navigate to the DHCP Configuration

Next, you will need to access the DHCP service configuration. This is typically located under the system services section. You can edit the DHCP settings using the following command:

set system services dhcp

5. Create a Static Mapping

To reserve an IP address, you’ll create a static mapping for a specific MAC address. The command structure for adding a static mapping is as follows:

set system services dhcp pool <pool-name> static-mapping <mac-address> fixed-address <ip-address>
  • <pool-name>: The name of the DHCP pool you are using.
  • <mac-address>: The MAC address of the device you want to reserve the IP address for.
  • <ip-address>: The IP address you want to reserve.

For example, if you want to assign the IP address 192.168.1.100 to a device with the MAC address AA:BB:CC:DD:EE:FF in a pool named 192.168.1.0/24, the command would be:

set system services dhcp pool 192.168.1.0/24 static-mapping AA:BB:CC:DD:EE:FF fixed-address 192.168.1.100

This command ensures that every time the device with the specified MAC address connects to the network, it will be assigned the same IP address, 192.168.1.100, within the DHCP pool.

6. Commit the Configuration

Once you’ve added the static mapping, commit the configuration changes to activate them. To commit the changes, use the following command:

commit

This will apply the new DHCP configuration and start assigning the reserved IP address to the device.

Example Configuration

Here is an example of a complete configuration to reserve an IP address for a device with a specific MAC address:

set system services dhcp pool 192.168.1.0/24 static-mapping AA:BB:CC:DD:EE:FF fixed-address 192.168.1.100

Conclusion

By using static mappings in the DHCP configuration, you can ensure that certain devices always receive the same IP address, providing stability for critical network devices. This method is particularly useful in situations where you need to guarantee that devices like printers, servers, or access points receive a specific address within the DHCP-managed subnet.

This method is effective, easy to implement, and provides control over IP address allocation, reducing the possibility of address conflicts in your network.