VMware.Workstation.v5的host-only方式上外网问题

发布于 2022-10-03 12:45:55 字数 13913 浏览 32 评论 0

我的是redhat9 host + win2000pro guest 使用host-only方式,内网是通了,但guest上不了外网.我现在把我的设置贴出来,希望各位大侠帮忙看看,错在哪里了.

1.使用vmware-config.pl配置VMware
root@seaman-yang root]# /usr/bin/vmware-config.pl
Making sure services for VMware Workstation are stopped.

Stopping VMware services:
   Virtual machine monitor                                 [  确定  ]
   DHCP server on /dev/vmnet1                              [  确定  ]
   Host-only networking on /dev/vmnet1                     [  确定  ]
   DHCP server on /dev/vmnet8                              [  确定  ]
   NAT service on /dev/vmnet8                              [  确定  ]
   Host-only networking on /dev/vmnet8                     [  确定  ]
   Virtual ethernet                                        [  确定  ]

Configuring fallback GTK+ 2.4 libraries.

In which directory do you want to install the mime type icons?
[/usr/share/icons] /usr/share/icons

In which directory do you want to install the application's icon?
[/usr/share/pixmaps] /usr/share/pixmaps

Trying to find a suitable vmmon module for your running kernel.

The module up-2.4.20-8.athlon-RH9.0 loads perfectly in the running kernel.

You have already setup networking.

Would you like to skip networking setup and keep your old settings as they are?
(yes/no) [no] no

Do you want networking for your virtual machines? (yes/no/help) [yes] yes

Would you prefer to modify your existing networking configuration using the
wizard or the editor? (wizard/editor/help) [editor] editor

The following virtual networks have been defined:

. vmnet1 is a host-only network on private subnet 172.16.126.0.
. vmnet8 is a NAT network on private subnet 192.168.1.64.

Do you wish to make any changes to the current virtual networks settings?
(yes/no) [no] yes
Which virtual network do you wish to configure? (0-99) 8

The network vmnet8 has been reserved for a NAT network.  You may change it, but
it is highly recommended that you use it as a NAT network.  Are you sure you
want to modify it? (yes/no) [no] yes

What type of virtual network do you wish to set vmnet8?
(bridged,hostonly,nat,none) [nat] none

Removing a NAT network for vmnet8.

The following virtual networks have been defined:

. vmnet1 is a host-only network on private subnet 172.16.126.0.

Do you wish to make additional changes to the current virtual networks settings?
(yes/no) [yes] yes

Which virtual network do you wish to configure? (0-99) 8

The network vmnet8 has been reserved for a NAT network.  You may change it, but
it is highly recommended that you use it as a NAT network.  Are you sure you
want to modify it? (yes/no) [no] yes

What type of virtual network do you wish to set vmnet8?
(bridged,hostonly,nat,none) [none] hostonly

Configuring a host-only network for vmnet8.

Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes] no

What will be the IP address of your host on the private network? 192.168.1.70

What will be the netmask of your private network? 192.168.1.65

The following virtual networks have been defined:

. vmnet1 is a host-only network on private subnet 172.16.126.0.
. vmnet8 is a host-only network on private subnet 192.168.1.65.

Do you wish to make additional changes to the current virtual networks settings?
(yes/no) [yes] no

Trying to find a suitable vmnet module for your running kernel.

The module up-2.4.20-8.athlon-RH9.0 loads perfectly in the running kernel.

Starting VMware services:
   Virtual machine monitor                                 [  确定  ]
   Virtual ethernet                                        [  确定  ]
   Host-only networking on /dev/vmnet1 (background)        [  确定  ]
   Host-only networking on /dev/vmnet8 (background)        [  确定  ]

The configuration of VMware Workstation 5.0.0 build-13124 for Linux for this
running kernel completed successfully.

You can now run VMware Workstation by invoking the following command:
"/usr/bin/vmware".

2.用ifconfig查看vmware的虚拟网络设备
[root@seaman-yang root]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0A:EB:56:FA:BB
          inet addr:192.168.1.70  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7079 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1257 errors:0 dropped:0 overruns:0 carrier:0
          collisions:33 txqueuelen:100
          RX bytes:1342729 (1.2 Mb)  TX bytes:166501 (162.5 Kb)
          Interrupt:5

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1565 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1565 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:111616 (109.0 Kb)  TX bytes:111616 (109.0 Kb)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:C0:00:01
          inet addr:172.16.126.1  Bcast:172.16.126.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:C0:00:08
          inet addr:192.168.1.65  Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@seaman-yang root]# service network restart
正在关闭接口 eth0:                                        [  确定  ]
关闭环回接口:                                             [  确定  ]
设置网络参数:                                             [  确定  ]
弹出环回接口:                                             [  确定  ]
弹出界面 eth0:                                            [  确定  ]

3.在主系统上ping一下虚拟系统:
[root@seaman-yang root]# ping -c 3 172.16.126.1
PING 172.16.126.1 (172.16.126.1) 56(84) bytes of data.
64 bytes from 172.16.126.1: icmp_seq=1 ttl=64 time=0.055 ms
64 bytes from 172.16.126.1: icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from 172.16.126.1: icmp_seq=3 ttl=64 time=0.050 ms

--- 172.16.126.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.050/0.051/0.055/0.008 ms

4.查看路由表
[root@seaman-yang root]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 vmnet8
172.16.126.0    *               255.255.255.0   U     0      0        0 vmnet1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
[root@seaman-yang root]# service network restart
正在关闭接口 eth0:                                        [  确定  ]
关闭环回接口:                                             [  确定  ]
禁用 IPv4 包转送:                                         [  确定  ]
设置网络参数:                                             [  确定  ]
弹出环回接口:                                             [  确定  ]
弹出界面 eth0:                                            [  确定  ]

5.再来开启路由功能,设定iptables,使主机成为一台 nat server
[root@seaman-yang root]# echo 1 >; /proc/sys/net/ipv4/ip_forward
[root@seaman-yang root]# iptables -t nat -A POSTROUTING -o eth0 -s 172.16.126.0/24 -j MASQUERADE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个少女永远怀春 2022-10-10 12:45:55

怎么没有人帮我解决啊

南城追梦 2022-10-10 12:45:55

http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&p=4428180&highlight=#4428180

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文