使用 Linux Alpine 的服务器 DHCPv6

使用 Linux Alpine 的服务器 DHCPv6

我想用 alpine 创建一个 dhcp6 服务器

我正在使用 Kea-dhcp6。我的文件配置如下:

{
# DHCPv6 configuration starts on the next line
"Dhcp6": {

# First we set up global values
    "valid-lifetime": 4000,
    "renew-timer": 1000,
    "rebind-timer": 2000,
    "preferred-lifetime": 3000,

# Next we set up the interfaces to be used by the server.
    "interfaces-config": {
        "interfaces": [ "eth0" ]
    },
# And we specify the type of lease database
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/var/lib/kea/dhcp6.leases",
        "lfc-interval": 1800,
        "max-row-errors": 100
    },
    
    "preferred-lifetime": 3000,
    "valid-lifetime": 4000,
    "renew-timer": 1000,
    "rebind-timer": 2000,

# Finally, we list the subnets from which we will be leasing addresses.
    "subnet6": [
        {
            "subnet": "3003::0/112",
            "pools": [
                 {
                     "pool": "3003::20-3003::ffff"
                 }
             ]
        }
    ],
    "reservations": [
      {
        "hw-address": "00:0c:29:60:f8:3d",
        "ip-addresses": [ "3003::101" ]
      }
      ]
    
# DHCPv6 configuration ends with the next line
}

}

它正在运行,但 MAC 地址为“00:0c:29:60:f8:3d”的虚拟机返回此错误:

udhcpc6: started, v1.32.1
udhcpc6: sending discover
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc failed to get a DHCP lease
udhcpc6: sending discover
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc6: sending select
udhcpc6: no IAADDR option, ignoring packet
udhcpc failed to get a DHCP lease

有人能帮我吗 ???


我运行了这个命令:

kea-dhcp6 -d -t /etc/kea/kea-dhcp6.conf

其回报为:

Syntax check OK
    2021-03-24 15:15:24.408 DEBUG [kea-dhcp6.dhcp6/5324.139712987985184] DHCP6_OPEN_SOCKET opening service sockets on port 0
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command list-commands registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command build-report registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-backend-pull registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-get registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-reload registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-test registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-write registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command dhcp-disable registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command dhcp-enable registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command leases-reclaim registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command server-tag-get registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command libreload registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command config-set registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command shutdown registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command status-get registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command version-get registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-get registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-get-all registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-reset registered    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-reset-all registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-remove registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-remove-all registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-sample-age-set registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-sample-age-set-all registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-sample-count-set registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_REGISTERED Command statistic-sample-count-set-all registered
    2021-03-24 15:15:24.409 DEBUG [kea-dhcp6.dhcp6/5324.139712987985184] DHCP6_CONFIG_START DHCPv6 server is processing the following configuration: { "interfaces-config": { "interfaces": [ "eth0" ] }, "lease-database": { "lfc-interval": 1800, "max-row-errors": 100, "name": "/var/lib/kea/dhcp6.leases", "persist": true, "type": "memfile" }, "preferred-lifetime": 3000, "rebind-timer": 2000, "renew-timer": 1000, "subnet6": [ { "pools": [ { "pool": "3003::20-3003::ffff" } ], "reservations": [ { "hw-address": "00:0c:29:60:f8:3d", "ip-addresses": [ "3003::101" ] }, { "hw-address": "00:50:56:84:f4:b2", "ip-addresses": [ "3003::102" ] } ], "subnet": "3003::0/112" } ], "valid-lifetime": 4000 }
    2021-03-24 15:15:24.409 INFO  [kea-dhcp6.hosts/5324.139712987985184] HOSTS_BACKENDS_REGISTERED the following host backend types are available: mysql postgresql 
    2021-03-24 15:15:24.409 INFO  [kea-dhcp6.dhcpsrv/5324.139712987985184] DHCPSRV_CFGMGR_ADD_IFACE listening on interface eth0
    2021-03-24 15:15:24.410 INFO  [kea-dhcp6.dhcpsrv/5324.139712987985184] DHCPSRV_CFGMGR_NEW_SUBNET6 a new subnet has been added to configuration: 3003::0/112 with params: t1=1000, t2=2000, preferred-lifetime=3000, valid-lifetime=4000, rapid-commit is false
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_ADD_HOST add the host for reservations: hwaddr=000C2960F83D ipv6_subnet_id=1 hostname=(empty) ipv4_reservation=(no) siaddr=(no) sname=(empty) file=(empty) key=(empty) ipv6_reservation0=3003::101
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER get one host with IPv6 reservation for subnet id 1, identified by hwaddr=000C2960F83D
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_IDENTIFIER get all hosts with reservations using identifier: hwaddr=000C2960F83D
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT using identifier hwaddr=000C2960F83D, found 0 host(s)
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_NULL host not found using subnet id 1 and identifier hwaddr=000C2960F83D
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6 get one host with reservation for subnet id 1 and including IPv6 address 3003::101
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6 get all hosts with reservations for subnet id 1 and IPv6 address 3003::101
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6_COUNT using subnet id 1 and address 3003::101, found 0 host(s)
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6_NULL host not found using subnet id 1 and address 3003::101
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_ADD_HOST add the host for reservations: hwaddr=00505684F4B2 ipv6_subnet_id=1 hostname=(empty) ipv4_reservation=(no) siaddr=(no) sname=(empty) file=(empty) key=(empty) ipv6_reservation0=3003::102
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER get one host with IPv6 reservation for subnet id 1, identified by hwaddr=00505684F4B2
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_IDENTIFIER get all hosts with reservations using identifier: hwaddr=00505684F4B2
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT using identifier hwaddr=00505684F4B2, found 0 host(s)
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_NULL host not found using subnet id 1 and identifier hwaddr=00505684F4B2
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6 get one host with reservation for subnet id 1 and including IPv6 address 3003::102
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6 get all hosts with reservations for subnet id 1 and IPv6 address 3003::102
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ALL_SUBNET_ID_ADDRESS6_COUNT using subnet id 1 and address 3003::102, found 0 host(s)
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.hosts/5324.139712987985184] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS6_NULL host not found using subnet id 1 and address 3003::102
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.dhcpsrv/5324.139712987985184] DHCPSRV_CFGMGR_ADD_SUBNET6 adding subnet 3003::0/112
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.dhcpsrv/5324.139712987985184] DHCPSRV_TIMERMGR_UNREGISTER_ALL_TIMERS unregistering all timers
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command build-report deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-backend-pull deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-get deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-reload deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-set deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-test deregistered    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command config-write deregistered
    2021-03-24 15:15:24.410 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command dhcp-disable deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command dhcp-enable deregistered    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command leases-reclaim deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command libreload deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command server-tag-get deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command shutdown deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-get deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-get-all deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-remove deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-remove-all deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-reset deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-reset-all deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-sample-age-set deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-sample-age-set-all deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-sample-count-set deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command statistic-sample-count-set-all deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command status-get deregistered
    2021-03-24 15:15:24.411 DEBUG [kea-dhcp6.commands/5324.139712987985184] COMMAND_DEREGISTERED Command version-get deregistered

