Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria
How to change the IP in Windows and Linux
How to know the IP of your computer and configure it manually
What is the IP address?
An Internet Protocol address (IP address) is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. An IP address serves two main functions: host or network interface identification and location addressing. When a device connects to the internet, it is assigned an IP address, which allows it to communicate with other networks. As it has information about the location of the device, it allows you sending information to the right place.
By default, a random IP address automatically generated by the routers is set on our computers and all connected devices. However, sometimes we need to change it in order to make it work properly or to have better control of our devices. In this blog we will explain you how to change your local IP in both Windows and Linux systems.
How to change the IP address of my computer
Depending on the operating system, you will set the IP address one way or another. To manually change your IP address it is not necessary to know it, but you must have knowledge about the interface you are working with. To change any interface such as WiFi or Ethernet, you must be connected on the one you want to configure. In addition, organizations that distribute IP addresses to the world reserve a range of IP addresses for private networks that we use to change the address of our computers.
192.168.0.0 - 192.168.255.255
172.16.0.0 - 172.31.255.255
10.0.0.0 - 10.255.255.255
Change the IP address in Linux
In Linux there are many ways to change your IP address but not all of them will be changing it permanently. In this blog you will see how to change it temporarily and also permanently.
First you will run an ip commmand with the option a on the Linux terminal.
All the PC network interfaces will be displayed with this command. In general, three interfaces will appear that we can distinguish by the names of lo, enp and wlp.
lo address: the loopback address or localhost is used to test the network connectivity of your own computer and to access all network services locally. It has an ip address of 127.0.0.1.
enp interface: the enp interface corresponds to Ethernet network used in local area networks (LAN). If any Ethernet wire is connected, it might not appear or have an IP address.
wlp interface: the wlp interface is the name given to the wireless network adapter in Linux. The default IP address will be given by the router to which the computer is connected.
In order to only temporarily change the IP address, you will use the ifconfig program, usually installed by default on your system. Use the ifconfig command followed by the name of the network interface you want to change, the new IP address and its respective netmask (you can only add / and the number of bits that you wish to use as a mask). This command have to be called being an administrator so, in order to be able to perform the following command, we need to use su or sudo command:
$sudo ifconfig <interface_name> <ip> netmask <network_mask>
$sudo ifconfig enp1s0f0 192.168.8.24/24
$sudo ifconfig enp1s0f0 192.168.8.24 netmask 255.255.255.0
Now the IP should be changed. In order to check it, run the ip a command again .
Using ifconfig the IP will only be changed temporarily, because if the system is rebooted it will be set to a random IP address again. To change the IP permanently, first of all, you have to stop and disable the Network Manager of your computer, otherwise the DHCP server will assign to the system automatically another IP address which has preference respect the one you configure manually.
sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service
The IP address has to be changed using ifupdown configuration. You will have to add your network settings in the /etc/network/interfaces or create this file if it does not exist already. To access to this file, you can change it in the terminal using the vi editor as administrator.
iface <interface_name> inet static
After setting it all, a restart of the networking service must be done, since all the changes must be applied.
$sudo systemctl restart networking.service
Now the IP should be changed. In order to check it, run the ip a command again.
Change the IP address in Windows
How can you change the ip address of a domain controller?
The first step is to open the Control Panel. The quickest way to get to it is by clicking on Start and typing it in. In the Control Panel, you can click the Network and Internet category and then click Network and Sharing Center. If you are in icon view, just click directly on Network and Sharing Center. A view of the actual active networks will be displayed. In order to see Ethernet connection, make sure that the Ethernet wire is connected to the computer. For the Wireless connection check out if there are WiFi networks avaiable.
Then click on the network interface that you want to change. In this blog we will be changing the Ethernet connection as an example. When you click on it, it will appear a window about the state of the connection, where you can check all the details of the Ethernet connection. For changing the IP click on the Properties button. Then search for Internet Protocol Version 4 (TCP/IPv4) and click again on the Properties button.
Click on properties to access the next phase (right photo).
Select the Protocol and then click on properties again.
Finally a window will be displayed where you can change the IP address. Choose the second option and enter the following IP as the following image. Then choose the Accept button and also the Properties of Ethernet. Finally close the window and the IP will have been changed. To check it, click on the network details or run the ipconfig on the Windows terminal.