让VMware中Linux客户机访问互联网也是嵌入式开发的必要条件之一,本机采用双物理网卡,一个用来访问互联网,即外网称A网卡,另一个用来访问局域网,即内网称B网卡,与嵌入式开发板进行网络通信。这部分主要目的是让VMware中的Linux客户机访问互联网,即让Linux通过A网卡访问外网。在安装好VMware和CentOS5,5之后:(注:本地主机网络环境是手工设定IP地址且绑定本机MAC,也即访问外网只能通过本地主机的A网卡)
参考文章V
1,在windows主机部分,在网上邻居上单击右键->属性
在连接外网的本地连接上单击右键->属性,勾选允许其他网络用户通过此计算机的Internet连接来连接,在下拉框中选中VMware Network Adapter VMnet8,点确定关闭对话框。
2,在VMware的菜单栏内,点击VM->Settings,确保在Network connection单选框内选中的是NAT,
在VMware的菜单栏内,点击Edit->Virtual Network Editor,
在弹出的对话框中点击NAT Settings,在弹出的对话框中确认Gateway IP网关地址,
点击DNS Settings,在弹出的对话框中确认Auto detect available DNS servers被勾选上。
再回到网上邻居->属性的对话框,在VMware Network Adapter VMnet8上右键->属性,
在列表框中选中Internet 协议(TCP/IP),点击属性,确认IP地址和VMware的NAT Settings的对话框中Gateway IP网关地址一致。
3,启动CentOS5.5之后,打开终端,输入ifconfig,确认Inet addr的地址和网关在一个网段内,
[root@localhost ~]# ping -c4 192.168.224.1
接着输入ping命令,ping网关地址
PING 192.168.224.1 (192.168.224.1) 56(84) bytes of data.
64 bytes from 192.168.224.1: icmp_seq=1 ttl=64 time=0.386 ms
64 bytes from 192.168.224.1: icmp_seq=2 ttl=64 time=0.302 ms
64 bytes from 192.168.224.1: icmp_seq=3 ttl=64 time=0.274 ms
64 bytes from 192.168.224.1: icmp_seq=4 ttl=64 time=0.302 ms
--- 192.168.224.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.274/0.316/0.386/0.042 ms
[root@localhost ~]#
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.274/0.316/0.386/0.042 ms
[root@localhost ~]#
显然是ping通了,然后ping windows主机IP
[root@localhost ~]# ping -c4 192.168.1.32
PING 192.168.1.32 (192.168.1.32) 56(84) bytes of data.
64 bytes from 192.168.1.32: icmp_seq=1 ttl=64 time=0.360 ms
64 bytes from 192.168.1.32: icmp_seq=2 ttl=64 time=0.306 ms
64 bytes from 192.168.1.32: icmp_seq=3 ttl=64 time=0.278 ms
64 bytes from 192.168.1.32: icmp_seq=4 ttl=64 time=0.301 ms
PING 192.168.1.32 (192.168.1.32) 56(84) bytes of data.
64 bytes from 192.168.1.32: icmp_seq=1 ttl=64 time=0.360 ms
64 bytes from 192.168.1.32: icmp_seq=2 ttl=64 time=0.306 ms
64 bytes from 192.168.1.32: icmp_seq=3 ttl=64 time=0.278 ms
64 bytes from 192.168.1.32: icmp_seq=4 ttl=64 time=0.301 ms
--- 192.168.1.32 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.278/0.311/0.360/0.032 ms
[root@localhost ~]#
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.278/0.311/0.360/0.032 ms
[root@localhost ~]#
显然也ping通了,然后ping 外网DNS主机IP,在windows任务栏右下角点击本地连接
在弹出的本地连接状态对话框->支持(属性页标签),然后在弹出的对话框中点击详细信息
可以看到DNS服务器地址,点击开始->运行,在命令框中输入cmd,点确定,
在打开的命令行控制台ping虚拟网关的IP地址
显然虚拟网关的地址ping通了,接着ping Linux 客户机的IP
显然也ping通了,接着ping外网DNS的IP
显然也没有问题,还要看看在Linux 终端能不能ping得通
PING 211.147.6.3 (211.147.6.3) 56(84) bytes of data.
64 bytes from 211.147.6.3: icmp_seq=1 ttl=55 time=2.33 ms
64 bytes from 211.147.6.3: icmp_seq=2 ttl=55 time=2.32 ms
64 bytes from 211.147.6.3: icmp_seq=3 ttl=55 time=2.35 ms
64 bytes from 211.147.6.3: icmp_seq=4 ttl=55 time=2.00 ms
--- 211.147.6.3 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 2.001/2.256/2.359/0.155 ms
[root@localhost ~]#
显然也ping通了,到此,就可以访问外部网站页面了。
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 2.001/2.256/2.359/0.155 ms
[root@localhost ~]#
显然也ping通了,到此,就可以访问外部网站页面了。