能登地震で被災された皆様、お見舞い申し上げます。日本気象協会の地震情報への直リンクです。
PR

FreeBSD DHCP Service IPv6

FreeBSD
記事内に広告が含まれています。

The original Japanese version is available here.

This is a train station nameplate taken during a visit to a Danish SI company as part of internal training. Many Danish train stations consist only of a building that looks like an extra, and most are unmanned. There are no high-speed trains like Japan’s Shinkansen, so you can relax and enjoy the leisurely journey. The weather is not as clear as in Japan, and there are often low-hanging clouds that allow the sun to peek through, giving the impression of the wintery Hokuriku region in Japan, except during the peak summer season. Also, there are no real mountains in Denmark, with the highest point only reaching 170m, so it seems like the same scenery continues endlessly no matter how far you go. It might be good for contemplation. 🙂


Continuing from the previous article, this time I would like to try running ISC DHCPv6. In order to investigate things like Router Solicitation and Router Advertisement used by the IPv6 rental router we use at home, it is common practice to read the relevant RFC when you want to research this kind of information. All vendors need to comply with the relevant RFCs when creating network equipment. Otherwise, their equipment cannot be interoperable with other vendors’ equipment. However, there are often cases where the expressions used are not 100% conclusive, and subtle differences in the interpretation by the person implementing the function can cause confusion. So, I looked at the relevant RFCs, and in particular, the RFC related to the M bit and O bit of RA related to DHCPv6 is described in section 4.2 of RFC4861. Quoting a part of it,…

 M              1-bit "Managed address configuration" flag.  When
                     set, it indicates that addresses are available via
                     Dynamic Host Configuration Protocol [DHCPv6].

                     If the M flag is set, the O flag is redundant and
                     can be ignored because DHCPv6 will return all
                     available configuration information.
 O              1-bit "Other configuration" flag.  When set, it
                     indicates that other configuration information is
                     available via DHCPv6.  Examples of such information
                     are DNS-related information or information on other
                     servers within the network.

        Note: If neither M nor O flags are set, this indicates that no
        information is available via DHCPv6.

It says that if the M bit is set, the IPv6 address can be obtained from DHCPv6, and if the O bit is set, information other than the IPv6 address, such as DNS-related addresses and other server-related addresses in the network, can be obtained from DHCPv6. As a note, if neither bit is set, DHCPv6 cannot be used, and in another note, if the M bit is set, the O bit can be ignored, because all necessary information can be obtained from DHCPv6. Therefore, to be able to use all the functions of DHCPv6, at least the M bit must be on, and according to a faithful interpretation of the wording, it seems that the O bit must also be on. So, when I looked at my home’s IPv6 router’s RA with Wireshark, it looked like this.

I captured a screenshot on my Win 11 VM host while my Win10 VM guest was running.

The M bit is not set and the O bit is set, so the IPv6 address and IPv6 G/W address are obtained from the IPv6 router, which is calculated from the IPv6 prefix obtained from the router and the own MAC address, and the router’s address obtained from this information is used as the G/W address. In other words, it can be read that assigning IPv6 addresses or G/W addresses with DHCPv6 is not possible. Fortunately, the problem lies in the IPv6 address of the DNS, which can be handled with DHCPv6. Let’s write the DHCPv6 configuration file right away. Customize the example configuration for a home network with the DHCPv6 server directly connected to the network according to your own policies. It doesn’t seem like addresses will be assigned from this pool according to the RFC, but create it so that the DHCPv6 daemon does not stop running.

Looking at the startup script, it says to set “dhcpd_enable” to YES. It seems to already be set to YES. Yes, it appears to be the same as DHCP for IPv4.

Let’s try starting it. Oh, wait, we were tricked 🙁 The error message says that we need to set “dhcpd6_enable”, so let’s set it accordingly.

bug ??

And when I tried to start it, some errors occurred. By the way, I changed the location of the database file to the same directory as IPv4 for the same purpose, so I moved it from /var/db/dhcpd6.leases to /var/db/dhcpd/dhcpd6.leases.

I was scolded for the file not being there. I will take measures to calm the anger.

Create an empty file and change the ownership to dhcpd/dhcpd to appease the angry message. Now, let’s try to start it again.

It seems to have worked smoothly.

