1. Configure/etc/Network/interfaces
# Static IP address 1 auto LO 2 iface lo Inet loopback # loopback virtual network device, allow TCP/IP IP address 127.0.0.1 to access your computer 3 # the primary network interface 4 auto eth0 5 iface eth0 Inet static # configure static IP address 6 address 10.112.18.106 # IP address 7 # network 10.112.18.0 8 netmask 255.255.255.0 # subnet mask 9 # broadcast 10.112.18.255 10 gateway 10.112.18.254 # gateway 11 DNS-nameservers 10.112.18.1 # DNS Server
Auto eth1 # continue to add the second Eni, which is the same as the above
..........
# DHCP Dynamic IP address 1 auto LO 2 iface lo Inet loopback 3 # the primary network interface 4 auto eth0 5 iface eth0 Inet DHCP
2. Restart the network. The configuration takes effect.
sudo /etc/init.d/networking restart
3. Common Network Information viewing commands
Ifconfig # lists information about each network adapter. You can find the corresponding MAC address, IP address, and subnet mask in the network adapter (usually eth0) in use.
Sudo netstat-atnp # view the current network connection status and program
3. Modify the MAC address
1 sudo ifconfig eth0 down # disable Nic 2 sudo ifconfig eth0 HW ether 00: AA: BB: CC: DD: ee # change the address 3 sudo ifconfig eth0 up # Then start Nic
Permanent modification
sudo vim /etc/init.d/rc.local
Add the preceding three lines of commands.
4. Host Name
1 sudo/bin/hostname # view host name 2 sudo/bin/hostname newname # Set the Host Name of the current host
5. Network Manager (the network configuration tool provided by UBUNTU)
If you have not installed sudo apt-Get install network manager first
====================================== Solutions to some problems ================ ========================
1. Invalid DNS Configuration
1 apt-Get install resolvconf # Check whether resolvconf2 dpkg-reconfigure resolvconf is installed # reconfigure resolvconf. Select Yes in the confirmation box.
Then restart and solve the problem.
2.