Command Line Reference
IP Service
DHCP Relay Configuration
15 min
show dhcp relay config show dhcp relay config \[command] show dhcp relay config \[purpose] display dhcp relay related configuration \[view] system view \[use cases] sonic# show dhcp relay config + + + + + + \| name | down link | up link | loopback | server | +===========+===========+===================+===========+=====================+ \| test1(v4) |vlan800 | ethernet49 | loopback0 | 150 1 0 1,151 1 0 1 | + + + + + + \| test2(v6) |vlan800 | ethernet49 | loopback0 | 4005 1 | + + + + + + dhcp relay {v4|v6} dhcp relay {v4|v6} \[command] dhcp relay name {v4|v6} no dhcp relay name {v4|v6} \[purpose] configuring dhcp relay instance \[parameter] parameter description name dhcp relay name \[view] system configuration view \[usage scenario] when users and dhcp servers are in different broadcast domains (different subnets), the device can act as a dhcp relay agent to encapsulate the user's dhcp request broadcast message into a unicast message and send it to the dhcp server \[notes] the device supports the configuration of multiple dhcp instances as dhcp relay for the scenario that different terminals use different dhcp server \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# down link interface vlan down link interface vlan \[command] down link interface vlan vlan id no down link interface vlan vlan id \[purpose] specify the interface id of the connected terminal in the relay instance \[parameter] parameter description vlan id vlan id of the physical port to which the terminal is connected \[view] dhcp relay view \[usage scenario] to allow users who need to obtain ip addresses dynamically, specify the vlan where these users are located as the downstream interface of the relay instance all users within this vlan can then obtain ip addresses from the dhcp server configured within this instance \[notes] multiple vlan interfaces are supported to be configured under the same instance modify down link interface related content, such as svi port corresponding vlan add member interface, modify the interface ip address, mac address, etc , need to reconfigure relay instance \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# down link interface vlan 10 up link interface up link interface \[command] up link interface { interface type } { interface name } no up link interface { interface type } { interface name } \[purpose] specify the interface id of the relay instance to which the dhcp server is connected \[parameter] parameter description interface type supported configurations\ ethernet, link aggregation, vlan interface name supported configurations ethernet num, lag id, vlan id \[view] dhcp relay view \[usage scenario] in a dhcp relay environment, to ensure that only legitimate dhcp response packets from a specified interface are accepted, you can use this command to specify the interface this prevents illegal servers from providing unauthorized ip addresses to users, thereby maintaining network security \[notes] multiple interfaces are supported to be configured under the same instance \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# up link interface ethernet 1 server ip server ip \[command] server ip { a b c d | a\ b c\ d e\ f g \ h } no server ip { a b c d | a\ b c\ d e\ f g \ h } \[purpose] specify the dhcp server ip address of the relay instance \[parameter] parameter description a b c d ipv4 address a\ b c\ d e\ f g \ h ipv6 address \[view] dhcp relay view \[notes] up to two dhcp serve configurations are supported under the same instance the dhcp server under different instances can be different the relay will send dhcp request packets to all dhcp servers and forward all received response packets to the client the client will then choose from these responses \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# server ip 150 1 0 1 loopback interface loopback loopback interface loopback \[command] loopback interface loopback loopback id no loopback interface loopback loopback id \[purpose] to configure the dhcp relay packet's relay agent address as the ip address of a loopback interface \[view] dhcp relay view \[usage scenario] in scenarios where users utilize a distributed gateway, if the dhcp relay still uses the user gateway's ip address as the relay agent ip address, the dhcp server will be unable to communicate with the relay through that ip address, resulting in unreachable response packets users can use this command to specify the relay agent ip address as the ip address of a loopback interface that uniquely identifies a device this allows the dhcp server to forward response packets to the requesting dhcp relay \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# loopback interface loopback 0 dhcp agent address dhcp agent address \[command] dhcp agent address a b c d \[purpose] specify the dhcp server ip address of the relay instance \[view] interface vlan view \[usage scenario] by default, dhcp relays insert the option82 field into dhcp request packets, populating the dhcp relay interface's ip address with the "link selection" field within option82 dhcp servers use this field to select an ip address pool for allocation however, some dhcp servers do not support parsing the "link selection" field in such cases, you need to configure this command to specify the relay agent ip so that the server can select an ip address pool based on this field \[notes] when used in a distributed gateway scenario, different relay devices should be configured with different ip addresses to ensure that the dhcp server can forward response packets to the originating dhcp relay \[use cases] sonic# configure terminal sonic(config)# interface vlan 100 sonic(config vlanif 100)# dhcp agent address 192 168 1 10 no option82 no option82 \[command] no option82 no no option82 \[purpose] enable no option82 mode \[view] dhcp relay view \[notes] after configuring this command, dhcp relay will no longer include the option82 field in forwarded dhcp packets this command should be used in conjunction with the dhcp agent address command \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test v4)# no option82 dhcp option82 encapsulation remote id dhcp option82 encapsulation remote id \[command] dhcp option82 encapsulation remote id value \[purpose] configuring the addition of the “remote id” sub option in option82 \[view] interface vlan view \[usage scenario] to configure the addition of the "remote id" sub option in option 82, you may need to specify the relevant settings based on your networking equipment or dhcp server software in general, option 82 is often associated with dhcp and is used to carry additional information about the client \[use cases] sonic(config)# interface vlan 100 sonic(config vlanif 100)# dhcp option encapsulation remote id clientuser source ip source ip \[command] source ip a b c d no source ip \[purpose] specify the source ip for dhcp message interactions \[view] dhcp relay view \[usage scenario] this command allows you to specify the ethernet layer source ip address for dhcp relay messages \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test1 v4)# source ip 30 102 0 216
