Centos 7下IPV6 有状态DHCPV6配置

前端之家收集整理的这篇文章主要介绍了Centos 7下IPV6 有状态DHCPV6配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_0@yum源安装kea

@H_403_0@yum install epel-release

@H_403_0@yum install kea

@H_403_0@

@H_403_0@

@H_403_0@DEMON

@H_403_0@ps aux| grep kea

@H_403_0@rpm -qa kea

@H_403_0@

@H_403_0@查看dhcpv6默认配置

@H_403_0@cat /etc/kea/kea.conf

@H_403_0@

@H_403_0@启动kea-dhcpv6并查看kea启动过程

@H_403_0@systemctl start kea-dhcp6

@H_403_0@systemctl status kea-dhcp6

@H_403_0@systemctl -l status kea-dhcp6

@H_403_0@

@H_403_0@通过tcpdump查看服务器数据包交互过程

@H_403_0@tcpdump -i eth0 -w dhcp6.pcap

@H_403_0@

@H_403_0@

@H_403_0@

@H_403_0@关闭防火墙

@H_403_0@systemctl stop firewalld.service

@H_403_0@注意:必须要关闭防火墙否则造成dhcpv6分配地址无法下发。

@H_403_0@

@H_403_0@用到的文件

@H_403_0@/var/lib/kea/kea-leases6.csv 默认情况下存放ipv6地址以及终端的设备信息,可查看到域账号mac地址等信息。

@H_403_0@/var/log/kea-dhcp6.log 我开的debug模式。可查看dhcp6运行状态的日志。

@H_403_0@

@H_403_0@

@H_403_0@Centos 7 修改dns

@H_403_0@修改/etc/NetworkManager/NetworkManager.conf

@H_403_0@[main]

@H_403_0@plugins=ifcfg-rh

@H_403_0@dns=none

@H_403_0@手工修改 /etc/resolv.conf

@H_403_0@nameserver 114.114.114.114

@H_403_0@nameserver 8.8.8.8

@H_403_0@

@H_403_0@服务器网卡静态ipv6配置:

@H_403_0@

@H_403_0@[root@localhost kea]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736

@H_403_0@TYPE=Ethernet

@H_403_0@BOOTPROTO=static

@H_403_0@DEFROUTE=yes

@H_403_0@PEERDNS=yes

@H_403_0@PEERROUTES=yes

@H_403_0@IPV4_FAILURE_FATAL=no

@H_403_0@IPV6INIT=yes

@H_403_0@IPV6_AUTOCONF=no

@H_403_0@IPV6_DEFROUTE=yes

@H_403_0@IPV6_PEERDNS=yes

@H_403_0@IPV6_PEERROUTES=yes

@H_403_0@IPV6_FAILURE_FATAL=no

@H_403_0@NAME=eno16777736

@H_403_0@UUID=03b35ca7-4678-48ca-ab46-5782367cd56a

@H_403_0@DEVICE=eno16777736

@H_403_0@ONBOOT=yes

@H_403_0@IPADDR=X.X.X.X

@H_403_0@GATEWAY=X.X.X.X

@H_403_0@NETMASK=X.X.X.X

@H_403_0@IPVADDR=2001:da8:XXXX:XXXX:24::125

@H_403_0@IPV6_DEFAULTGW=2001:da8:XXXX:XXXX:24::1

@H_403_0@IPV6ADDR=2001:da8:XXXX:XXXX:24::125/80

@H_403_0@

@H_403_0@

@H_403_0@

@H_403_0@kea-dhcpv6 配置:

@H_403_0@

