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

FreeBSD DHCP Service IPv4

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

The original Japanese version is available here.

I flew to Manchester Airport for an internal meeting. The office is about an hour’s cab ride from here in a rural, excuse me, in scenic area. Seems like a good place for an R&D team 🙂


Mu :(( Dead again. the DHCP service on the rental router I rent from my ISP is frequently dying, and it won’t lease addresses. I have not configured any additional settings, or rather, I cannot configure any additional settings 🙂 So, I was forced to start up home DHCP service.

The machine I will use is the 32-bit antique physical machine I mentioned in my previous article, which will not stop on its own due to Windows Update. I have installed the minimal packages and ISC DHCP which I want to use as a DHCP service on dhcp. As you may have noticed, BIND918 is also made by ISC. It looks like this.

Service-wise, one daemon is provided, and it works with either IPv4 or IPv6 with or without the -6 option. Configuration-wise, there seems to be one file for each protocol, two files totally.

dhcpd.conf for IPv4, dhcpd6.conf for IPv6.

I would like to start with the configuration for IPv4. When we edit dhcpd.conf file, we see various configuration examples. For now, we need to configure a simple single network segment, so we comment out all those examples. Notes after # will be treated as comments. Then, add a new network. It looks like this.

Since this is exactly the same as the first example in dhcpd.conf, except for the address range, nothing will happen to the network. So, let’s add the necessary DHCP options to create a range of addresses within 192.168.0.0/24. For now, let’s assign addresses from 192.168.0.100 to 192.168.0.200 to the dhcp pool.

This means that only addresses will be leased, so for now, let’s make sure that the necessary DNS, domain name, and default gateway can be assigned together. In a previous article, we decided to use pokemon to be the secondary DNS.

There are many DHCP options, but the IPv4 settings you need for your current home network and for net surfing should be OK. Let’s install Windows 10 on vmware player so we can use this DHCP server. I will skip the installation of Windows 10 part because it is not interesting. m(_ _)m (Yep, it is not interesting, so I will try to use iPXE so that it can be installed with a single F12 keystroke in another article ). First, here is the address leased from the home router’s DHCP service.

Start DHCP service on FreeBSD, then return this IP address on Windows, and stop the DHCP service on the home router. Then, try to renew the IP address on Windows. First, start the DHCP service.

After returning the current address to the home router’s DHCP service with the ipconfig command, I stop the home router’s DHCP service. I then used ipconfig /renew to get new IP address.

All messages in ipconfig /all.

IPv4 and IPv6 are mixed, so I tried disabling IPv6. The domain name home.jf3vqb.net is specified, the first address specified in the range of the dhcp pool is leased, dhcp and pokemon are specified in this order for DNS service, the gateway is 192.168.0.1, the lease time is 10 minutes and the DHCP server address is 192.168.0.250. Everything is working as expected.

Next, I thought I would test IPv6 DHCP, but after turning off DHCP on my ISP’s home router and restarting Windows VM, the IPv6 address was still there. I can’t test DHCP for IPv6 until I verify the integrity of the Router Advertisement message from the home router. This will take some time and will be an experiment for a future article. So, I would like to provide only IPv4 DHCP service from FreeBSD. I will get complaints from everyone in my house when the IPv4 network goes down, IPv6 outages should not have a major impact on normal net browsing in the worst case, so I think It is OK with that for now. I would like to add the necessary IPv4 options and switch the DHCP service. This is how it looks for now.

As I think I mentioned in a previous article, I want to have redundant DHCP services as well. In fact, ISC DHCP supports failover configuration. Assuming that you use dhcp for primary and package for secondary, you can define fail over peers in the dhcpd.conf file to specify which pools to cover each other. It looks like this. The description of each option can be found here.

In addition, logs are output to syslog local7, so configure syslogd accordingly. It looks like this

Finally, since this log is only going to grow, we will periodically compress it and delete anything that is too old. Of course, we do the same on package too.

First, restart the primary server.

It will then wait for the secondary server to come online. Now let’s restart the secondary.

When both servers are online, the message “Both servers normal” is displayed, and the dhcp database of the pool where failover is defined is split and managed by two servers, working in load balance when both are online, the surviving one manages the entire pool. When the dead server comes back online, the databases in the pool are re-synchronized and load-balanced again.

For now, IPv4 DHCP is OK, but the current problem is that DHCP clients with IPv6 enabled cannot use DNS to resolve addresses of machines in the home.jf3vqb.net domain. Because the IPv6 DNS listed at the top of DNS points to the ISP’s rental router. Even if I increase the OS IPv4 priority, ping dns.google etc. will use IPv4 addresses, but DNS still uses IPv6 DNS 🙁 For now, Windows OS get IP address from the SAMBA master browser. So I don’t think it is a problem because I am the only one who lookup DNS resources of devices in my home. Please do something about it, because the fee is not free 🙁


Now, this is the closest downtown to our office. Do you know where it is?

I stayed at an inn right next to Manchester airport due to my departure flight on my return trip. Has anyone stayed in the same room before ?

It is a round window with this key. Was it inspired by a ship? While it is next to the airport….

Now for a quiz. There is a faucet with hot water and a faucet with cold water separately. How can you wash your hands and gargle with warm water?

I would like to say again. It is not a rural area. It is a scenic town 🙂

I would like to try IPv6 DHCP and some trial DHCP settings for use in a larger network environment in the future article.

Advertisement below.


コメント