

$ sudo systemctl restart rviceĪfter restarting your networking service, you should be able to see your new IP by running the “ifconfig” or the “ip” command. In order for the changes to be applied, you will need to restart your networking service (managed by ifupdown) # For systemd hosts To change your IP address to reflect those changes, you would edit the content of your interfaces file and add the following content $ vim /etc/network/interfaces # Content of /etc/network/interfacesįor example, let’s say that you want to change your IP to be “192.168.178.32” with a subnet mask of “255.255.255.0” and a default gateway of “192.168.178.1”. In order to change your IP address on Linux, you will have to add your network configuration in the “/etc/network/interfaces” or create this file if it does not exist already. On Linux, changing your IP address using network utilities does not mean that your IP configuration will be saved on reboots. Change IP Address Permanently using ifupdown Note that your changes are not made permanent by modifying your IP settings with the “ifconfig” : they are only modified for the current session. This is not the case anymore after assigning the IP address manually. This information is materialized in the “ifconfig” command : in the first screenshot, you can see that my IP address was assigned with a “ dynamic” parameter also called DHCP. When manually changing your IP address, Linux automatically understands that you want to change from using a DHCP server to static IP addressing. In order to verify that your IP address was correctly changed, you can run the “ifconfig” command followed by the name of your network adapter.

Note : in order to change your IP address, you will need to be an administrator on your computer (part of the sudo group on Debian/Ubuntu or wheel on CentOS/RedHat)įor example, given the IP addresses used in the previous sections, if we want to change our IP address (to 192.168.178.32/24), we would run the following command $ ifconfig enp0s3 192.168.178.32/24 To assign the subnet mask, you can either add a “netmask” clause followed by the subnet mask or use the CIDR notation directly.

To change your IP address on Linux, use the “ifconfig” command followed by the name of your network interface and the new IP address to be changed on your computer. However, you should still be able to use the “ifconfig” to change your IP address. On modern distributions, the “ifconfig” command has been completely deprecated and it is now advised to use the “ip” command.
