Ubuntu Change IP

Ubuntu Change IP

To change the IP address on an Ubuntu system, you can follow these steps:

  1. Determine the name of the network interface that you want to configure. You can use the ifconfig command to list the available interfaces and their current IP addresses.

  2. Open the network configuration file for the interface that you want to configure in a text editor (e.g. nano):

sudo nano /etc/network/interfaces
So‮u‬rce:www.lautturi.com
  1. Edit the configuration for the interface to specify the new static IP address, netmask, and gateway. For example, to set the static IP address to 192.168.1.100, the netmask to 255.255.255.0, and the gateway to 192.168.1.1, you can add the following lines to the configuration file:
iface interface inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1

Replace interface with the name of the network interface and 192.168.1.100, 255.255.255.0, and 192.168.1.1 with the desired static IP address, netmask, and gateway.

  1. Save the configuration file and close the text editor.

  2. Restart the networking service to apply the changes:

sudo service networking restart

The IP address should now be changed on the interface. You can verify the configuration by running the ifconfig command and looking for the new IP address in the output.

Keep in mind that the above steps assume that you are using the /etc/network/interfaces file to configure the network interfaces. If you are using a different method to configure the network, the steps may be different.

You can also use the ip command to change the IP address on an Ubuntu system. For example, to change the IP address of the eth0 interface to 192.168.1.100, you can use the following command:

sudo ip addr add 192.168.1.100/24 dev eth0

This will change the IP address of the eth0 interface to 192.168.1.100, with a netmask of /24 (255.255.255.0). You can use the ip command to configure other network settings as well, such as the gateway or DNS servers.

Created Time:2017-10-30 14:27:24  Author:lautturi