溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Centos 7下IPV6 有狀態(tài)DHCPV6配置

發(fā)布時間:2020-06-23 05:17:56 來源:網(wǎng)絡(luò) 閱讀:22734 作者:hongfeiwuyue 欄目:網(wǎng)絡(luò)安全

yum源安裝kea

yum install epel-release

yum install kea



DEMON

ps aux| grep kea

rpm -qa kea  


查看dhcpv6默認配置

cat /etc/kea/kea.conf


啟動kea-dhcpv6并查看kea啟動過程

systemctl start kea-dhcp6

systemctl status kea-dhcp6

systemctl -l status kea-dhcp6


通過tcpdump查看服務(wù)器數(shù)據(jù)包交互過程

tcpdump -i eth0 -w dhcp6.pcap




關(guān)閉防火墻

systemctl stop firewalld.service

注意:必須要關(guān)閉防火墻否則造成dhcpv6分配地址無法下發(fā)。


用到的文件:

/var/lib/kea/kea-leases6.csv  默認情況下存放ipv6地址以及終端的設(shè)備信息,可查看到域賬號mac地址等信息。

/var/log/kea-dhcp6.log  我開的debug模式??刹榭磀hcp6運行狀態(tài)的日志。



Centos 7 修改dns

 修改/etc/NetworkManager/NetworkManager.conf 

 [main]

plugins=ifcfg-rh

dns=none

手工修改 /etc/resolv.conf

nameserver 114.114.114.114

nameserver 8.8.8.8


服務(wù)器網(wǎng)卡靜態(tài)ipv6配置:


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

TYPE=Ethernet

BOOTPROTO=static

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=no

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eno16777736

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

DEVICE=eno16777736

ONBOOT=yes

IPADDR=X.X.X.X

GATEWAY=X.X.X.X

NETMASK=X.X.X.X

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

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

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




kea-dhcpv6 配置:


{


"Dhcp6":

{

# Add names of interfaces to listen on.

  "interfaces-config": {

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

  },


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

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


# Setup reclamation of the expired leases and leases affinity.

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

# seconds reclaimed leases, which have expired more than 3600

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

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

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

# database after 5 consecutive reclamation cycles.

#  "expired-leases-processing": {

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

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

#    "hold-reclaimed-time": 3600,

#    "max-reclaim-leases": 100,

#    "max-reclaim-time": 250,

#    "unwarned-reclaim-cycles": 5

#  },


# Addresses will be assigned with preferred and valid lifetimes

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

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

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

# to start REBIND procedure (emergency renewal that allows switching

# to a different server).

  "preferred-lifetime": 3000,

  "valid-lifetime": 4000,

  "renew-timer": 1000,

  "rebind-timer": 2000,


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

  "subnet6": [

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

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

       "interface-id":"vlan25"


},


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

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

       "interface-id":"vlan26"


  },

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

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

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

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

   ]

},


# DHCP DDNS configuration starts here.


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

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

# debuglevel variable is used on DEBUG level only.

"Logging":

{

  "loggers": [

    {

      "name": "kea-dhcp4",

      "output_options": [

          {

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

          }

      ],

      "severity": "INFO",

      "debuglevel": 0

    },

    {

      "name": "kea-dhcp6",

      "output_options": [

          {

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

          }

      ],

      "severity": "DEBUG",    /日志開啟到debug級別,可以查看分配的地址信息。

      "debuglevel": 99

    },

    {

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

      "output_options": [

          {

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

          }

      ],

      "severity": "INFO",

      "debuglevel": 0

    }

  ]

}


}



如果自己網(wǎng)段內(nèi)需要dhcpv6服務(wù) 需開通以下:




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

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

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

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

# The basic configuration must be extended to specify interfaces on

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

# declared.

{


# DHCPv4 configuration starts here.

#"Dhcp4":

#{

# Add names of interfaces to listen on.

#  "interfaces-config": {

#    "interfaces": [ ]

#  },


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

#  "lease-database": {

#   "type": "memfile"

# },


# Setup reclamation of the expired leases and leases affinity.

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

# seconds reclaimed leases, which have expired more than 3600

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

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

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

# database after 5 consecutive reclamation cycles.

#  "expired-leases-processing": {

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

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

#    "hold-reclaimed-time": 3600,

#    "max-reclaim-leases": 100,

#    "max-reclaim-time": 250,

#    "unwarned-reclaim-cycles": 5

#  },


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

#  "valid-lifetime": 4000,


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

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

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

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

# also a list of structures.

#  "subnet4": [

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

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

#  ]

#},


# DHCPv6 configuration starts here.

"Dhcp6":

{

# Add names of interfaces to listen on.

  "interfaces-config": {

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

  },


  "option-data": [{"name": "unicast","data": "2001:da8:XXXX:XXXX:24::125"} ],

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


# Setup reclamation of the expired leases and leases affinity.

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

# seconds reclaimed leases, which have expired more than 3600

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

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

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

# database after 5 consecutive reclamation cycles.

#  "expired-leases-processing": {

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

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

#    "hold-reclaimed-time": 3600,

#    "max-reclaim-leases": 100,

#    "max-reclaim-time": 250,

#    "unwarned-reclaim-cycles": 5

#  },


# Addresses will be assigned with preferred and valid lifetimes

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

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

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

# to start REBIND procedure (emergency renewal that allows switching

# to a different server).

  "preferred-lifetime": 3000,

  "valid-lifetime": 4000,

  "renew-timer": 1000,

  "rebind-timer": 2000,


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

  "subnet6": [

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

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

       "interface-id":"vlan25"


},


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

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

       "interface":"eno16777736"


  },

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

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

       "interface-id":"vlan26"


  },

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

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

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

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

   ]

},


# DHCP DDNS configuration starts here.


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

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

# debuglevel variable is used on DEBUG level only.

"Logging":

{

  "loggers": [

    {

      "name": "kea-dhcp4",

      "output_options": [

          {

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

          }

      ],

      "severity": "INFO",

      "debuglevel": 0

    },

    {

      "name": "kea-dhcp6",

      "output_options": [

          {

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

          }

      ],

      "severity": "DEBUG",

      "debuglevel": 99

    },

    {

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

      "output_options": [

          {

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

          }

      ],

      "severity": "INFO",

      "debuglevel": 0

    }

  ]

}


}


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI