Follow by Email

Blog Archive

Search This Blog

Setup DHCP server on Raspberry Pi

RaspberryPi DHCP server setup Set IP address range Set subnet mask and default gateway Set DNS server Set lease time ISC DHCP server DNSMASQ ISC DHCP server or DNSMASQ?
Share it:
Setup DHCP server on Raspberry Pi

In a network, a DHCP server manages the IP addresses and distributes the IP configuration. An IPv4 configuration includes one IPv4 address, the subnet mask, and the default gateway and DNS server IPv4 addresses. This configuration is communicated to the requesting host along with the lease time from the DHCP server. The lease time indicates how long the IP configuration is valid and can be used.

Preparing to operate a DHCP server
Before it goes to install and configure the DHCP configuration must be set. Required are IPv4 address range, subnet mask, IPv4 address of standard gateway and DNS server.

Basically, it is recommended to operate the DHCP server with a static / fixed IPv4 address.
Before it goes to install and configure the DHCP configuration must be set. Required are IPv4 address range, subnet mask, IPv4 address of standard gateway and DNS server.

Set IP address range
First, the address range must be specified from which the DHCP server is allowed to distribute the addresses. If a DHCP server already distributes the same address range, then you have to take care that the two DHCP servers do not distribute the same address ranges. There must be no overlap here. Otherwise, an IP address may be used twice, resulting in strange network errors.
If you do not know how to divide the address ranges, then you should keep your hands off setting up a second DHCP server. Incorrect settings lead to disturbances in the network.

Set subnet mask and default gateway
The subnet mask and the IP address of the standard gateway are obtained from the existing installation. For this you have to determine the IP configuration on a client.
Set DNS server
The default gateway and DNS server IPv4 addresses are usually the same on a local network. The IPv4 address of the DNS server is therefore the IPv4 address of the Internet access router.
In some IPv4 configurations, the IPv4 address "8.8.8.8" for the DNS server can be found from time to time. It is the IPv4 address of an open DNS server operated by Google. This is of course very convenient. The only question is whether it makes sense to send out DNS name resolutions from the local network to Google. If Google has got its own IPv4 address through search queries, then Google also knows which websites you visit otherwise. The question is, do you really want that?
From a technical point of view, it makes no difference whether you use the Google DNS server or your own local network. For privacy reasons, you should always use your own DNS server. The address is usually that of the standard gateway. There is a lot to be said to use exactly this address and no DNS server outside the local network.

Set lease time
Then you have to set the lease time. It indicates the validity of an address allocation. Before the lease time expires, the client must report to the DHCP server so that it can continue to keep the assigned address. If he does not, the DHCP server may assign the IP address otherwise.

Which value makes sense for the lease-time? In a home network, where new computers are rarely added, the lease time can be several days. In networks with frequently changing clients and a limited supply of IP addresses, you can reduce the lease time to just a few hours. Then non-renewed addresses are freed faster and can be assigned to new clients.

ISC DHCP server
There are several DHCP servers for Linux. The DHCP server of ISC is the most common and powerful DHCP server. At the same time, it is comparatively easy to configure.
DNSMASQ
"dnsmasq" is a very versatile daemon. In addition to being a DHCP server, it can also be used to provide DNS services and IPv6 router advertisements.
ISC DHCP server or DNSMASQ daemon?
The ISC DHCP server is a very powerful tool for DHCP. For a small local network, it is by far oversized. There is nothing wrong with using it, as it is relatively easy to configure.
The "dnsmasq" is more preferable for "small tasks". It is a bit easier to use and has the advantage that it also brings the DNS server. Interestingly, if you want to run Raspberry Pi as a router with DHCP and DNS server.
Share it:

Raspberry Pi

Post A Comment:

0 comments: