DHCP
56 min
\<font color="#1d50a2">dhcp relay\</font> \<font color="#1d50a2">dhcp relay view\</font> \<font color="#1d05a2">table 1 dhcp relay view\</font> command purpose show dhcp relay display dhcp relay configuration \<font color="#1d50a2">show dhcp relay\</font> \[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| + + + + + + + \<font color="#1d50a2">dhcp relay config\</font> \<font color="#1d05a2">table 2 dhcp relay config\</font> 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 \<font color="#1d50a2">feature dhcp state enable\</font> \[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 \<font color="#1d50a2">dhcp relay \</font> \[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 \<font color="#1d50a2">downlink vlan \</font> \[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 \<font color="#1d50a2">downlink vlan \</font> \[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 \<font color="#1d50a2">giaddr loopback \</font> \[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 \<font color="#1d50a2">server \</font> \[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 \<font color="#1d50a2">uplink {ethernet|link aggregation|vlan} \</font> \[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 \<font color="#1d50a2">dhcp server\</font> \<font color="#1d50a2">dhcp server view\</font> \<font color="#1d05a2">table 3 dhcp server view\</font> 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 \<font color="#1d50a2">show dhcp pool info \[ip version {v4|v6}]\</font> \[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 \<font color="#1d50a2">show dhcp pool ip use \[ip version {v4|v6}]\</font> \[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 \<font color="#1d50a2">show dhcp pool expired \[ip version {v4|v6}]\</font> \[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 \<font color="#1d50a2">show dhcp class\</font> \[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 \<font color="#1d50a2">show dhcp option group\</font> \[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 \<font color="#1d50a2">dhcp server config\</font> \<font color="#1d05a2">table 4 dhcp server config\</font> 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 \<font color="#1d50a2">dhcp server\</font> \[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 \<font color="#1d50a2">dhcp pool \</font> \[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 \<font color="#1d50a2">dhcp class \</font> \[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 \<font color="#1d50a2">dhcp option group \</font> \[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 \<font color="#1d50a2">network {\</font> \[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 \<font color="#1d50a2">address pool \</font> \[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 \<font color="#1d50a2">lease time \</font> \[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 \<font color="#1d50a2">bootfile \</font> \[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 \<font color="#1d50a2">dns {\</font> \[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 \<font color="#1d50a2">next server {\</font> \[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 \<font color="#1d50a2">tftp server {\</font> \[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 \<font color="#1d50a2">capwap ac \</font> \[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 \<font color="#1d50a2">routers \</font> \[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 \<font color="#1d50a2">option43 hex \</font> \[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 \<font color="#1d50a2">class \</font> \[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 \<font color="#1d50a2">class \</font> \[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 \<font color="#1d50a2">if match rule \</font> \[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 \<font color="#1d50a2">dhcp failover \</font> \[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 \<font color="#1d50a2">a\</font> \<font color="#1d50a2">dddress {\</font> \[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 \<font color="#1d50a2">peer address \</font> \[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 \<font color="#1d50a2">auto partner down \</font> \[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 \<font color="#1d50a2">max response delay \</font> \[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 \<font color="#1d50a2">role {primary|secondary}\</font> \[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
