How to DHCP relay on DGS-1510 with multiple VLANs 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:
This example will use the following devices and setup:
Devices:
DGS-1510
DHCP server
Firmware Used:
FW: 1.30.007
Note: Please always check our website for updates for firmware
Topology Example:
VLAN 1 network: 192.168.1.0/24
VLAN 10 network: 192.168.10.0/24
VLAN 20 network: 192.168.20.0/24
DHCP server: 192.168.1.100
Step 1.
We create VLANs and assign IP to each VLANs switch interface. In this example we assign switch 192.168.10.90 on VLAN 10, 192.168.20.90 on VLAN 20.
Switch#conf t
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.90 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#ip address 192.168.20.90 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)#
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:
- How to Configure SSH Connection DGS-1510-Series - CLI Read Answer
- How to Configure Link Aggregation LACP - DGS-1510-28 Series? Read Answer
- How to Setup VLANS - Scenario Configuration DGS-1510-Series Read Answer
- How to Upgrade Firmware DGS-1510-Series - CLI Read Answer