Closed wugsh closed 4 years ago
Hi, prefixes are used for prefix delegation - do you maybe mix it with addresses? Apparently your client requested an address which it got, using your random scheme.
Ah, you have a typo there... "class_defult".
I use dhcpy6d.conf : [address_default] category = random pattern = 5555:aaaa::$random64$
[prefixes_default] category = range range = 1000-2000 pattern = 5555:bbbb:$range$:: length = 64
[class_default] advertise = prefixes
the dhcpy6d.log print "2020-06-07 18:40:39,903 dhcpy6d WARNING REPLY | no addresses or prefixes available | transaction: 409108 | client_llip: fe80:0000:0000:0000:d5c4:4fb2:f20b:65be ", client can not get IPv6 addresss. I want use prefix assign IPv6 address.
So you need "advertise = addresses prefixes"
I use "advertise = addresses prefixes", the dhcpy6d.log print the same log.
Strange... can you send your complete config so I can check it?
My dhcpy6d.conf is: [dhcpy6d]
really_do_it = yes
interface = enp3s0
Some server DUID. serverduid = 0001000134824528134567366222
log = yes log_console = no log_file = /etc/dhcpy6d.log
valid_lifetime = 7200 server_preference = 255 store_config = mysql store_volatile = mysql store_db_host = 127.0.0.1
store_db_db = dhcpy6d store_db_user = root store_db_password = 123456
[address_default] category = random pattern = 5555:aaaa::$random64$
[prefixes_default] category = range range = 1000-2000 pattern = 5555:bbbb:$range$:: length = 64
[class_default] advertise = addresses prefixes
[class_fixed_address]
Another typo... you need [prefix_default] instead of [prefixes_default].
[dhcpy6d]
really_do_it = yes
interface = enp3s0
Some server DUID. serverduid = 0001000134824528134567366222
log = yes log_console = no log_file = /etc/dhcpy6d.log
valid_lifetime = 7200 server_preference = 255 store_config = mysql store_volatile = mysql store_db_host = 127.0.0.1
store_db_db = dhcpy6d store_db_user = root store_db_password = 123456
[address_default] category = random pattern = 5555:aaaa::$random64$
[prefix_default] category = range range = 1000-2000 pattern = 5555:bbbb:$range$:: length = 64
[class_default] advertise = addresses prefixes
[class_fixed_address]
the dhcpy6d.log print the same log. “798 dhcpy6d WARNING REPLY | no addresses or prefixes available | transaction: 29a60c | client_llip: fe80:0000:0000:0000:d5c4:4fb2:f20b:65be”
Could you give me an example dhcpy6d.conf , I want use prefix assign IPv6 address, instead of "address_default" assign IPv6 address for unknow client . Thanks!
How would you identify your clients? By MAC or hostname or DUID?
By MAC
So for example if you define your clients in a file you need an extra entry in the [dhcpy6d] section:
store_file_config = /path/to/dhcpy6d/clients.conf
In this file every section will define a client like described in https://github.com/HenriWahl/dhcpy6d/blob/master/doc/dhcpy6d-clients.conf.rst :
[client1]
class=good-client
mac=00:01:02:03:04:05
In your dhcpy6d.conf
file you will have to define the appropriate prefix and class:
[prefix_client]
category = range
range = 1000-2000
pattern = 5555:bbbb:$range$::
length = 64
[class_good-client]
advertise = prefixes
prefixes = client
If I do not know client's MAC, hostname or DUID, I want to use prefix assign IPv6 address for unknow client. Can this project achieve this function?
Do you want to assign a prefix or an address? Both should be possible vie the [class_default]
.
Like this ? [address_default] category = random pattern = 5555:aaaa::$random64$
[prefix_default] category = range range = 1000-2000 pattern = 5555:bbbb:$range$:: length = 64
[class_default] advertise = addresses prefixes
the dhcpy6d.log print the same log. “798 dhcpy6d WARNING REPLY | no addresses or prefixes available | transaction: 29a60c | client_llip: fe80:0000:0000:0000:d5c4:4fb2:f20b:65be”
Give me some time, I will try this config.
BTW - which version of dhcpy6d do you check on what platform?
Even more interesting: what is the client you use? I found that for example dhcpcd in Linux uses MULTIPLE transaction IDs (one for SOLICIT and a different one for REQUEST) which causes exactly the effect you describe. The only cure is to enable rapid commit at the client so it only uses one transaction ID.
OK, these are my results so far:
the client I used for testing, dhcpcd, needs rapid commit enabled to avoid multiple transaction IDs
this config works for me:
[dhcpy6d]
really_do_it = yes
interface = enp0s8
serverduid = 0001000134824528134567366121
store_volatile = mysql
store_db_host = 127.0.0.1
store_db_db = dhcpy6d
store_db_user = dhcpy6d
store_db_password = dhcpy6d
log = yes
log_console = yes
log_file = /dhcpy6d/dhcpy6d.log
log_mac_llip = yes
cache_mac_llip = yes
identification = mac
[address_default]
category = random
pattern = 5555:aaaa::$random64$
[prefix_default]
category = range
range = 1000-2000
pattern = 5555:bbbb:$range$::
length = 64
[class_default]
advertise = addresses prefixes
addresses = default
prefixes = default
nameserver = fd00::1
2020-06-08 23:08:47,301 dhcpy6d INFO SOLICIT | transaction: fdeaec | answer: normal | client_llip: fe80:0000:0000:0000:0a00:27ff:fea8:6b72 | counter: 1 | dns_s: 1 | duid: 000476e76286ac944ce59954b52dc15478c9 | fqdn: dhcpy6d-client1 | hostname: dhcpy6d-client1 | ia_options: [3, 25] | iaid: 0154eb16 | interface: enp0s8 | last_message_received_type: 1 | mac: 08:00:27:a8:6b:72 | options_request: [23, 24, 31, 39, 82, 83] | rapid_commit: True | vendor_class_data: dhcpcd-7.1.0:Linux-4.19.0-6-amd64:x86_64:GenuineIntel | vendor_class_en: 40712
2020-06-08 23:08:47,317 dhcpy6d INFO REPLY | transaction: fdeaec | options: [3, 7, 14, 23, 24, 25, 31, 39] | addresses: 5555:aaaa:0000:0000:cb54:1237:562a:036a | client_class: default_enp0s8 | hostname: dhcpy6d-client1 | prefixes: 5555:bbbb:1000:0000:0000:0000:0000:0000/64
I use version of dhcpy6d is github master branch with your config, server is ubuntu18.04 and client is ubuntu18.04/16.04. I use this shell (sudo dhclient -6 -d eth0) to get IPv6 address. the log does not include "prefixes: 5555:bbbb:1000:0000:0000:0000:0000:0000/64".
2020-06-09 21:16:52,478 dhcpy6d INFO SOLICIT | transaction: cebe08 | addresses: 5555:aaaa:0000:0000:9d8e:f47a:2777:07dd | answer: normal | client_llip: fe80:0000:0000:0000:d5c4:4fb2:f20b:65be | counter: 1 | duid: 00010001266e40a974d435eaad60 | ia_options: [3] | iaid: 35eaad60 | interface: enp3s0 | last_message_received_type: 1 | mac: 74:d4:35:ea:ad:60 | options_request: [23, 24, 39, 31] 2020-06-09 21:16:52,480 dhcpy6d INFO ADVERTISE | transaction: cebe08 | options: [3, 7, 23, 24, 31, 39] | addresses: 5555:aaaa:0000:0000:9d8e:f47a:2777:07dd | client_class: default_enp3s0 2020-06-09 21:16:52,506 dhcpy6d INFO REPLY | transaction: 57392f | options: [3, 7, 23, 24, 31, 39] | addresses: 5555:aaaa:0000:0000:9d8e:f47a:2777:07dd | client_class: default_enp3s0
You have to configure dhclient to ask for prefix which is option 25 - right now it asks only for address, option 3:
2020-06-09 21:16:52,478 dhcpy6d INFO SOLICIT | transaction: cebe08 | addresses: 5555:aaaa:0000:0000:9d8e:f47a:2777:07dd | answer: normal | client_llip: fe80:0000:0000:0000:d5c4:4fb2:f20b:65be | counter: 1 | duid: 00010001266e40a974d435eaad60 | ia_options: [3] | iaid: 35eaad60 | interface: enp3s0 | last_message_received_type: 1 | mac: 74:d4:35:ea:ad:60 | options_request: [23, 24, 39, 31]
OK, I get the prefix, Thank you very much.
Great! So I'll close this issue now.
I use dhcpy6d.conf :
[address_default] category = random pattern = 5555:aaaa::$random64$
[prefix_default] category = range range = 1000-2000 pattern = 5555:bbbb:$range$:: length = 64
[class_defult] advertise = address prefixes
client get IPv6 address is "5555:aaaa::fbd6:409c:2202:80d/128 Scope:Global", the prefix does not take effect. I want to know how to use prefix for unknow client ?