First, use the command set Ubuntu IP address
1. Disable IPV6 modify the configuration file blacklist.conf
south you /etc/modprobe.d/blacklist.conf
Represented by the vi editor (you can also use another editor, such as gedit) edit etc folder contents modprobe.d folder blacklist.conf document.
Note: You can only be modified under the root user mode
In the final document added blacklist ipv6
Then see what your edits
cat /etc/modprobe.d/blacklist.conf
2. Set LAN IP address and subnet mask for eth0
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0
The IP address to: 192.168.2.1, subnet mask changed: 255.255.255.0
3.Ubuntu IP gateway settings
sudo route add default gw 192.168.2.254
Set DNS 4.Ubuntu IP modify /etc/resolv.conf, added thereto DNS nameserver DNS nameserver address 1 and address 2 is completed.
5. Network Service Restart (if not, please restart ubuntu: sudo reboot)
sudo /etc/init.d/networking restart
6. Review the current IP
ifconfig
Second, Ubuntu IP directly modify the system configuration files
Ubuntu IP network configuration file is in the root directory: / etc / network / interfaces
Note : After modifying the contents of interfaces in a document, you need to modify the parameters /etc/NetworkManager/NetworkManager.conf document managed to make it to true, and restart. Otherwise, you will be prompted to say " wired network unmanaged devices ."
There may be provided a static IP DHCP or manually after opening.
Front auto eth0, so that the card represents the boot automatically mount eth0.
1. DHCP, configure the network card
Edit the file / etc / network / interfaces
sudo vi /etc/network/interfaces
And replace eth0 with the relevant line the following line:
#The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp
The network settings to take effect with the following command:
sudo /etc/init.d/networking restart
The following can also enter commands directly from the command line to get the address of sudo dhclient eth0
2. Configure static Ubuntu IP address for the network card
Edit the file / etc / network / interfaces
sudo vi /etc/network/interfaces
And replace eth0 with the relevant line the following line:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.254
netmask 255.255.255.0
#network 192.168.2.0
#broadcast 192.168.2.255
After modifying the IP distribution eth0 is assigned a static (static), information for its development of IP, gateway, subnet mask, and so on.
The above Ubuntu IP address and other information into your own on it.
The network settings to take effect with the following command:
sudo /etc/init.d/networking restart
3. Set the second Ubuntu IP address (virtual IP address)
Edit the file / etc / network / interfaces:
sudo vi /etc/network/interfaces
Add the following line in the file:
auto eth0: 1
iface eth0:1 inet static
address x.x.x.x
netmask x.x.x.x
network x.x.x.x
broadcast xxxx
gateway x.x.x.x
Fill in all the information such as address, netmask, network, broadcast and gateways, etc. Depending on your situation;
The network settings to take effect with the following command
sudo /etc/init.d/networking restart
4. Set the host name (hostname)
Use the following command to view the current host name of the host: sudo / bin / hostname
Use the following command to set the current host hostname: sudo / bin / hostname newname
When the system starts, it reads the name of the host from the / bin / hostname.
5. DNS configuration
First, you can add some of these host names and corresponding IP address of the host name in / etc / hosts, which is simple to use static queries this machine. To access the DNS server to query, set the /etc/resolv.conf file, assuming that the DNS server IP address is 192.168.2.2, then the content of the /etc/resolv.conf file should be:
search chotim.com
nameserver 192.168.2.2
6. Manual Network Service Restart: sudo /etc/init.d/networking restart
Returned the following results:
*Reconfiguring network interfaces… [OK]
Reproduced in: https: //www.cnblogs.com/kungfupanda/p/3519116.html