Ubuntu Linux Static IP Configuration

Ubuntu Linux Static IP Configuration

To configure a static IP address on an Ubuntu Linux system, you can follow these steps:

  1. Open a terminal window on the Ubuntu system.

  2. Use the ifconfig command to view the current network configuration. For example:

ifconfig
Sourc‮www:e‬.lautturi.com

The output will show the current network configuration, including the IP address, the netmask, and the default gateway.

  1. Identify the network interface that you want to configure with a static IP address. The network interface is usually called eth0 or wlan0, depending on whether it is a wired or wireless interface.

  2. Open the network configuration file for the network interface using a text editor. The network configuration file is usually located in the /etc/network directory and is named interfaces. You can use the nano or vi text editor to edit the file. For example:

sudo nano /etc/network/interfaces
  1. Add the static IP configuration for the network interface to the interfaces file. You can use the auto and iface directives to specify the network interface, and the address, netmask, and gateway directives to specify the static IP address, netmask, and default gateway. For example:
auto eth0
iface eth0 inet static
  address 192.168.0.100
  netmask 255.255.255.0
  gateway 192.168.0.1

Replace eth0 with the name of the network interface that you want to configure, and replace 192.168.0.100, 255.255.255.0, and 192.168.0.1 with the static IP address, netmask, and default gateway that you want to use.

  1. Save the changes to the interfaces file and exit the text editor.

  2. Restart the networking service to apply the changes. You can use the systemctl command with the restart option and the network unit to restart the networking service. For example:

sudo systemctl restart network

After following these steps, the static IP address will be configured on the Ubuntu Linux system.

Keep in mind that you must have the necessary permissions to edit the /etc/network/interfaces file on your system. If you do not have the necessary permissions, the text editor will display an error message.

For more information on how to configure a static IP address on an Ubuntu Linux system, you can refer to the Ubuntu documentation or the Linux documentation.

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