Focus on cloud service provider activities
Notes on website operation and maintenance

Simply record the process of configuring IP address in Linux ubuntu

When we use the server, sometimes we need to configure the server IP address by ourselves. For example, if the server has multiple IP addresses, it needs to be configured and started separately. Here, simply record the process of configuring the IP address for Linux Ubuntu.

Open the terminal and enter the following command to open the network configuration file:

 sudo nano /etc/network/interfaces

Find the line "iface eth0 inet dhcp" in the file (eth0 represents the name of the network card, which is adjusted according to the actual situation), and change it to the following content to use the static IP address:

 iface eth0 inet static Address # Set the IP address Netmask # Set subnet mask Gateway # Set gateway address Dns nameservers # Set DNS server address

The IP address, subnet mask, gateway address and DNS server address here need to be modified according to the actual situation.

Save the file and exit the editor, then use the following command to restart the network service to make the settings take effect:

 sudo service networking restart

In this way, our Ubuntu system has been configured with a static IP address. We can use the following command to check whether the network connection is normal:


If you can ping successfully, the network connection is normal.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Simply record the process of configuring IP address in Linux ubuntu