UBuntu 14.04 LTE set IP address and some server versions of Linux are not quite the same. For CentOS 7.0, for example, the configuration file for the NIC IP address should be/etc/sysconfig/network-scripts/ifcfg-eth0
First Ubuntu 14.04 LTE under the IP address configuration file is/etc/network/interfaces。
[Email protected]:/etc/network$Cat/etc/network/interfaces# Interfaces (5)fileUsed by Ifup (8) and Ifdown (8) Auto loiface lo inet loopback auto eth0iface eth0 inet staticaddress192.168.2.100Gateway192.168.2.2netmask255.255.255.0Network192.168.2.0Broadcast192.168.2.255DNS-nameservers8.8.8.8[email protected]:/etc/network$
Match the address with Ifdown eth0 and then follow the ifup eth0 restart the network card for the previous configuration to take effect
[Email protected]:/etc/network$sudoifdown eth0 [email protected]:/etc/network$sudoifup eth0 [email protected]:/etc/network$ifconfigeth0 Link encap:ethernet HWaddrxx: 0c: in: E7:e6: $inet Addr:192.168.2.100Bcast:192.168.2.255Mask:255.255.255.0Inet6 addr:fe80::20c:29ff:fee7:e657/ -scope:link up broadcast RUNNING multicast MTU: theMetric:1RX Packets:275Errors0Dropped0Overruns:0Frame0TX Packets:374Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen: +RX Bytes:31264(31.2KB) TX Bytes:46453(46.4KB) Lo Link encap:local Loopback inet addr:127.0.0.1Mask:255.0.0.0Inet6 Addr: ::1/ -scope:host up LOOPBACK RUNNING MTU:65536Metric:1RX Packets:47566Errors0Dropped0Overruns:0Frame0TX Packets:47566Errors0Dropped0Overruns:0Carrier0Collisions:0Txqueuelen:0RX Bytes:8344572(8.3MB) TX Bytes:8344572(8.3MB) [Email protected]:/etc/network$PingWww.baidu.comPING www.a.shifen.com (61.135.169.121) About( -) bytes of data. -Bytes from61.135.169.121: icmp_seq=1Ttl= - Time=102Ms -Bytes from61.135.169.121: icmp_seq=2Ttl= - Time=54.9Ms^C---www.a.shifen.comPingStatistics---3Packets Transmitted,2Received -% packet loss, Time6396msrtt min/avg/max/mdev =54.940/78.678/102.417/23.740Ms
Linux->> UBuntu 14.04 LTE set static IP address