There are two ways to configure IP:
1. Direct Configuration via command
sudo ifconfig eth0 IP address netmask Subnet mask--Configure IP ground
sudo route add default GW gateway------------
vi/etc/resolv.conf configuration file Add nameserver dns----Configure DNS
Sudo/etc/init.d/networking restart-----------Restart NIC configuration
However, the method can only be modified temporarily, when the server restarts, the configuration information is lost, the second way to modify the configuration file directly, the configuration information is not lost after restarting the server;
2, directly modify the configuration file
Ubuntu system configuration file on:/etc/network/interfaces
Edit configuration file: sudo vi/etc/network/interfaces
Replace the line with the following line for eth0:
# The Primary network interface
Auto Eth0
Iface eth0 inet Static
Address IP addresses
Gateway Gateways
netmask Subnet Mask
#network 192.168.2.0
#broadcast 192.168.2.255
Fill in all information such as address,netmask,network,broadcast and gateways according to your situation:
Sudo/etc/init.d/networking restart--Restart the NIC to make the configuration effective
After configuring the IP address, you need to configure DNS, as follows;
sudo vi//etc/resolv.conf
Search chotim.com
NameServer DNS server address
Sudo/etc/init.d/networking restart--Restart the network card service can
How to configure IP address in Ubuntu system introduction