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 192.168.1.100 # Set the IP address Netmask 255.255.255.0 # Set subnet mask Gateway 192.168.1.1 # Set gateway address Dns nameservers 8.8.8.8 8.8.4.4 # 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:
ping www.laozuo.org
If you can ping successfully, the network connection is normal.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge