After ubuntu is installed, the first thing is to connect to the Internet, change the source, and perform the update operation, but the prerequisite is that the ip address and dns must be configured.
Next we will record the configuration process and use it as a backup so that it is not necessary.
1. Configure the ip address
The network configuration information of ubuntu is stored in/etc/network/interfaces,
Operation:
Sudo vim/etc/network/interfaces
Vim is a text editing software similar to edit under DOS. Similar to the previous software vi usage
If you configure Dynamic ip retrieval, add the following content to the above file: (Note: the server usually does not need dynamic ip addresses)
Auto eth0
Iface eth0 inet dhcp
If static IP is configured, add the following content:
Auto eth0
Iface eth0 inet static
Address 192.168.1.201
Netmask 255.255.255.0
Gateway 192.168.1.1
If the configuration takes effect, restart the NIC:
Ifconfig eth0 down
Ifconfig eth0 up
Run the ifconfig command to check whether the ip address is configured successfully.
Otherwise, restart the network service.
/Etc/init. d/networking restart
2. Configure the dns server
The dns server information of ubuntu is stored in/etc/resolv. conf,
Add the dns server address, for example, 202.112.125.53.
Nameserver 202.112.125.53
Summary:
You only need to follow the above steps to complete the configuration, and then you can access the internet. If not, restart the machine and try again.
Author Dai Liming