
[root@localhost 桌面]# pwd #查看当前目录
/root/桌面
[root@localhost 桌面]# cd /etc/sysconfig/network-scripts #切到这个目录下
[root@localhost network-scripts]# ll #列出文件下的信息
总用量 232
-rw-r--r--. 1 root root 287 10月 13 17:21 ifcfg-eno16777736 #这个就是你的网卡名
-rw-r--r--. 1 root root 254 9月 16 2015 ifcfg-lo
[root@localhost 桌面]# pwd #查看当前目录
/root/桌面
[root@localhost 桌面]# cd /etc/sysconfig/network-scripts #切到这个目录下
[root@localhost network-scripts]# ll #列出文件下的信息
总用量 232
-rw-r--r--. 1 root root 287 10月 13 17:21 ifcfg-eno16777736 #这个就是你的网卡名
-rw-r--r--. 1 root root 254 9月 16 2015 ifcfg-lo
[root@localhost 桌面]# ifup eno16777736 #启动网卡
成功激活的连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/4)
[root@localhost 桌面]# ifconfig eno16777736 #查看获取的ip地址
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.140.128 netmask 255.255.255.0 broadcast 192.168.140.255
inet6 fe80::20c:29ff:fe45:807b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:45:80:7b txqueuelen 1000 (Ethernet)
RX packets 2155 bytes 147730 (144.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 411 bytes 41791 (40.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost 桌面]# ping baidu.com #检测网络是否通畅
PING baidu.com (111.13.101.208) 56(84) bytes of data.
64 bytes from 111.13.101.208: icmp_seq=1 ttl=128 time=5.30 ms