思科vpp系列砖题五:DHCP插件功能

2023-07-09 11:13:11 浏览数 (1)

前言

当前VPP代码实现的DHCP功能是以插件的方式实现的DHCP功能,其代码路径为:src/plugin/dhcp 文件夹下。当前VPP在实现DHCP功能时,没有实现DHCP server功能。其按照接口方式使能和配置DHCP功能,其支持的配置如下所示

代码语言:javascript复制
#按照接口使能DHCP客户端 ,以vpp 18.04为例子
功能:基于接口配置DHCP4 客户端
配置命令:set dhcp client [del] intfc <interface> [hostname <name>].
Declaration and implementation
Declaration: dhcp_client_set_command (src/vnet/dhcp/client.c line 1150)

Implementation: dhcp_client_set_command_fn.

查询DHCP客户端的方法

代码语言:javascript复制
命令:show dhcp client [intfc <intfc>][verbose].
Declaration and implementation
Declaration: show_dhcp_client_command (src/vnet/dhcp/client.c line 872)

Implementation: show_dhcp_client_command_fn.

配置DHCP option 82的配置方法

代码语言:javascript复制
set dhcp option-82 vss [del] table <table id> [oui <n> vpn-id <n> | vpn-ascii-id <text>].
Declaration and implementation
Declaration: dhcp_proxy_vss_command (src/vnet/dhcp/dhcp4_proxy_node.c line 985)
Implementation: dhcp_option_82_vss_fn.

查看DHCP option-82的配置方法

代码语言:javascript复制
查询DHCP option-82的配置
命令:show dhcp option-82-address interface <interface>.
Declaration and implementation
Declaration: dhcp_proxy_address_show_command (src/vnet/dhcp/dhcp4_proxy_node.c line 1051)

Implementation: dhcp_option_82_address_show_command_fn.

设置DHCP proxy的方法

代码语言:javascript复制
#配置方法 
set dhcpv6 proxy [del] server <ipv6-addr> src-address <ipv6-addr> [server-fib-id <fib-id>] [rx-fib-id <fib-id>] .
Declaration and implementation
Declaration: dhcpv6_proxy_set_command (src/vnet/dhcp/dhcp6_proxy_node.c line 990)

Implementation: dhcpv6_proxy_set_command_fn.

#查询dhcp 代理配置
命令: show dhcp proxy
功能:Display dhcp proxy server info.

Declaration and implementation
Declaration: dhcp_proxy_show_command (src/vnet/dhcp/dhcp4_proxy_node.c line 934)
Implementation: dhcp4_proxy_show_command_fn.

二、搭建DHCP4 server

该部分后续章节再介绍

三、配置dhcp 客户端

1、在接口上配置DHCP 客户端

代码语言:javascript复制
set dhcp client [del] intfc <interface> [hostname <name>]

2、创建举例

代码语言:javascript复制
# 在虚拟机上 创建接口
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

3、查询是否能够从服务端拿到IP地址

代码语言:javascript复制
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

四、DHCPv4 协议介绍

文档 rfc 2131 在后续章节中介绍;

写在最后

0 人点赞