Tutorials

▷ How to install and configure a dhcp server in windows server 2016

Table of contents:

Anonim

Installing a DHCP server in Windows Server 2016 is very important and almost necessary to facilitate the management of computers connected to an Active Directory domain. Thanks to the implementation of this role on a server, we will be able to dynamically assign IP addresses to the computers that are within a network, totally isolated from the main gateway.

Index of contents

The Microsoft server operating system allows us, among other things, to carry out these actions. Surely if we are at home, the DHCP server is our own router, we are connected to it, and it is responsible for providing the IP of our equipment. But we can also do these functions with an operating system like this. This is precisely what is done in large networks, in order to keep the Internet gateway isolated from the entire internal network, thanks to Firewall servers and other security solutions.

What is a DHCP server

DHCP stands for Dynamic Host Configuration Protocol or in Spanish, Dynamic Equipment Configuration Protocol.

This will allow us to assign IP addresses to the computers that connect directly to it. We can make our DHCP server have a range of IP addresses available to these computers that will be clients in the domain where we are working. In this way we can centrally manage these computers, in addition to Active Directory, also with their IP addresses.

Typically, computers on a corporate LAN will need to have a fixed IP address assigned. Since doing it team by team is somewhat tedious, the best thing is to have a server of this type in which we can manage all this type of configuration. Keep in mind that, in a network of this type, a router will not have enough capacity to carry out these tasks, in addition to that all the connection to the outside will be filtered through firewalls and servers.

Thanks to a DHCP server we can obtain the following information for a client computer belonging to the domain:

  • IP Address Subnet Mask Gateway DNS Name Resolution Service (Corresponding Role Installed)

Prerequisites and keep in mind

Before installing the DHCP Server role on Windows Server, it is necessary to configure it with a fixed IP, it does not make any sense that a server has a dynamic IP when working with this type of role. This will allow the server to never change its IP address in the event of a reboot, and we will also need to configure certain gateways for the WAN and LAN network adapters. In this way the client teams will always know what the address is and we will not have any problems.

In addition, in our case, we have used VirtualBox to carry out the entire implementation of our Windows Server 2016 server and the client computers of the domain. We will review the configuration of these machines to see the best way to create and separate a LAN network and the WAN network from the Internet. This will allow us, among other things, to adopt a role in our server for routing and linking computers with the internet, which is what is really done.

Configure network adapters in VirtualBox for DHCP server

Well, the first thing we are going to discuss is how to configure virtual network adapters to create our internal network copy of a company and the output of only one server to the internet. The procedure will be as follows.

With the machines turned off, we are going to go to one of the ones that we are going to use to connect to the Active Directory domain. We are going to select it and click on “ Configuration ”. Then we must go to the " Network " section to configure our network adapter as " Internal ". This way what it will do is allow only connections between virtual machines, at no time can we go to the Internet (for now) from them. Thus we are simulating a LAN network that connects to the internet through a server.

If we want, we can also give a name to this network.

Now we perform the same procedure for the server. But in this case, we will place a second adapter by clicking on " Adapter 2 ". Thus we will have the first configured as a bridge (WAN) and the other as an internal (LAN).

The result in configuration will then be the following:

Now we will have a computer system configured in which the clients will be connected to a domain server to request both credentials, IP address and DNS service.

Configure Windows Server 2016 network adapters

The next thing, and very important before we get fully into the configuration of the DHCP role, is to configure the network adapters correctly to create this relationship between each other regarding DNS, Domain and DHCP. Let's see then.

What we will do is open the tool run with " Windows + R " or from command prompt, and write:

ncpa.cpl

We will go directly to the section of Windows network adapters.

We will have the two adapters that we had configured in VirtualBox. It will be exactly the same when we have a computer with two physical network cards installed, so we will get the same functionality.

We will call one " INTERNET " which will be the bridge adapter, and the other " NETWORK LAN ", which will be the internal network.

To open the static IP configuration we will already know the procedure. Right click and select " properties -> Internet Protocol version 4 -> Properties ".

In the Internet adapter, we will have to know the IP of our router to set it as the default gateway. To do this, we should right click on the adapter and click on " Status -> Details... ". We look at the " Default Gateway " section. The resulting configuration in our case will be this.

We must also place the address of the router as a DNS server for this side of the WAN network.

