vpp並無dhcp server功能,只有dhcp client功能,具體命令見這裏html
dhcp server採用isc-dhcp-server,具體安裝見我另外一篇文章測試
注意,要確保二層是通的ui
clispa
set dhcp client [del] intfc <interface> [hostname <name>].
usage.net
create interface vmxnet3 0000:13:00.0 bind #添加 set dhcp client intfc vmxnet3-0/13/0/0 hostname vppgate #查看 show dhcp client intfc vmxnet3-0/13/0/0 #刪除 set dhcp client del intfc vmxnet3-0/13/0/0
此時show dhcp client查看已經分配了10.241.100.11的IPcode
vpp# show int addr local0 (dn): vmxnet3-0/13/0/0 (up): L3 10.241.100.11/16 vpp# show dhcp client [0] vmxnet3-0/13/0/0 state DHCP_BOUND installed 1 addr 10.241.100.11/16 gw 10.241.255.254 server 10.241.4.6 dns 8.8.8.8 dns 4.4.4.4
去dhcp server端查看分配狀況, cat /var/lib/dhcp/dhcpd.leasesserver
lease 10.241.100.11 { starts 0 2020/08/16 15:39:26; ends 0 2020/08/16 15:49:26; cltt 0 2020/08/16 15:39:26; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:50:56:ab:5a:69; uid "\000vpp 1.1\000"; client-hostname "vppgate"; }