Tag Archives: dhcp

How to Configure DHCP for Multiple VLANs?

Almost every device connected to the Internet needs an IP address. Previously, the countless IP addresses are assigned manually, which costs a lot of time and energy. As DHCP emerges, IT specialists are not required any longer to spend countless hours providing IPs for every device connected to the network device. But what is DHCP?How does it work and how to configure DHCP for multiple VLANs?
What Is DHCP?
DHCP – Dynamic Host Configuration Protocol is a network management protocol used on TCP/IP network. There may be at least a DHCP server and many DHCP clients. The DHCP server allows the client to request the IP addresses and other network configurations from the Internet service provider. This process eliminates the need for administrators or users to assign IP address to network devices one by one. Using this protocol, the network administrators will just set up the DHCP server with all the additional network information, and it will do its work dynamically. Both network switch and router can be configured as a DHCP server.
How Does the DHCP Process Look Like?
For the DHCP client that hasn’t accessed the Internet before, it will undergo 4 phases to connect the DHCP server.

Fig 1. DHCP process
1.Discover
DHCP client after being activated will first send a broadcast message to try to look for DHCP servers. In this way, the client request IP address from the DHCP server.
2.Offer
When the DHCP server gets the message from the client, it looks in its pool to find an IP address it can lease out to the client. It then adds the MAC address information of the client and the IP address it will lease out to the ARP table. When this is done, the server sends this information to the client as a DHCPOFFER message.
3.Selection
DHCP client chooses IP address. There may be several DHCP servers sending DHCP-Offer packet, the client only receives the first DHCP-Offer then sends back DHCP-Request packet in broadcast mode to all DHCP servers to request more information on the IP address lease time and verification. The packet includes the contents of the IP address requested from the selected DHCP server.
4.Acknowledge
When the DHCP server receives a DHCP-Request packet from the DHCP client, it confirms the lease and creates a new ARP mapping with the IP address it assigned to the client and the client’s MAC address. And then send this message as a unicast to the client as a DHCPACK.
How to Configure DHCP for Multiple VLANs?
The theory cannot be well digested unless it is combined with the practice. In this section, how to configure DHCP for multiple VLANs is introduced for your reference. Take the following picture as an example.

Fig 2. DHCP Configuration for Multiple VLANs
PC1 and PC2 are connected to access port of VLAN switch 1 with VLAN ID 100 and 200.
The DHCP server was supposed to serve both the VLANs.
Command to enable multiple VLANs.

Command to enable DHCP.

Add both subnets.

Run DHCP server.

Now make PC1 and PC2 as DHCP client. Both should be able to get IP address from DHCP server in their respective VLAN.
Conclusion
How to configure DHCP for multiple VLANs?This issue has been illustrated in the above content. DHCP configuration is worthy of being learned by those who are engaged in fiber optic communication field. You just need to know “How”, and let FS provide you with the best network devices. Ethernet switch like gigabit Ethernet switch and 10gbe switch, and routers are available in FS.

Solutions to problems encountered when installing isc-dhcp-server on debian9.6

To set up a DHCP server, I encountered a problem during the installation:

guoyanzhang@bogon:~$ sudo apt-get install isc-dhcp-server-ldap
Reading the package list... Finished.
Dependency tree of the package being analyzed       
Reading status information... Done.       
The following software will be installed at the same time.
  isc-dhcp-server
The following [new] packages will be installed.
  isc-dhcp-server isc-dhcp-server-ldap
