(2) dhcp方式自动设置网络
[root@name01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0c:29:ae:6b:a7
ONBOOT=yes
TYPE=Ethernet
[root@name01 ~]#
重启network服务
[root@name01 ~]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/3
state: activated
Connection activated
[ OK ]
[root@name01 ~]#
(3) 验证网络,使用wget下载lib包,如下所示:
[root@name01 ~]# wget
--2014-08-20 03:03:38--
Resolving ftp.gnu.org... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org|208.118.235.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21119201 (20M) [application/x-gzip]
Saving to: ?.libc-2.12.1.tar.gz?
100%[=====================================================================================================================================================>] 21,119,201 89.1K/s in 7m 23s
2014-08-20 03:11:03 (46.6 KB/s) - ?.libc-2.12.1.tar.gz?.saved [21119201/21119201]
[root@name01 ~]#
[root@name01 ~]# ping
PING (58.217.200.15) 56(84) bytes of data.
64 bytes from 58.217.200.15: icmp_seq=1 ttl=128 time=281 ms
64 bytes from 58.217.200.15: icmp_seq=2 ttl=128 time=223 ms
64 bytes from 58.217.200.15: icmp_seq=3 ttl=128 time=1925 ms
64 bytes from 58.217.200.15: icmp_seq=4 ttl=128 time=1166 ms
64 bytes from 58.217.200.15: icmp_seq=6 ttl=128 time=318 ms
^C
--- ping statistics ---
6 packets transmitted, 5 received, 16% packet loss, time 5646ms
rtt min/avg/max/mdev = 223.089/782.893/1925.305/668.220 ms, pipe 2
[root@name01 ~]#
OK,虚拟机外网连接设置成功。
使用VMware搭建3台一模一样的Linux虚拟机(3)
内容版权声明:除非注明,否则皆为本站原创文章。