前言
vpp并没有dhcp server功能,只有dhcp client功能,具体命令见这里
dhcp server安装
dhcp server采用isc-dhcp-server,具体安装见我另一篇文章
注意,要确保二层是通的
vpp dhcp client配置
cli
set dhcp client [del] intfc <interface> [hostname <name>].
usage
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的IP
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.leases
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";
}
来源:oschina
链接:https://my.oschina.net/u/914655/blog/4498021