DHCP Relay with VLANs on DXS-3600 Series via CLI
Theory:
DHCP relay is used when DHCP server is not on same subnet as client. When relayed DHCP packet is added giaddr field as defined in RFC2131 which has relay agent IP address used by DHCP server to choose right pool.
Network Configuration:
In this example we will setup two VLANs, one for internal users and one for guests with following settings.
VLAN 1: Network: 192.168.1.0/24
VLAN 10: Network: 192.168.10.0/24
VLAN 20: Network: 192.168.20.0/24
SERVER IP: 192.168.1.123
SERVER is in VLAN 1DXS
PC1: Connected to VLAN 10
PC2: Connected to VLAN 20
Devices:
DXS-3600-32S/SI
Firmware Used:
2.40.046
Note: Please always check our website for updates for firmware
Topology Example:
![](/in/en/-/media/faqs/uk/dxs/howto_dhcp_relay_on-dxs-3600_image_1.png)
Step 1 – Login via SSH, telnet or console and enter Privileged EXEC Mode
DXS-3600-32S TenGigabit Ethernet Switch
Command Line Interface
Firmware: Build 2.40.046
Copyright(C) 2015 D-Link Corporation. All rights reserved.
Switch>enable
Switch#
Switch#configure terminal
Create VLANs and assign switch IP interface on each VLAN. In this example we create two VLANs, VLAN 10 for corporate users and VLAN 20 for guest users. Change this settings to suite your VLANs and IPs.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#exit
Step 2.
We assign port member of VLANs. In this example port 7 is in VLAN 10, port 8 is in VLAN 20 and DHCP server is on port 24 member of VLAN 1.
Switch(config)#interface ethernet 1/0/7
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface ethernet 1/0/8
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#interface ethernet 1/0/24
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 1
Switch(config-if)#exit
Step 3.
We enable DHCP relay and define pools and DHCP relay source and destination. Where source is switches VLAN IP and destination DHCP server IP. Finally we save configuration.
Switch(config)#service dhcp
Switch(config)#ip dhcp relay information option
Switch(config)#ip dhcp pool corporate
Switch(config-dhcp-pool)#relay source 192.168.10.90 255.255.255.0
Switch(config-dhcp-pool)#relay destination 192.168.1.100
Switch(config-dhcp-pool)#exit
Switch(config)#ip dhcp pool guest
Switch(config-dhcp-pool)#relay source 192.168.20.90 255.255.255.0
Switch(config-dhcp-pool)#relay destination 192.168.1.100
Switch(config-dhcp-pool)#end
Switch#copy run start
Destination filename startup-config? [y/n]: y
Saving all configurations to NV-RAM.......... Done.
Step 4.
Finally we check that clients are getting correct IP.
![](/in/en/-/media/faqs/uk/dxs/howto_dhcp_relay_on-dxs-3600_image_2.PNG)
DHCP relay is used when DHCP server is not on same subnet as client. When relayed DHCP packet is added giaddr field as defined in RFC2131 which has relay agent IP address used by DHCP server to choose right pool.
Network Configuration:
In this example we will setup two VLANs, one for internal users and one for guests with following settings.
VLAN 1: Network: 192.168.1.0/24
VLAN 10: Network: 192.168.10.0/24
VLAN 20: Network: 192.168.20.0/24
SERVER IP: 192.168.1.123
SERVER is in VLAN 1DXS
PC1: Connected to VLAN 10
PC2: Connected to VLAN 20
Devices:
DXS-3600-32S/SI
Firmware Used:
2.40.046
Note: Please always check our website for updates for firmware
Topology Example:
![](/in/en/-/media/faqs/uk/dxs/howto_dhcp_relay_on-dxs-3600_image_1.png)
Step 1 – Login via SSH, telnet or console and enter Privileged EXEC Mode
DXS-3600-32S TenGigabit Ethernet Switch
Command Line Interface
Firmware: Build 2.40.046
Copyright(C) 2015 D-Link Corporation. All rights reserved.
Switch>enable
Switch#
Switch#configure terminal
Create VLANs and assign switch IP interface on each VLAN. In this example we create two VLANs, VLAN 10 for corporate users and VLAN 20 for guest users. Change this settings to suite your VLANs and IPs.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#exit
Step 2.
We assign port member of VLANs. In this example port 7 is in VLAN 10, port 8 is in VLAN 20 and DHCP server is on port 24 member of VLAN 1.
Switch(config)#interface ethernet 1/0/7
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface ethernet 1/0/8
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#interface ethernet 1/0/24
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 1
Switch(config-if)#exit
Step 3.
We enable DHCP relay and define pools and DHCP relay source and destination. Where source is switches VLAN IP and destination DHCP server IP. Finally we save configuration.
Switch(config)#service dhcp
Switch(config)#ip dhcp relay information option
Switch(config)#ip dhcp pool corporate
Switch(config-dhcp-pool)#relay source 192.168.10.90 255.255.255.0
Switch(config-dhcp-pool)#relay destination 192.168.1.100
Switch(config-dhcp-pool)#exit
Switch(config)#ip dhcp pool guest
Switch(config-dhcp-pool)#relay source 192.168.20.90 255.255.255.0
Switch(config-dhcp-pool)#relay destination 192.168.1.100
Switch(config-dhcp-pool)#end
Switch#copy run start
Destination filename startup-config? [y/n]: y
Saving all configurations to NV-RAM.......... Done.
Step 4.
Finally we check that clients are getting correct IP.
These may also help:
- $name Read Answer
- How to Change the Time and Date Zone Via CLI - DXS-3600-Series Read Answer