HenriWahl / dhcpy6d

MAC address aware DHCPv6 server written in Python
https://dhcpy6d.de
GNU General Public License v2.0
94 stars 27 forks source link

Prefix-delegation not work #21

Closed weyou closed 5 years ago

weyou commented 5 years ago

Just install dhcpy6d from the master branch.

My dhcpy6d.conf:

[dhcpy6d]
interface = eth2
store_config = sqlite
store_volatile = sqlite
store_sqlite_config = /var/lib/dhcpy6d/config.sqlite
store_sqlite_volatile = /var/lib/dhcpy6d/volatile.sqlite
log = yes
log_file = /var/log/dhcpy6d.log
nameserver = fd01:db8::53
really_do_it = yes

[address_default]
category = random
pattern = 2001:db8::$random64$
ia_type = na
preferred_lifetime = 32400
valid_lifetime = 43200

[prefix_default]
category = range
range = 1000-1fff
pattern = 2001:db8:$range$::
length = 64

#[class_default_eth2]
#addresses = default
#prefixes = default

The log:

2019-02-20 19:39:15,260 dhcpy6d INFO Starting dhcpy6d daemon...
2019-02-20 19:39:15,260 dhcpy6d INFO Server DUID: 000100015c6d19bc001a6b4d57e9
2019-02-20 19:39:15,266 dhcpy6d INFO Running as user dhcpy6d (UID 126) and group dhcpy6d (GID 135)
2019-02-20 19:39:15,268 dhcpy6d INFO Listening on interfaces: eth2
2019-02-20 19:39:23,348 dhcpy6d INFO SOLICIT | TransactionID: fbf5b7 | Answer: normal | ClientLLIP: fe80:0000:0000:0000:4af8:b3ff:fef7:10f5 | Counter: 1 | DUID: 00020309050548f8b3f710f5 | DUID_EN: 50922757 | IAID: b3f710f5 | IA_Options: [3, 25] | ID: fbf5b7 | Interface: eth2 | LastMessageReceivedType: 1 | MAC: 00:00:00:00:00:00 | OptionsRequest: [23, 24, 31, 64]
2019-02-20 19:39:23,353 dhcpy6d INFO ADVERTISE | TransactionID: fbf5b7 | Options:[3, 7, 24] | Addresses: 2001:0db8:0000:0000:ec0c:4cb6:58a2:d6da | Class: default_eth2
2019-02-20 19:39:23,422 dhcpy6d INFO REQUEST | TransactionID: 5c8bce | Addresses:2001:0db8:0000:0000:ec0c:4cb6:58a2:d6da | Answer: normal | ClientLLIP: fe80:0000:0000:0000:4af8:b3ff:fef7:10f5 | Counter: 1 | DUID: 00020309050548f8b3f710f5 | DUID_EN: 50922757 | IAID: b3f710f5 | IA_Options: [3] | ID: 5c8bce | Interface: eth2 | LastMessageReceivedType: 3 | MAC: 48:f8:b3:f7:10:f5 | OptionsRequest: [23, 24, 31,64]
2019-02-20 19:39:23,424 dhcpy6d INFO REPLY | TransactionID: 5c8bce | Options: [3,7, 24] | Addresses: 2001:0db8:0000:0000:ec0c:4cb6:58a2:d6da | Class: default_eth2

Client requested both IA-NA and IA-PD, but dhcpy6d only responsed the IA-NA.

Here is the captured packets dhcpy6d-ia-pd.pcap You can view it with Wireshark.

HenriWahl commented 5 years ago

Your class definitions are missing the keyword advertise. Per default only adresses are advertised as a security measure. The following setting should make it work:

[class_foo] advertise = addresses prefixes

See https://dhcpy6d.ifw-dresden.de/documentation/config/classes/ for details.

weyou commented 5 years ago

It works like a charm. Thanks.

But the document points out that: "As default addresses and prefixes will be advertised"

As default addresses and prefixes will be advertised – if defined. When only addresses or only prefixes should be used by this class, the option advertise defines which ones apply

HenriWahl commented 5 years ago

Ah right - sorry, I will fix this!

HenriWahl commented 5 years ago

Fixed - thanks for the hint!