Now we will see how the configuration of the adapter for the LAN is.

  • We have assigned an IP address of a different range to the adapter, we have a totally different network, and we can assign the IP that we want. The subnet mask has been placed in type C to obtain a broadcast of 255 addresses. If we had more computers in our internal network, we would put 255.255.0.0 to assign addresses from 192.168.0.1. until 192.168.254.254. Default gateway, for now we will leave it empty, because we do not need a gateway on this network. The server is the door itself. Preferred DNS, we will put the main IP address of our server (the one we have assigned in the INTERNET adapter. Why? Because because the DNS role is done by the server itself and its IP address is this.

Since we already have the DNS role installed on our server, we will place the same IP address that we give the server, such as DNS in the LAN adapter, so that it is itself the one that resolves the NETBIOS addresses of the internal domain.

Install DHCP in Windows Server 2016

Once this is done, we can start the DHCP server installation process in Windows Server 2016. First of all, we must bear in mind that before, or during the installation of said feature, we must also install the DNS server, since both functionalities they go hand in hand.

We must access the " Server Administrator " tool. This tool starts automatically with our server, in case it is not open, we will find it in the start menu with this same name.

Once inside, click on the button in the upper area " Manage " and click on the option " Add roles and characteristics"

On the first screen we are informed in detail of some recommendations that we must comply with. As we have already configured our server with a fixed IP, we will only have to click " Next ".

In the next window we must choose the option “ Installation based on characteristics or roles ”, since what we intend to install is a role on our server.

After clicking next, we will see a window in which we must choose the option “ Select a server from the server group ”. If we have several servers, which is not our case, we will have to choose one of them, which will be the one to install the role. When we finish, click on " next " again.

On the new screen, yes we will have to perform certain actions. From here we must look in the list for the option " DNS Server " and " DHCP Server " and activate them both. (ignore the Active Directory option)

Once done, click on " Next ".

In the following screens, the wizard will provide us with information about the characteristics of we are going to install. Indicating that, after this, we will have to make the corresponding configuration.

Once located in the final window, we will be shown a summary of what we are going to install. We will only have to click on " Install " to start the process. Let's notice that the window shows us the information that this server requires additional configuration.

Now we can go back to the Server Administrator tool to follow the installation process. Once finished, we will see how to configure it.

Configure DHCP Server in Windows Server 2016

Once located on the main administration screen, we will click on the notifications icon. We will see that there is an option in the list named " Complete DHCP configuration ", click on it.

Again, we will be before another assistant. Click on " next " to enter the matter.

Now we will have to put a username, which will normally be Administrator, and the domain, if we have the Active Directory role active, and again click on " Next ". (Normally the system will automatically detect both user and domain). With this we will finish this little assistant.

Again in the Server Administrator window, we are located on the " Tools " option and access the " DHCP " section

Authorize DHCP in the Domain

At this point, it is possible that we have also installed the Active Directory role and we are shown the DHCP service with a red "x" in the tree that hangs from our server. This means that our DHCP is not authorized by the domain to perform functions.

In this case, what we will do is select the server name with the right button, and click on " Authorize ". (if authorized, it will show “Do not authorize”)

In this way, the state will have green symbols. Otherwise our DHCP will not work.

DHCP configuration process

In the new configuration tool, we will find basically two sections, one for IPv4 and the other for IPv6. We are going to focus on the first one, which is known and used by everyone.

Right click on it to choose " New scope..."

For a change, a new wizard will appear for the configuration of that one. We put any name for the scope and click on " Next ".

Now we will be located in a window where we will have to configure the range of IP addresses that our server will be able to give to the computers that connect to its domain.

We are going to assign for example a range of 50 addresses, from 1 to 50, both inclusive. In this section we must place IP addresses belonging to the scope of which we have configured on our LAN card.

As length we leave the default parameter of 24 and as subnet mask we assign one of type C, that is, 255.255.255.0. since it is more than enough for us. Click on " Next ".

In the next window, we can establish a list of exclusions in this IP range so that they are not assigned. In this way we could exclude for example the IP 192.168.5.200, which is already assigned. We would also place some that, for example, we want to use for printers with fixed IP or other especially important clients. In our case, we will not establish any type of exclusion, since the assigned range does not influence the already assigned IPs.

In the next step, we can establish for how long we want a computer to have the same IP assigned. When this time expires, the IP address will be automatically reassigned.

We will leave it by default in 8 days and click on " Next ".

We will go through a screen in which we must choose the option " Configure these options now ", in this way we can leave the DHCP server configuration complete. Click on " Next ".

Now we will have to write the address of the gateway or the router that we have. Since we intend that our server is the one that provides all the DHCP service of the network, we are going to add the IP address of the network card to which the connected LAN will go, in our case 192.168.5.200. It will NOT be the IP of our server for the WAN network.

If we do not remember it exactly, we will be able to see it in the " Server administrator " panel in the " Local server " section.

On the next screen we will have to put a domain name, and specify which computer we will use to scramble our DNS names and convert them into IP addresses. Here we can do an interesting check to verify that the DNS service is working correctly, and that our network card correctly points to it.

We are going to write the name of our server in the " Server name " section and we are going to click " Solve ". The IP address that should be displayed is that of the LAN card.

If we now go to the DNS role configuration from the main server administrator window, we could verify that our server name is indeed associated with the IP address of the LAN adapter.

On the next screen we can configure the WINS servers to resolve the NetBIOS name. We will get through this olympically.

Finally we will go through a couple more screens to finish the wizard. We will already have our DHCP server configured in Windows Server 2016.

Now we will return to the main window where we will see the configured scope. We will have several options where we can configure this:

  • Address set: it will be the range of addresses that we have configured during the wizard. Address grants: the computers that have connected to our server will be shown here. Reservations: as before, they will be the IPs that we had configured as exclusions in the designated range. Scope options: from here we can edit the parameters related to the router, domain or DNS server. Policies: option to configure and assign policies to connected clients.

In any case, in the main section we will see the " Active " message, so we can now go to a client to see if the server gives us an IP for it.

Connect a client to Windows Server 2016 DHCP server

As we said at the beginning of our tutorial, we had to configure the clients' network card ininternalmode, so that they did not take the IP address from another place. This is the most correct way to simulate an internal LAN network of a company or workplace.

Suppose that our client computer was already booted before configuring the DHCP server. If we open a command window and do an ipconfig, we can verify that the IP address shown to us has nothing to do with the range that we have designated.

So what we will have to do is put the command:

Ipconfig / reread

To reread the connection network, and then:

Ipconfing / renew

In this way, the client computer will automatically detect the DHCP server that operates on the internal network, and will take an IP address from the range that we have configured.

We can see that this has indeed been the case. If we see in more detail the characteristics of the network that the client has taken, we will distinguish an IP belonging to the range, specifically 192.168.5.1.

In addition, we will see that the default gateway is precisely the IP of the server's LAN card, as well as the DHCP server and the DNS server.

But we can still go a bit further with our administrator mindset and explore our server to see how these changes have been reflected in network settings.

We are going to go first to the " Address leases " section of the control panel of the DHCP server and we will be able to verify that our client computer appears there. We see the IP address and name of the computer, a symbol that DNS is working.

Similarly, if we go to the control panel of the DNS server, in the section of our domain, we can also see that there is a new entry that resolves the IP address with the name of the computer.

Do I need to be connected to a domain for the DHCP service to work?

This question can be asked by all of you who read this. You may have noticed that we also have Active Directory installed on this server. Also, the client computer in the example is within this domain with a user belonging to it, since it was the computer that we used for the Active Directory tutorial.

Nothing further from reality, we are now going to start another client with the network card configured in internal mode , and that is not connected to any domain or anything like that.

We open the command console to put the ipconfig / renew command again. Note that the user is different.

Effectively DHCP will give us the IP address as well.

If we look now on the server monitor, we will see that there is a more connected computer.

My DHCP client does not have Internet

Of course it does not, the only thing we have configured for now is a DHCP role so that our server provides an internal network identity in our client. It is on the server itself where we will have to create a routing system that connects the LAN network card to the WAN network card.

But we will do this in another tutorial, because this one is long on the nose.

Install Routing Service in Windows Server 2016

We also recommend the following tutorials to expand the possibilities of your server

We hope that, despite the long tutorial, you have been able to mount your own server without problems. If you have any problems please let us know. We will be back with more.

Tutorials

Editor's choice

Back to top button