0

I have the following lab:

DHCP SERVER [Centos 6]

/etc/dhcp/dhcpd6.conf

default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;
option dhcp6.info-refresh-time 21600;


dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";

subnet6 3ffe:501:ffff:100::/64 {
}

host ipv6host {
    hardware ethernet 53:54:00:70:1d:ed;
    fixed-address6 3ffe:501:ffff:100::222;
    if packet(0,1) = 1 { log(debug,"Request match!"); }
}

# ip -6 addr show
5: eth1.30@if3: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500
    inet6 3ffe:501:ffff:100::4/64 scope global 
       valid_lft forever preferred_lft forever

In the client there is no special configuration. Then, running the dhcp server, I get the following output:

Internet Systems Consortium DHCP Server 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in         the config file
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Bound to *:547
Listening on Socket/5/eth1.30/3ffe:501:ffff:100::/64
Sending on   Socket/5/eth1.30/3ffe:501:ffff:100::/64

Solicit message from fe80::5054:ff:fe70:1ded port 546, transaction ID 0xDF54D000
Request match!
Request match!
Sending Advertise to fe80::5054:ff:fe70:1ded port 546
Solicit message from fe80::5054:ff:fe70:1ded port 546, transaction ID 0xDF54D000
Request match!
Request match!
Sending Advertise to fe80::5054:ff:fe70:1ded port 546
... and more

On the client, I get the following out running the client:

dhclient -6 -d  eth1
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Bound to *:546
Listening on Socket/eth1
Sending on   Socket/eth1
PRC: Soliciting for leases (INIT).
XMT: Forming Solicit, 0 ms elapsed.
XMT:  X-- IA_NA 00:70:1d:ed
XMT:  | X-- Request renew in  +3600
XMT:  | X-- Request rebind in +5400
XMT: Solicit on eth1, interval 1010ms.
XMT: Forming Solicit, 1010 ms elapsed.
XMT:  X-- IA_NA 00:70:1d:ed
XMT:  | X-- Request renew in  +3600
XMT:  | X-- Request rebind in +5400
XMT: Solicit on eth1, interval 2070ms.    

As you can see, seems that server gets the request from the client and matches the host entry. that I don't know is why the client does not get the IP.

Note: the client is a vm and in the hypervisor the vnic is connected to a bridge with the eth1.30. The traffic it's ok between the nodes.

2
  • 1
    Note: Please stop using 6bone addresses (those starting with 3ffe:). The 6bone got decommissioned in 2006. Jun 6, 2013 at 17:28
  • Also, 6bone addresses are null routed by default. So you can't use then at all. Use a valid IPv6 prefix. Jun 6, 2013 at 19:26

3 Answers 3

2

Solved!

The problem was the ip6tables. The default rules block the Advertise from the DHCP Server.

service ip6tables stop

Would fix the issue. Take a look on the comments of the other answers because seems that the range I used are not ok.

IMPORTANT. At least with 2 Centos 6 boxes (server and client) assigning the ip using MAC address works fine.

source: http://www.redhat.com/archives/anaconda-devel-list/2010-November/msg00172.html

0

In DHCPv6 the clients aren't identified anymore with their MAC address but with a DUID (which is the same for all interfaces of the client, so in theory it is easier to identify the client). Because of this you also should put the host definition inside the subnet block. The system might have different addresses based on the interface and DUID combination. This is the example from the Linux IPv6 how-to:

default-lease-time 600;
max-lease-time 7200; 
log-facility local7; 
subnet6 2001:db8:0:1::/64 {
    # Range for clients
    range6 2001:db8:0:1::129 2001:db8:0:1::254;

    # Range for clients requesting a temporary address
    range6 2001:db8:0:1::/64 temporary;

    # Additional options
    option dhcp6.name-servers 2001:4860:4860::8888;
    option dhcp6.domain-search "domain.example";

    # Prefix range for delegation to sub-routers
    prefix6 2001:db8:0:100:: 2001:db8:0:f00:: /56;

    # Example for a fixed host address
    host specialclient {
        host-identifier option dhcp6.client-id 00:01:00:01:4a:1f:ba:e3:60:b9:1f:01:23:45;
        fixed-address6 2001:db8:0:1::127;
    } 
}

You can get the DUID of a client from the server logs, or you can extract it from the client. This is an example to parse the file that dhcp6c creates to store the generated DUID:

hexdump -e '"%07.7_ax " 1/2 "%04x" " " 14/1 "%02x:" "\n"' /var/lib/dhcpv6/dhcp6c_duid

All examples are based on those from the how-to.

2
  • Thinking on a cloud/virtualized env, how can I assign an ip to a host if the DUID depends of the vm and I can't know that until the vm booted?
    – Seoman
    Jun 6, 2013 at 20:35
  • Seoman: you basically can't if you follow the specs. The DUID is generated the first time it is needed, so it might not even exist until you boot for the first time. Jun 6, 2013 at 23:08
0

Ubuntu 20.04 LTS
Disable ip6tables is not a good idea, instead I add a bypass for DHCPv6.

ipif=$(ip link show | awk -F':' ' $2 ~  /^[ ]+e.+[0-9]/ { sub(/^[ \t]+/, "",$2); print $2;  }')
sudo ip6tables -I INPUT -i ${ipif} -p udp --dport 546 -s fe80::/64 -m conntrack --ctstate NEW -m udp -j ACCEPT -m comment --comment dhcp6

In case it doesn't work for dockers, you may wanna remove or modify -s fe80::/64.


Acquire IPv6 address manually dhclient -v -6.
Check the log journalctl -u systemd-networkd -n 10 -f, it might be looking like this.

Feb 18 01:46:29 instance-20210522-2329 systemd-networkd[618]: ens3: IPv6 successfully enabled
Feb 18 01:46:29 instance-20210522-2329 systemd-networkd[618]: ens3: DHCPv4 address 10.0.0.186/24 via 10.0.0.1
May 04 17:45:17 instance-20210522-2329 systemd-networkd[618]: ens3: DHCPv6 address 2603:xxxx:3:xxxx:9d18:xxxx:xxxx:56ee/128 timeout preferred 7200 valid 7500
May 04 19:49:40 instance-20210522-2329 systemd-networkd[618]: ens3: DHCPv6 lease lost
May 06 08:41:40 instance-20210810-1242 systemd-networkd[618]: ens3: DHCPv6 address 2603:xxxx:3:xxxx:9d18:xxxx:xxxx:56ee/128 timeout preferred 7200 valid 7500

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .