Example for Configuring DHCP Relay over GRE Tunnel
Networking Requirements
Figure 1. DHCP Relay over GRE Tunnel Configuration Example
As shown in Figure 1, the DHCP server and DHCP clients are deployed in different areas, and are belonged to different network segments. DHCP server accesses the network through Switch A, DHCP clients access the network through Switch B. In this scenario, DHCP relay needs to be configured on Switch B.
To enable communication between DHCP server and DHCP clients through the public network, a Generic Routing Encapsulation (GRE) tunnel needs to be deployed between Switch A and Switch B.
Procedure
Switch A
Step1 Configure VLAN interface.
admin@SwitchA# set vlans vlan-id 10 l3-interface vlan10 admin@SwitchA# set vlans vlan-id 20 l3-interface vlan20 admin@SwitchA# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 20 admin@SwitchA# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 10 admin@SwitchA# set l3-interface vlan-interface vlan10 address 192.168.5.2 prefix-length 24 admin@SwitchA# set l3-interface vlan-interface vlan20 address 100.168.3.1 prefix-length 24
Step2 Enable IP routing.
admin@SwitchA# set ip routing enable true
Step3 Configure GRE tunnel name, IP, source IP, destination IP etc.
admin@SwitchA# set l3-interface tunnel tnl0 address 100.168.4.1 prefix-length 24 admin@SwitchA# set l3-interface tunnel tnl0 tunnel-mode gre-ip admin@SwitchA# set l3-interface tunnel tnl0 source 100.168.3.1 admin@SwitchA# set l3-interface tunnel tnl0 destination 100.168.10.2
Step4 Create static routes for the GRE tunnel.
admin@SwitchA# set protocols static route 192.168.6.0/24 next-hop 100.168.4.2 admin@SwitchA# set protocols static route 100.168.10.0/24 next-hop 100.168.3.2
Or we can create the static route using the tunnel name as the next hop.
admin@SwitchA# set protocols static interface-route 192.168.6.0/24 interface tnl0
Step5 Commit the configuration.
admin@SwitchA# commit
Switch B
Step1 Configure VLAN interface.
admin@SwitchB# set vlans vlan-id 10 l3-interface vlan10 admin@SwitchB# set vlans vlan-id 20 l3-interface vlan20 admin@SwitchB# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 20 admin@SwitchB# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 10 admin@SwitchB# set l3-interface vlan-interface vlan10 address 192.168.6.2 prefix-length 24 admin@SwitchB# set l3-interface vlan-interface vlan20 address 100.168.10.1 prefix-length 24
Step2 Enable IP routing.
admin@SwitchB# set ip routing enable true
Step3 Configure GRE tunnel name, IP, source IP and destination IP.
admin@SwitchB# set l3-interface tunnel tnl0 address 100.168.4.2 prefix-length 24 admin@SwitchB# set l3-interface tunnel tnl0 tunnel-mode gre-ip admin@SwitchB# set l3-interface tunnel tnl0 source 100.168.10.2 admin@SwitchB# set l3-interface tunnel tnl0 destination 100.168.3.1
Step4 Create static routes for the GRE tunnel.
admin@SwitchB# set protocols static route 192.168.3.0/24 next-hop 100.168.10.3 admin@SwitchB# set protocols static route 192.168.5.0/24 next-hop 100.168.4.1
Or we can create the static route using the tunnel name as the next hop.
admin@SwitchB# set protocols static interface-route 192.168.5.0/24 interface tnl0
Step5 Enable the DHCP relay function on VLAN interface vlan10 and specifies the DHCP server address for the relay.
admin@SwitchB# set protocols dhcp relay interface vlan10 disable false admin@SwitchB# set protocols dhcp relay interface vlan10 dhcp-server-address 192.168.5.1
Step6 Commit the configuration.
admin@SwitchB# commit
Verifying the Configuration
- After the configuration is complete, run the show protocols dhcprelay command to view the configuration of DHCP relay.
admin@SwitchB# show protocols dhcp relay interface vlan10 { disable: false dhcp-server-address 192.168.5.1 }
- Run command run show l3-interface tunnel to display information about the GRE tunnel interface.
admin@SwitchB# run show l3-interface tunnel tnl0 tnl0 State:UP Tunnel Source: 100.168.3.1 Tunnel Destnation:: 100.168.10.2 Tunnel protocol/transport: gre-ip Inet addr: 100.168.4.1 Traffic statistics: 5 sec input rate IPv4 1400 packets/sec, IPv6 0 packets/sec 5 sec forwarding rate IPv4 28 packets/sec, IPv6 0 packets/sec IPv4 Input Packets............................28 IPv4 Forwarding Packets.......................5 IPv6 Input Packets............................0 IPv6 Forwarding Packets.......................0
- DHCP clients can obtain the IP address normally.
Copyright © 2024 Pica8 Inc. All Rights Reserved.