@H_403_0@{

@H_403_0@

@H_403_0@"Dhcp6":

@H_403_0@{

@H_403_0@# Add names of interfaces to listen on.

@H_403_0@ "interfaces-config": {

@H_403_0@ "interfaces": ["eno16777736/2001:da8:XXXX:XXXX:24:aefd:ddb0:7d02"]

@H_403_0@ },

@H_403_0@

@H_403_0@ "option-data": [{"name": "unicast","data": "2001:da8:XXXX:XXXX:24:aefd:ddb0:7d02"} ],

@H_403_0@# Use Memfile lease database backend to store leases in a CSV file.

@H_403_0@

@H_403_0@# Setup reclamation of the expired leases and leases affinity.

@H_403_0@# Expired leases will be reclaimed every 10 seconds. Every 25

@H_403_0@# seconds reclaimed leases,which have expired more than 3600

@H_403_0@# seconds ago,will be removed. The limits for leases reclamation

@H_403_0@# are 100 leases or 250 ms for a single cycle. A warning message

@H_403_0@# will be logged if there are still expired leases in the

@H_403_0@# database after 5 consecutive reclamation cycles.

@H_403_0@# "expired-leases-processing": {

@H_403_0@# "reclaim-timer-wait-time": 10,

@H_403_0@# "flush-reclaimed-timer-wait-time": 25,

@H_403_0@# "hold-reclaimed-time": 3600,

@H_403_0@# "max-reclaim-leases": 100,

@H_403_0@# "max-reclaim-time": 250,

@H_403_0@# "unwarned-reclaim-cycles": 5

@H_403_0@# },

@H_403_0@

@H_403_0@# Addresses will be assigned with preferred and valid lifetimes

@H_403_0@# being 3000 and 4000,respectively. Client is told to start

@H_403_0@# renewing after 1000 seconds. If the server does not respond

@H_403_0@# after 2000 seconds since the lease was granted,client is supposed

@H_403_0@# to start REBIND procedure (emergency renewal that allows switching

@H_403_0@# to a different server).

@H_403_0@ "preferred-lifetime": 3000,

@H_403_0@ "valid-lifetime": 4000,

@H_403_0@ "renew-timer": 1000,

@H_403_0@ "rebind-timer": 2000,

@H_403_0@

@H_403_0@# The following list defines subnets. Uncomment to enable them.

@H_403_0@ "subnet6": [

@H_403_0@ { "subnet": "2001:da8:XXXX:XXXX:25::/80",

@H_403_0@ "pools": [ { "pool": "2001:da8:XXXX:XXXX:25::/80" } ],

@H_403_0@ "interface-id":"vlan25"

@H_403_0@

@H_403_0@},

@H_403_0@

@H_403_0@ { "subnet": "2001:da8:XXXX:XXXX:26::/80",

@H_403_0@ "pools": [ { "pool": "2001:da8:XXXX:XXXX:26::/80" } ],

@H_403_0@ "interface-id":"vlan26"

@H_403_0@

@H_403_0@ },

@H_403_0@# { "subnet": "2001:db8:3::/64",

@H_403_0@# "pools": [ { "pool": "2001:db8:3::/80" } ] },

@H_403_0@# { "subnet": "2001:db8:4::/64",

@H_403_0@# "pools": [ { "pool": "2001:db8:4::/80" } ] }

@H_403_0@ ]

@H_403_0@},

@H_403_0@

@H_403_0@# DHCP DDNS configuration starts here.

@H_403_0@

@H_403_0@# Logging configuration starts here. It tells Kea servers to store

@H_403_0@# all log messages (on severity INFO or more) in a file.

@H_403_0@# debuglevel variable is used on DEBUG level only.

@H_403_0@"Logging":

@H_403_0@{

@H_403_0@ "loggers": [

@H_403_0@ {

@H_403_0@ "name": "kea-dhcp4",

@H_403_0@ "output_options": [

@H_403_0@ {

@H_403_0@ "output": "/var/log/kea-dhcp4.log"

@H_403_0@ }

@H_403_0@ ],

@H_403_0@ "severity": "INFO",

@H_403_0@ "debuglevel": 0

@H_403_0@ },

@H_403_0@ {

@H_403_0@ "name": "kea-dhcp6",

@H_403_0@ "output_options": [

@H_403_0@ {

@H_403_0@ "output": "/var/log/kea-dhcp6.log"

@H_403_0@ }

@H_403_0@ ],

@H_403_0@ "severity": "DEBUG",/日志开启到debug级别,可以查看分配的地址信息。

@H_403_0@ "debuglevel": 99

@H_403_0@ },

@H_403_0@ {

@H_403_0@ "name": "kea-dhcp-ddns",

@H_403_0@ "output_options": [

@H_403_0@ {

@H_403_0@ "output": "/var/log/kea-ddns.log"

@H_403_0@ }

@H_403_0@ ],

@H_403_0@ "debuglevel": 0

@H_403_0@ }

@H_403_0@ ]

@H_403_0@}

@H_403_0@

@H_403_0@}