0 packages upgraded, 2 new packages installed, 0 packages to uninstall, 7 packages not upgraded.
0 B/955 kB of archives to download.
Decompression consumes 2,366 kB of extra space.
Do you wish to proceed? [Y/n] y
Predefined packages ...
Unselected package isc-dhcp-server is being selected.
(Reading the database ... The system currently has 169038 files and directories installed.)
Preparing to unpack ... /isc-dhcp-server_4.3.5-3+deb9u1_amd64.deb ...
Unpacking isc-dhcp-server (4.3.5-3+deb9u1) ...
Unselected package isc-dhcp-server-ldap is being selected.
Preparing to unpack ... /isc-dhcp-server-ldap_4.3.5-3+deb9u1_amd64.deb ...
isc-dhcp-server-ldap being added causes /usr/sbin/dhcpd to move to /usr/sbin/dhcpd-noldap
Unpacking isc-dhcp-server-ldap (4.3.5-3+deb9u1) ...
Working with triggers for systemd (232-25+deb9u6) ...
Processing triggers for man-db (2.7.6.1-2) ...
isc-dhcp-server (4.3.5-3+deb9u1) is being set up ...
Generating /etc/default/isc-dhcp-server...
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-01-09 11:52:37 CST; 12ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2169 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

1月 09 11:52:35 bogon dhcpd[2180]: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
1月 09 11:52:35 bogon dhcpd[2180]: irs_resconf_load failed: 59.
1月 09 11:52:35 bogon dhcpd[2180]: Unable to set resolver from resolv.conf; startup continuing but DDNS support may be affected
1月 09 11:52:35 bogon dhcpd[2180]: Wrote 0 leases to leases file.
1月 09 11:52:37 bogon isc-dhcp-server[2169]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
1月 09 11:52:37 bogon isc-dhcp-server[2169]:  failed!
1月 09 11:52:37 bogon systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
1月 09 11:52:37 bogon systemd[1]: Failed to start LSB: DHCP server.
1月 09 11:52:37 bogon systemd[1]: isc-dhcp-server.service: Unit entered failed state.
1月 09 11:52:37 bogon systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
isc-dhcp-server-ldap (4.3.5-3+deb9u1) is being set up ...
Processing triggers for systemd (232-25+deb9u6) ...

Key words:
irs_resconf_load failed: 59.
Unable to set resolver from resolv.conf; startup
Check out my resolv.conf and find:

guoyanzhang@bogon:/etc/network$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver fe80::1%wlp8s0
nameserver 192.168.1.1

The first nameserver looks like a nameserver and has been modified as follows:

guoyanzhang@bogon:/etc/network$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

The reason is that this file was not configured in debian system at the beginning. This file was generated after I successfully installed it on the Internet. Now delete ISC-DHCP-Server and install it like this:

guoyanzhang@bogon:~$ sudo apt-get install isc-dhcp-server
Reading the package list... Finished.
Dependency tree of the package being analyzed       
Reading status information... Done.       
Recommended installation.
  isc-dhcp-server-ldap
The following [new] packages will be installed.
  isc-dhcp-server
0 packages upgraded, 1 new package installed, 0 packages to uninstall, 7 packages not upgraded.
An archive of 0 B/526 kB needs to be downloaded.
Unpacking consumes 1,425 kB of extra space.
Package is being preset ...
The unselected package isc-dhcp-server is being selected.
(Reading the database ... The system currently has 169038 files and directories installed.)
Preparing to unpack ... /isc-dhcp-server_4.3.5-3+deb9u1_amd64.deb ...
Unpacking isc-dhcp-server (4.3.5-3+deb9u1) ...
Working on a trigger for systemd (232-25+deb9u6) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up isc-dhcp-server (4.3.5-3+deb9u1) ...
Generating /etc/default/isc-dhcp-server ...
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-01-09 12:45:19 CST; 5ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6137 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

Jan 09 12:45:17 bogon systemd[1]: Starting LSB: DHCP server...
Jan 09 12:45:17 bogon isc-dhcp-server[6137]: Launching both IPv4 and IPv6 servers (please configure…her).
Jan 09 12:45:17 bogon dhcpd[6148]: Wrote 0 leases to leases file.
Jan 09 12:45:19 bogon isc-dhcp-server[6137]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diag…iled!
Jan 09 12:45:19 bogon isc-dhcp-server[6137]:  failed!
Jan 09 12:45:19 bogon systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Jan 09 12:45:19 bogon systemd[1]: Failed to start LSB: DHCP server.
Jan 09 12:45:19 bogon systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Jan 09 12:45:19 bogon systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
Processing triggers for systemd (232-25+deb9u6) ...