The next step is to rewrite the DNS-related information.

Following the example of IPv4 DNS, specify the IPv6 addresses of the server dhcp and the server pokemon. By the way, it did not accept link-local addresses, so it seems that global addresses are required. Let’s also change the search domain name for IPv6. That’s about all we can change. After that, let’s restart and see.

In IPv4 DHCP, the failover function could be used, but the same function cannot be used in IPv6 DHCP. According to the manual, redundancy can be achieved by changing the value of dhcpv6.preference. The default value is 0, but 255 is the highest priority. So, I want to use 255 for the DHCPv6 service on the server dhcp and 0 for the DHCPv6 service on the server package as a backup server as described in the manual. Although the manual level states that the same address range can be used, it feels uncomfortable, so I specified a different address range in the server package.

Now, with only the O bit of RA turned on, I started two DHCPv6 servers and tried to get an address with a Windows 10 client.

予想通り、IPv6 アドレス ( Global および Temporary )、とゲートウェイアドレスは DHCPv6 サーバの有無にかかわらず同じアドレスが使われていることが確認できます。一方、DNS アドレスは dhcp さんと pokemon さんの IPv6 アドレスになりました。一応動作確認を行っておきます。

As expected, the IPv6 addresses (global and temporary) and the gateway address are the same regardless of the presence of the DHCPv6 server, while the DNS addresses are set to the IPv6 addresses of the server dhcp and pokemon. I will perform a test to confirm everything is working properly.

I am now able to perform name resolution for the home domain without any stress.

There are four combinations of the M and O bits in RA: 11, 10, 01, and 00. Based on my reading of the RFC, to use the DHCPv6 address pool, the value should be 1[10]. However, many home IPv6 routers have an implementation status of 01, as they assume that users will not set up a DHCP or DHCPv6 server at home and instead provide a simple plug-and-play router for amateurs. I tested the case where the value was 01, but the RFC mentions the case where the value is 00, and DHCPv6 cannot be used, meaning that IPv6 address-related settings need to be configured manually. According to RFC 8106 on the latest RA messages, DNS addresses can also be included. Since DNS addresses were set on my home IPv6 router, it is likely that it complies with this RFC. So, as long as there is no malfunction, it should be possible to surf the Internet using IPv6 without any problems. However, for companies, it is advisable to use routers or firewalls with a value of 1[10] to manage address distribution, etc., under the control of IT. If I have some time, I would like to conduct experiments for the 11 and 10 cases, of course, in a separate article 🙂


This is a local train of the national railway departing from Copenhagen Central Station. Its construction is solid and it looks much sturdier compared to the trains of JR in Japan.

When I visited, it was the Halloween celebration season, and Tivoli Gardens was filled with pumpkins.

I have had many opportunities to visit Denmark, and at first, I used taxis for transportation, but eventually, I was told to use trains, and I think this is the first ticket I bought from a vending machine. Later, I was able to purchase tickets anytime using an iPhone application. This is unrelated to trains, but vending machines for tickets can also accept cards, but this vending machine is tricky and does not accept cards. I remember trying to insert my card about 10 times because I didn’t have any cash on hand. I think Japanese vending machines are the best in the world 🙂

Outside of Copenhagen Central Station, there are many cute stations like this. Some of them don’t even have a station building or ticket machines, so it’s necessary to have a mobile app to purchase tickets even after boarding the train. In cases where tickets can’t be purchased at the station, it’s usually possible to buy them at nearby places like bakeries next to the stations.

When walking around the streets of Copenhagen, there are many shops that offer Asian flavors like this. While it’s nice, the problem is that the taste is not necessarily tailored to Japanese people. For example, this shop serves Korean and Japanese cuisine, but the owner is often Chinese 🙂 Oh well…

My two-week business trip has come to the end. On the way back, I have decided to stop by the usual Starbucks at the airport 🙂

[[[[[ During writing of this article, very unfortunate news came in. In Nara Prefecture, just one mountain over from Osaka where I live, former Prime Minister Shinzo Abe was shot by a criminal while giving a campaign speech and passed away after receiving intensive urgent care and surgery. He was one of my favorite politicians, so it is extremely regrettable. I offer my heartfelt condolences.]]]]]

Advertisement below


コメント