码迷,mamicode.com
首页 > 系统相关 > 详细

Linux ->> UBuntu 14.04 LTE下设置静态IP地址

时间:2015-12-27 06:14:09      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:

UBuntu 14.04 LTE设置IP地址和一些服务器版本的Linux还不太一样。以Centos 7.0为例,网卡IP地址的配置文件应该是/etc/sysconfig/network-scripts/ifcfg-eth0

首先UBuntu 14.04 LTE下面IP地址的配置文件是/etc/network/interfaces。

jerry@ubuntu:/etc/network$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback       

auto eth0
iface eth0 inet static
address 192.168.2.100
gateway 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
dns-nameservers 8.8.8.8 
jerry@ubuntu:/etc/network$ 

 

把地址配好后用ifdown eth0后跟上ifup eth0重启网卡让前面的配置生效

jerry@ubuntu:/etc/network$ sudo ifdown eth0 
jerry@ubuntu:/etc/network$ sudo ifup eth0 
jerry@ubuntu:/etc/network$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:e7:e6:57  
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee7:e657/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:275 errors:0 dropped:0 overruns:0 frame:0
          TX packets:374 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:31264 (31.2 KB)  TX bytes:46453 (46.4 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:47566 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47566 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8344572 (8.3 MB)  TX bytes:8344572 (8.3 MB)

jerry@ubuntu:/etc/network$ ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=128 time=102 ms
64 bytes from 61.135.169.121: icmp_seq=2 ttl=128 time=54.9 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 6396ms
rtt min/avg/max/mdev = 54.940/78.678/102.417/23.740 ms

 

Linux ->> UBuntu 14.04 LTE下设置静态IP地址

标签:

原文地址:http://www.cnblogs.com/jenrrychen/p/5079395.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!