@H_403_0@

@H_403_0@

@H_403_0@如果自己网段内需要dhcpv6服务 需开通以下:

@H_403_0@

@H_403_0@

@H_403_0@

@H_403_0@[root@localhost kea]# cat /etc/kea/kea.conf

@H_403_0@# This is a basic configuration for the Kea DHCPv4 and DHCPv6 servers.

@H_403_0@# Subnet declarations are commented out and no interfaces are listed.

@H_403_0@# Therefore,the servers will not listen or respond to any queries.

@H_403_0@# The basic configuration must be extended to specify interfaces on

@H_403_0@# which the servers should listen. Also,subnets and options must be

@H_403_0@# declared.

@H_403_0@{

@H_403_0@

@H_403_0@# DHCPv4 configuration starts here.

@H_403_0@#"Dhcp4":

@H_403_0@#{

@H_403_0@# Add names of interfaces to listen on.

@H_403_0@# "interfaces-config": {

@H_403_0@# "interfaces": [ ]

@H_403_0@# },

@H_403_0@

@H_403_0@# Use Memfile lease database backend to store leases in a CSV file.

@H_403_0@# "lease-database": {

@H_403_0@# "type": "memfile"

@H_403_0@# },

@H_403_0@

@H_403_0@# Setup reclamation of the expired leases and leases affinity.

@H_403_0@# Expired leases will be reclaimed every 10 seconds. Every 25

@H_403_0@# seconds reclaimed leases,

@H_403_0@

@H_403_0@# Global (inherited by all subnets) lease lifetime is mandatory parameter.

@H_403_0@# "valid-lifetime": 4000,

@H_403_0@

@H_403_0@# Below an example of the simple subnet declaration. Uncomment to

@H_403_0@# enable it. This is a list,denoted with [ ],of structure,denoted

@H_403_0@# with { }. Each structure describes a single subnet and may have

@H_403_0@# several parameters. One of those parameters is "pools" that is

@H_403_0@# also a list of structures.

@H_403_0@# "subnet4": [

@H_403_0@# { "subnet": "192.0.2.0/24",

@H_403_0@# "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ] }

@H_403_0@# ]

@H_403_0@#},

@H_403_0@

@H_403_0@# DHCPv6 configuration starts here.

@H_403_0@"Dhcp6":

@H_403_0@{

@H_403_0@# Add names of interfaces to listen on.

@H_403_0@ "interfaces-config": {

@H_403_0@ "interfaces": ["eno16777736/2001:da8:XXXX:XXXX:24::125"]

@H_403_0@ },"data": "2001:da8:XXXX:XXXX:24::125"} ],

@H_403_0@

@H_403_0@ { "subnet": "2001:da8:XXXX:XXXX:24::/80",

@H_403_0@ "pools": [ { "pool": "2001:da8:XXXX:XXXX:24::/80" } ],

@H_403_0@ "interface":"eno16777736"

@H_403_0@

@H_403_0@ },

@H_403_0@ { "subnet": "2001:da8:XXXX:XXXX:26::/80",

@H_403_0@ "debuglevel": 99

@H_403_0@ },

@H_403_0@ "debuglevel": 0

@H_403_0@ }

@H_403_0@ ]

@H_403_0@}

@H_403_0@

@H_403_0@}

猜你在找的CentOS相关文章