Command Line Reference
Layer 3 Configuration
DHCP
56 min
dhcp relay dhcp relay dhcp relay view dhcp relay view table 1 dhcp relay view table 1 dhcp relay view command purpose show dhcp relay display dhcp relay configuration show dhcp relay show dhcp relay \[command] show dhcp relay \[purpose] display dhcp relay configuration \[view] privileged user view \[use cases] sonic# show dhcp relay + + + + + + + \| name | down link | up link | loopback | server | vrf | +==============================+=============+===========+============+==========+========+ \| test v4(v4) | na | na | na | na | na | + + + + + + + \| test dhcp over vxlan v4(v4) | vlan20 | 0/2 | na | 21 0 0 2 | vrf 123| + + + + + + + \| test dhcp over vxlan v6(v6) | vlan20 | 0/2 | na | 2123 2 | vrf 123| + + + + + + + dhcp relay config dhcp relay config table 2 dhcp relay config table 2 dhcp relay config command purpose feature dhcp state enable enable feature dhcp dhcp relay name { v4 | v6 } \[ vrf vrf name ] create an ipv4 or ipv6 dhcp relay instance downlink vlan vlan id \[ giaddr a b c d | option82 sub5 a b c d ] specify the vlan for dhcp relay (on dhcp client side) giaddr loopback loopback id specify the gateway ip address server dhcp server ip set dhcp server ip uplink {ethernet|link aggregation|vlan} interface name specify the uplink port (on dhcp server side) of dhcp relay feature dhcp state enable feature dhcp state enable \[command] feature dhcp state enable \[purpose] enable feature dhcp \[view] global configuration view \[notes] run command feature dhcp state disable to disable dhcp feature \[use cases] sonic# configure terminal sonic(config)# feature dhcp state enable dhcp relay dhcp relay name {v4|v6} \[vrf vrf name ] \[command] dhcp relay name { v4 | v6 } \[ vrf vrf name ] \[purpose] create an ipv4 or ipv6 dhcp relay instance \[parameters] parameter description name name of dhcp relay instance vrf name vrf name, specifying the vrf where the dhcp relay instance is located \[view] global configuration view \[notes] please run feature dhcp state enable to enable dhcp before you configure dhcp relay \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 downlink vlan downlink vlan vlan id \[giaddr a b c d | option82 sub5 a b c d ] \[command] downlink vlan vlan id \[ giaddr a b c d | option82 sub5 a b c d ] \[purpose] specify the vlan for dhcpv4 relay (on dhcp client side) \[parameters] parameter description vlan id vlan id, the range is \[1,4094] giaddr relay agent address, only supported by dhcpv4 relay instance option82 sub5 set option82, only supported by dhcpv4 relay instance \[view] dhcp relay instance configuration view \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v4 sonic(config dhcp relay test)# downlink vlan 10 giaddr 10 0 0 1 downlink vlan downlink vlan vlan id \[option client linklayer addr] \[command] downlink vlan vlan id \[ option option client linklayer addr ] \[purpose] specify the vlan for dhcpv6 relay (on dhcp client side) \[parameters] parameter description vlan id vlan id, the range is \[1,4094] client linklayer addr relay agent address,only ip,configure option 79,after configuration, the message forwarded by relay will carry the mac address of the client only supported by dhcpv6 relay instance \[view] dhcp relay instance configuration view \[use cases] sonic# configure terminal sonic(config)# dhcp relay test v6 sonic(config dhcp relay test)# downlink vlan 100 option client linklayer addr giaddr loopback giaddr loopback loopback id \[command] giaddr loopback loopback id \[purpose] specify the gateway ip address \[parameters] parameter description loopback id loopback interface number, integer form, range from 0 to 999 \[view] dhcp relay instance configuration view \[notes] by default, the switch will set the giaddr to the ip address of the host vlan interface when it receives a dhcp request \[use cases] sonic(config)# dhcp relay test v4 sonic(config dhcp relay test)# giaddr loopback 0 server server dhcp server ip \[command] server dhcp server ip \[purpose] set dhcp server ip \[parameters] parameter description dhcp server ip specify the dhcp server ip address \[view] dhcp relay instance configuration view \[use cases] sonic(config)# dhcp relay test v4 sonic(config dhcp relay test)# server 10 248 0 1 uplink {ethernet|link aggregation|vlan} uplink {ethernet|link aggregation|vlan} interface name \[command] uplink { ethernet | link aggregation|vlan } interface name \[purpose] specify the uplink port ( on dhcp server side) of dhcp relay \[parameters] parameter description interface name interface name (eg 0/1) \[view] dhcp relay instance configuration view \[use cases] sonic(config)# dhcp relay test v4 sonic(config dhcp relay test)# uplink ethernet 0/2 dhcp server dhcp server dhcp server view dhcp server view table 3 dhcp server view table 3 dhcp server view command purpose show dhcp pool info \[ ip version { v4 | v6 }] display dhcp server pool information show dhcp pool ip use \[ ip version { v4 | v6 }] display the address assigned to clients by dhcp server show dhcp pool expired \[ ip version { v4 | v6 }] display dhcp server expired ip information show dhcp class display dhcp server user class configuration show dhcp option group display dhcp server option group configuration show dhcp pool info \[ip version {v4|v6}] show dhcp pool info \[ip version {v4|v6}] \[command] show dhcp pool info \[ ip version { v4 | v6 }] \[purpose] display dhcp server pool infomation \[view] privileged user view \[notes] when no ip address version is specified, default view of ipv4 version address pool information \[use cases] sonic# show dhcp pool info \ pool name t1 network 201 0 0 0 mask 255 255 255 0 lease 201 0 0 20 201 0 0 50 lease default time 600 lease max time 7200 used lease 0 total lease 72 show dhcp pool ip use \[ip version {v4|v6}] show dhcp pool ip use \[ip version {v4|v6}] \[command] show dhcp pool ip use \[ ip version { v4 | v6 }] \[purpose] display the addresses assigned to clients by dhcp server \[view] privileged user view \[notes] when no ip address version is specified, the default view is the ip address information assigned by the ipv4 version \[use cases] sonic# show dhcp pool ip in use ip version v4 reading leases from /var/lib/dhcp/dhcpd leases ip mac hostname binding state starts ends \================================================================================================================== total lease 0 show dhcp pool expired \[ip version {v4|v6}] show dhcp pool expired \[ip version {v4|v6}] \[command] show dhcp pool expired \[ ip version { v4 | v6 }] \[purpose] display dhcp server expired ip information \[view] privileged user view \[notes] when no ip address version is specified, the default view is the ip address information reclaimed by ipv4 version \[use cases] sonic# show dhcp pool expired reading leases from /var/lib/dhcp/dhcpd leases ip mac hostname binding state starts ends \================================================================================================================== 201 0 0 35 18 17 25 37 64 40 na free 2024 10 21 03 07 01 2024 10 21 03 09 07 total lease 1 show dhcp class show dhcp class \[command] show dhcp class \[purpose] display dhcp server user class configuration \[view] privileged user view \[use cases] sonic# show dhcp class ! dhcp class t1 ! dhcp class test1 if match rule 1 option 93 hex ffff show dhcp option group show dhcp option group \[command] show dhcp option group \[purpose] display dhcp server option group configuration \[view] privileged user view \[use cases] sonic# show dhcp option group ! dhcp option group 1 option43 hex 01 force dhcp server config dhcp server config table 4 dhcp server config table 4 dhcp server config command purpose dhcp server enable interface dhcp server function dhcp pool name \[ v6 ] create a dhcp server address pool and enter the dhcp pool configuration view dhcp class name create dhcp server user class and enter dhcp user class configuration view dhcp option group id create a dhcp server option group and enter the option group configuration view network { a b c d a b c d|a b a b } configure the network of the address pool address pool start ip end ip configure address pool ip range lease time default time max time configure lease time bootfile name configure bootfile option dns { a b c d|a b } configure dns option next server { a b c d|a b } configure next server option tftp server { a b c d|a b } configure tftp server option capwap ac a b c d configure capwap ac option routers a b c d configure routers option option43 hex value force configure option43 option class name address pool start ip end ip configure user class ip range class name option group id bind class and option group if match rule rule id option option id create user class matching rule dhcp failover name enable dhcp server failover adddress { a b c d | loopback 0 } configure failover local ip peer address a b c d configure failover peer ip auto partner down time configure peer offline time max response delay time configure maximum communication interruption time role { primary | secondary } configure primary and secondary roles dhcp server dhcp server \[command] dhcp server \[purpose] enable interface dhcp server function \[view] physical interface / vlanif configuration view \[notes] run command no dhcp server to disable interface dhcp server fuction \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 dhcp pool dhcp pool name \[v6] \[command] dhcp pool name \[ v6 ] \[purpose] create a dhcp server address pool and enter the dhcp pool configuration view \[parameters] parameter description name dhcp server pool name \[view] global configuration view \[notes] default creation of ipv4 type address pool, with v6 parameter, creates ipv6 type address pool run command no dhcp pool name \[ v6 ] to delete dhcp pool \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 dhcp class dhcp class name \[command] dhcp class name \[purpose] create dhcp server user class and enter dhcp user class configuration view \[parameters] parameter description name dhcp server class name \[view] global configuration view \[notes] run command no dhcp class name to delete dhcp class \[use cases] sonic# configure terminal sonic(config)# dhcp class t1 dhcp option group dhcp option group id \[command] dhcp option group id \[purpose] create a dhcp server option group and enter the option group configuration view \[parameters] parameter description id dhcp server option group id, with a value range of 1 65535 \[view] global configuration view \[notes] run command no dhcp option group id to delete dhcp option group \[use cases] sonic# configure terminal sonic(config)# dhcp option group 1 network { network { a b c d a b c d | a b a b } \[command] network { a b c d a b c d | a b a b } \[purpose] configure the network of the address pool \[parameters] parameter description a b c d a b c d ipv4 address and mask a ;b a b ipv6 address and mask \[view] dhcp pool configuration view \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# network 100 0 0 1 255 255 255 0 address pool address pool start ip end ip \[command] address pool start ip end ip \[purpose] configure address pool ip range \[parameters] parameter description start ip start ip end ip end ip \[view] dhcp pool configuration view \[notes] the end ip address must be after the start ip address \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# address pool 100 0 0 10 100 0 0 100 lease time lease time default time max time \[command] lease time default time max time \[purpose] configure lease time \[parameters] parameter description default time default lease time, in seconds, with a value range greater than 300, default value is 600 max time the maximum lease time, in seconds, needs to be greater than the default lease time, the default value is 7200 \[view] dhcp pool configuration view \[notes] run command no lease time to restore lease time to default value \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# lease time 300 1000 bootfile bootfile name \[command] bootfile name \[purpose] configure bootfile option \[parameters] parameter description name file name \[view] dhcp pool configuration view/dhcp option group configuration view \[notes] run command no bootfile to delete bootfile option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# bootfile name test txt dns { dns { a b c d | a b } \[command] dns { a b c d | a b } \[purpose] configure dns option \[parameters] parameter description a b c d ipv4 address a b ipv6 address \[view] dhcp pool configuration view/ dhcp option group configuration view \[notes] run command no dns to delete dns option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# dns 8 8 8 8 next server { next server { a b c d | a b } \[command] next server { a b c d | a b } \[purpose] configure next server option \[parameters] parameter description a b c d ipv4 address a b ipv6 address \[view] dhcp pool configuration view \[notes] run command no next server to delete next server option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# next server 1 1 1 1 tftp server { tftp server { a b c d | a b } \[command] tftp server { a b c d | a b } \[purpose] configure tftp server option \[parameters] parameter description a b c d ipv4 address a b ipv6 address \[view] dhcp pool configuration view/dhcp option group configuration view \[notes] run command no tftp server to delete tftp server option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# tftp server 2 2 2 2 capwap ac capwap ac a b c d \[command] capwap ac a b c d \[purpose] configure capwap ac option \[parameters] parameter description a b c d ipv4 address \[view] dhcp pool configuration view/dhcp option group configuration view \[notes] run command no capwap ac to delete capwap ac option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# capwap ac 3 3 3 3 routers routers a b c d \[command] routers a b c d \[purpose] configure routers option \[parameters] parameter description a b c d ipv4 address \[view] dhcp pool configuration view/dhcp option group configuration view \[notes] only supports ipv4 addresses run command no routers to delete routers option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# routers 100 0 0 1 option43 hex option43 hex value force \[command] option43 hex value force \[purpose] configure option43 option \[parameters] parameter description value hexadecimal number \[view] dhcp pool configuration view/dhcp option group configuration view \[notes] run command no option43 to delete routers option \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# option43 hex 10 force class class name address pool start ip end ip \[command] class name address pool start ip end ip \[purpose] configure dhcp user class ip range \[parameters] parameter description name class name start ip start ip end ip end ip \[view] dhcp pool configuration view \[notes] run command no class name address pool to delete dhcp user class ip range \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# class test1 address pool 100 0 0 110 100 0 0 150 class class name option group id \[command] class name option group id \[purpose] bind class and option group \[parameters] parameter description name class name id option group id \[view] dhcp pool configuration view \[notes] run command no class name option group to unbind class and option group \[use cases] sonic# configure terminal sonic(config)# dhcp pool test1 sonic(config dhcp pool t1)# class test1 option group 1 if match rule if match rule rule id option option id \[command] if match rule rule id option option id \[purpose] create user class matching rule \[parameters] parameter description rule id rule id, also indicating priority, with a value range of 1 16 the larger the value, the higher the priority option id option id, currently only supports 82 and 93 \[view] dhcp class configuration view \[notes] run command no if match rule rule id to delete user class matching rule \[use cases] sonic# configure terminal sonic(config)# dhcp class test1 sonic(config dhcp class test1)# if match rule 1 option 93 hex ffff dhcp failover dhcp failover name \[command] dhcp failover name \[purpose] enable dhcp server failover \[parameters] parameter description name instance name \[view] global configuration view \[notes] run command no dhcp failover name to disable dhcp server failover \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 a a dddress { dddress { a b c d |loopback 0} \[command] adddress { a b c d | loopback 0 } \[purpose] configure local ip \[parameters] parameter description a b c d ipv4 address \[view] dhcp failover configuration view \[notes] run command no address to delete local ip \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 sonic(config dhcp failover t456)# address 20 0 0 1 peer address peer address a b c d \[command] peer address a b c d \[purpose] configure peer ip \[parameters] parameter description a b c d ipv4 address \[view] dhcp failover configuration view \[notes] run command no peer address to delete peer ip \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 sonic(config dhcp failover t456)# peer address 20 0 0 2 auto partner down auto partner down time \[command] auto partner down time \[purpose] configure peer offline time \[parameters] parameter description time peer offline time, in seconds and ranging from 1 to 3600 by default, peers will not go offline \[view] dhcp failover configuration view \[notes] run command auto partner down to disable peer offline function \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 sonic(config dhcp failover t456)# auto partner down 100 max response delay max response delay time \[command] max response delay time \[purpose] configure maximum communication interruption time \[parameters] parameter description time the maximum communication interruption time, measured in seconds, ranges from 30 to 3600, with a default value of 60 \[view] dhcp failover configuration view \[notes] run command nomax response delay to restore maximum communication time to default value \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 sonic(config dhcp failover t456)# max response delay 100 role {primary|secondary} role {primary|secondary} \[command] role { primary|secondary } \[purpose] configure primary and secondary roles \[parameters] parameter description a b c d ipv4 address \[view] dhcp failover configuration view \[use cases] sonic# configure terminal sonic(config)# dhcp failover t456 sonic(config dhcp failover t456)# role primary
