Linux 支持DHCPv6下的IPOE (ISC DHCP)

IPV6现在国家正在大力推广,同时会进行一些安全认证。IPoE现在已经成为业界的主流要求之一。

根据工信部的双栈宽带接入服务器技术要求(YD/T 2785-2014)的描述(下图),需要这些字段。
在这里插入图片描述

我们查看ISC DHCP默认的报文,可以看到Option1和在其中的DUID有了,但是其他Option缺失。

man dhclient.conf
man dhcp-options

查阅帮助文档,确认是可以通过修改dhclient.conf,达到报告报文的目的。

Enterprise ID需要自行向IANA进行申请,当然是实验室的话你随便写就好
在该网站查询所有已注册的厂商
https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers

在17中,也有EnterpriseId,因此我认为16是非必要的(这个只是我的认知,不确定)

#按照包体写入发送内容
send dhcp6.vendor-opts 
#厂商占4位
  00:00:00:02:
# 00:01是OptCode,00:05是长度
  00:01:00:05:
 #这个随便写吧,我是写了hello
  68:65:6c:6c:6f;

#这个对应Request中包含17的请求
also request dhcp6.vendor-opts;

在这里插入图片描述

  • 附1:手工启动DHCP客户端的方法

#释放旧的DHCP
dhclient -r -6 网卡名
#重新注册,dhclient的位置可自行指定
dhclient -6 -cf /etc/dhcp/dhclient.conf 网卡名

如果使用了NetworkManager,请查看对应的脚本,他会去寻找对应网卡名的dhclient配置文件。

  • 附2:DHCPV6 服务端配置

  1. 配置你的网卡IP为V6地址,假设你配置成2001:db8::2/64

  2. 修改/etc/dhcp/dhcpd6.conf

# Server configuration file example for DHCPv6
# From the file used for TAHI tests.

# IPv6 address valid lifetime
#  (at the end the address is no longer usable by the client)
#  (set to 30 days, the usual IPv6 default)
default-lease-time 2592000;

# IPv6 address preferred lifetime
#  (at the end the address is deprecated, i.e., the client should use
#   other addresses for new connections)
#  (set to 7 days, the	usual IPv6 default)
preferred-lifetime 604800;

# T1, the delay before Renew
#  (default is 1/2 preferred lifetime)
#  (set to 1 hour)
option dhcp-renewal-time 3600;

# T2, the delay before Rebind (if Renews failed)
#  (default is 3/4 preferred lifetime)
#  (set to 2 hours)
option dhcp-rebinding-time 7200;

# Enable RFC 5007 support (same than for DHCPv4)
allow leasequery;

# Global definitions for name server address(es) and domain search list
option dhcp6.name-servers 2001:db8::2;
option dhcp6.domain-search "test.example.com","example.com";

# Set preference to 255 (maximum) in order to avoid waiting for
# additional servers when there is only one
##option dhcp6.preference 255;

# Server side command to enable rapid-commit (2 packet exchange)
##option dhcp6.rapid-commit;

# The delay before information-request refresh
#  (minimum is 10 minutes, maximum one day, default is to not refresh)
#  (set to 6 hours)
option dhcp6.info-refresh-time 21600;

# The path of the lease file
dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";

# Static definition (must be global)
host myclient {
	# The entry is looked up by this
	host-identifier option
		dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;

	# A fixed address
	fixed-address6 2001:db8::2;

	# A fixed prefix
	fixed-prefix6 2001:db8::/64;

	# Override of the global definitions,
	# works only when a resource (address or prefix) is assigned
	option dhcp6.name-servers 2001:db8::2;

	#a For debug (to see when the entry statements are executed)
	#  (log "sol" when a matching Solicitation is received)
	##if packet(0,1) = 1 { log(debug,"sol"); }
}

# The subnet where the server is attached
#  (i.e., the server has an address in this subnet)
subnet6 2001:db8::/64 {
	# Two addresses available to clients
	#  (the third client should get NoAddrsAvail)
	range6 2001:db8::100 2001:db8::999;

	# Use the whole /64 prefix for temporary addresses
	#  (i.e., direct application of RFC 4941)
	range6 2001:db8:: temporary;

	# Some /64 prefixes available for Prefix Delegation (RFC 3633)
	prefix6 2001:db8:: 2001:db8:: /64;

}

  1. 安装网关radvd并配置

默认DHCPD6装好后无网关,如果你是一个小局域网,需要再部署一个radvd,否则WIN的系统无法正常工作。

yum install radvd
vi /etc/radvd.conf

默认情况下,把出厂注释掉的那些开出来,改下网卡和就能用了。

interface eno2
{
	AdvSendAdvert on;
	MinRtrAdvInterval 30;
	MaxRtrAdvInterval 100;

	prefix 2001:db8::/64
	{
		AdvOnLink on;
		AdvAutonomous on;
		AdvRouterAddr off;
	};

};

  1. 启动服务
service dhcpd6 start
chkconfig dhcpd6 on
service radvd start
chkconfig radvd on
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值