How do you disable DHCP on a network interface card (NIC)?
If you want to assign a static IP address to your network interface card (NIC), you need to disable DHCP on it first. DHCP, or Dynamic Host Configuration Protocol, is a service that automatically assigns IP addresses and other network settings to devices on a network. While DHCP is convenient and efficient, it can also cause conflicts or security issues in some scenarios. In this article, we will show you how to disable DHCP on a NIC in Windows 10 and Linux.
Before you disable DHCP, you should check your current IP settings and note them down. You will need them later to configure your static IP address. To check your IP settings in Windows 10, open the Command Prompt and type
ipconfig /all
. Look for the Ethernet adapter or Wireless LAN adapter that you want to disable DHCP on, and write down the following information: IPv4 address, subnet mask, default gateway, and DNS servers. To check your IP settings in Linux, open the Terminal and type
ip addr show
or
ifconfig
. Look for the interface name that you want to disable DHCP on, and write down the same information as above.
To disable DHCP in Windows 10, you need to access the Network and Sharing Center. You can do this by right-clicking on the network icon in the taskbar and selecting Open Network & Internet settings. Then, click on Change adapter options. This will open a window with all your network connections. Right-click on the connection that you want to disable DHCP on, and select Properties. In the Properties window, double-click on Internet Protocol Version 4 (TCP/IPv4). This will open another window where you can change the IP settings. Select Use the following IP address, and enter the IP address, subnet mask, and default gateway that you noted down earlier. Then, select Use the following DNS server addresses, and enter the DNS servers that you noted down earlier. Click OK to save the changes and close the windows. You have successfully disabled DHCP on your NIC in Windows 10.
To disable DHCP in Linux, you need to edit the network configuration file for your interface. The location and format of this file may vary depending on your Linux distribution and network manager. For example, in Ubuntu, the file is located at
/etc/netplan/01-network-manager-all.yaml
and uses YAML syntax. In CentOS, the file is located at
/etc/sysconfig/network-scripts/ifcfg-<interface>
and uses key-value pairs. You can use any text editor to edit the file, but you may need sudo privileges to do so. In the file, look for the line that says
dhcp4: yes
or
BOOTPROTO=dhcp
, and change it to
dhcp4: no
or
BOOTPROTO=none
, respectively. Then, add the following lines with the IP address, subnet mask, gateway, and DNS servers that you noted down earlier:
addresses: [<IP address>/<subnet mask>]
gateway4: <gateway>
nameservers:
addresses: [<DNS server 1>, <DNS server 2>]
or
IPADDR=<IP address>
NETMASK=<subnet mask>
GATEWAY=<gateway>
DNS1=<DNS server 1>
DNS2=<DNS server 2>
Save the file and exit the editor. Then, apply the changes by restarting the network service or rebooting your system. You have successfully disabled DHCP on your NIC in Linux.
After you disable DHCP and configure your static IP address, you should test your network connection to make sure it works properly. You can do this by pinging your gateway and some external websites. To ping in Windows 10, open the Command Prompt and type
ping <address>
, where <address> is the IP address or domain name of the destination. To ping in Linux, open the Terminal and type the same command. You should see some replies with the round-trip time and packet loss information. If you see no replies or high packet loss, there may be a problem with your network configuration or connection. You can also use the
tracert
or
traceroute
commands to trace the route of your packets and identify any potential issues.
If you encounter any errors or issues after disabling DHCP and setting a static IP address, there are some common causes and solutions to consider. You may have entered an incorrect or invalid IP address, subnet mask, gateway, or DNS server. Additionally, you may have entered an IP address that is already in use by another device on the network, causing an IP conflict. Alternatively, the IP address you entered may be outside the range of your network. Your firewall or antivirus software might also be blocking your network traffic. Finally, check your physical connection and make sure your network cable or wireless adapter is secure and functional.
Rate this article
More relevant reading
-
System AdministrationWhat is the difference between DHCP scope and reservation?
-
Computer NetworkingHow can you identify IP DHCP issues?
-
Network EngineeringHow do you assign IP addresses and subnets with DHCP?
-
Server AdministrationHow do you prevent and recover from DHCP server errors caused by network outages or failures?