Sometimes we want the IP address of the Ubuntu14.04 to be static IP address, so that the IP address in Ubuntu is not changed, this will be convenient in the embedded device and host Ubuntu to use the network port for debugging.
Static IP address configuration method: In the/etc/network/interfaces file, modify the contents of the
# interfaces (5) file used by Ifup (8) and Ifdown (8)
Auto Lo
Iface Lo inet Loopback
Auto Eth0
Iface eth0 inet Static
#iface eth0 inet DHCP
Address 192.168.1.189
Netmask 255.255.255.0
Gateway 192.168.1.0
Where auto eth0 means that the Eth0 network port is used
Iface eth0 inet Static indicates that the IP address of the eth0 is a static IP address, so that the IP address will not change after each boot. IP Address We can manually configure one.
Dynamic IP address configuration method: In the/etc/network/interfaces file, modify the contents of the
# interfaces (5) file used by Ifup (8) and Ifdown (8)
Auto Lo
Iface Lo inet Loopback
Auto Eth0
#iface eth0 inet Static
Iface eth0 inet DHCP
Address 192.168.1.189
Netmask 255.255.255.0
Gateway 192.168.1.0
Where auto eth0 means that the Eth0 network port is used
Iface eth0 inet DHCP indicates that the IP address of the eth0 is dynamically assigned by the DHCP server, and one of the conditions in which Ubuntu is generally connected is to configure how the item is dynamically assigned IP addresses by the DHCP server. After the connection is successful, DHCP assigns an IP address to Ubuntu that can be connected to the Internet. The following IP address can be arbitrarily set, because it is dynamic allocation, then the following address is not the main.
This article is from the "Whylinux" blog, make sure to keep this source http://whylinux.blog.51cto.com/10900429/1900593
ubuntu14.04 static IP address and dynamic IP address configuration