Description:

This article describes how any network member is assigned a specific IP address on a specific port of a GS-23xx switch by operating the latter as a DHCP relay agent and a LANCOM router as a DHCP relay server. The port information is transmitted from the switch to the LANCOM router by circuit ID.


Reqirements:


Scenario:

  • On the LANCOM router, a DHCP relay server is created for the network 192.168.10.0/24. However, the network itself does not exist on the router.
  • The GS-23xx switch operates as a DHCP relay agent and forwards DHCP requests to the DHCP relay server on the LANCOM router.
  • For the GS-23xx switch, any network device connected to port 9 should receive the IP address 192.168.10.75.


Procedure:

1) Configuring the GS-23xx switch:

1.1) Connect to the web GUI of the switch and navigate to the menu Security → DHCP Relay → Configuration and modify the following parameters:

  • Relay Mode: From the drop-down menu, select the option Enabled.
  • Relay Server: Enter the IP address of the DHCP relay server (in this example 192.168.1.254).
  • Relay Information Mode: From the drop-down menu, select the option Enabled. This is required for transmission of the circuit ID.
  • Relay Information Policy: From the drop-down menu, select the option Keep. If the switch receives a DHCP packet that already contains DHCP relay information, this will be retained.

1.2) Click Add, modify the following parameters and then click Apply:

  • VLAN ID: Enter the VLAN ID of the network for which the DHCP relay server assigns IP addresses.
  • Gateway IP address: Enter the IP address of the gateway in the network for which the DHCP relay server assigns IP addresses.

1.3 Navigate to the menu Maintenance → Save/Restore → Save Start and click on Save so that the configuration is saved as a Start configuration.

The start configuration is retained even if the device is restarted or there is a power failure.



2) Configuring the LANCOM router:

2.1) Use LANconfig to connect to the router and navigate to the menu IPv4 → DHCPv4 → DHCP networks.

2.2) Create a new DHCP network and modify the following parameters:

  • Network name: Enter the relay agent IP address for the desired network. Here, the final octet must contain a * (in this example 192.168.10.*). 
  • DHCP server enabled: From the drop-down menu, select the option Yes.
  • First address: Enter the first IP address of the IP address pool (in this example 192.168.10.50).
  • Last address: Enter the last IP address of the IP address pool (in this example 192.168.10.100).
  • Netmask: Enter the subnet mask for the related network (in this example 255.255.255.0).
  • Broadcast: Optionally enter the broadcast address of the network (in this example 192.168.10.255).
  • Default gateway: Enter the IP address of the DHCP relay server (in this example 192.168.10.254).

When setting up a DHCP relay server, it is essential that you specify the IP address pool (first address and last address) and also the netmask.

2.3) Confirm the dialog with Yes. This is necessary because the network is not created in the router in the menu IP networks.

Important note if the DHCP server on the router is operated for additional local networks:

If the router is already being used as a DHCP server for local networks, the DHCP address assignment for these networks no longer works if the DHCP requests are sent to the router via the switch. This is due to the included DHCP relay information, which the regular DHCP server cannot process.

In this case, a DHCP network must be created with the relay agent IP address for the local network (in this example 192.168.1.*). The entry for the local network (in this case INTRANET) must be disabled by setting the parameter DHCP server enabled to No. Note that following this, DHCP requests should only be sent to the router via the switch.

2.4) Go to the menu IPv4 → BootP → Relay info.

2.5) Create a new entry and adjust the following parameters:

  • Circuit ID: Enter the circuit ID that is transmitted from the switch to the router (in this example 0x0104000a0009).
  • IP address: Enter the IP address that is to be assigned to the network member at the desired switch port.
  • Station name: Optionally enter a station name.

Structure of the circuit ID:

The circuit ID consists of five fields, where the fifth field (Relay Custom Info) is optional and not used in this scenario. 

Note that the circuit ID in the switch is encoded in binary, but is expected by the router in hexadecimal notation. This can be seen in an Ethernet trace (filtered for BootP). For this reason the circuit ID must be prefixed with the string 0x. Furthermore, the VID and the port number must be converted if necessary. 

  1. Circuit ID type: The 1 stands for circuit ID. The field has two digits, so the entry has to be 01.
  2. Length: Unless relay custom info is transmitted, the length is always 4 bytes (i.e. 2 bytes each for the VLAN ID and the port). The field has two digits, so the entry has to be 04.
  3. VID: Enter the VLAN ID of the switch port. The field has four digits, so the entry could be 0010 for example.
  4. Port number: Enter the port number of the switch port. The field has four digits, so the entry could be 0009 for example.
  5. Relay custom info: Additional information can optionally be entered into this field. 

Example:

A network member in VLAN 10 and connected to port 9 should be given a specific IP address. The VID 10 is a in hexadecimal notation. The resulting circuit ID appears as follows:

Hexadecimal notationCircuit ID typeLengthVIDport number
0x0104000a0009

2.6) This concludes the configuration steps on the router. Write the configuration back to the router.