它似乎有效,但客户端没有收到任何 IP

请帮帮我


我将 conf 文件更改为:

{
# DHCPv6 configuration starts on the next line
"Dhcp6": {

# First we set up global values
# T1 < T2 < preferred lifetime < valid lifetime
    "renew-timer": 1000,
    "rebind-timer": 2000,
    "preferred-lifetime": 3000,
    "valid-lifetime": 4000,

# Next we set up the interfaces to be used by the server.
    "interfaces-config": {
        "interfaces": [ "eth1" ]
    },
# And we specify the type of lease database
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/var/lib/kea/dhcp6.leases",
        "lfc-interval": 1800,
        "max-row-errors": 100
    },
    
# Finally, we list the subnets from which we will be leasing addresses.
    "subnet6": [
        {
            "subnet": "fdc1:cc1a::beef:0/64",
            "pools": [ { "pool": "fdc1:cc1a::beef:20-fdc1:cc1a::beef:ffff" } ],
            "interface": "eth1",
            "reservations": [ 
              { "hw-address": "00:0c:29:60:F8:3D", "ip-addresses": [ "fdc1:cc1a::beef:101" ] },
              { "hw-address": "00:50:56:84:f4:b2", "ip-addresses": [ "fdc1:cc1a::beef:102" ] } 
            ]
        }
    ]
    
# DHCPv6 configuration ends with the next line
}

}

当我在 Alpine VM 客户端中运行 udhcpc6 时,它的返回结果是

udhcpc6: started, v1.32.1
udhcpc6: sending discover
udhcpc6: sending select
udhcpc6: IPv6 obtained, lease time 4000

但如果我运行 ifconfig 我看不到任何 IP

解决方案??

答案1

是的,Alpine 没有从我的路由器获取 IPv6,我只运行 DHCPv6 来提供 IPv6 IP。

通过安装 dhcpcd 我能够使其工作。apk add dhcpcd

相关内容