虚拟机软件:virtualbox 4.2.6
问题:
如何让物理主机能通过网络访问虚拟机xp启用的服务,如共享文件夹、ftp、IISweb服务器等。
一、主机(linux host,安装virtualbo的物理主机)配置:
1、网桥br0:
代码: 全选
root@lubuntu-vm:/home/lubuntu/下载# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.4437e63b644a no eth0
tap0
eth0是真实网卡,没有接网线使用
2、tap0:
没设置ip,已经启用
3、路由表
代码: 全选
root@lubuntu-vm:/home/lubuntu/下载# route
内核 IP 路由表
目标 网关 子网掩码 标志 跃点 引用 使用 接口
default * 0.0.0.0 U 0 0 0 ppp0
1.168.65.125.br * 255.255.255.255 UH 0 0 0 ppp0
192.168.8.0 * 255.255.255.0 U 0 0 0 eth2
192.168.100.0 * 255.255.255.0 U 0 0 0 br0
代码: 全选
root@lubuntu-vm:/home/lubuntu/下载# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 192.168.100.0/24 anywhere
ACCEPT all -- anywhere 192.168.100.0/24
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
root@lubuntu-vm:/home/lubuntu/下载# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 192.168.8.0/24 anywhere
MASQUERADE all -- 192.168.100.0/24 anywhere
1、virtualbox虚拟机网络设置:
桥接,桥接到tap0网卡,网卡允许混杂模式
2、虚拟xp网络设置:
ip:192.168.100.100
netmask:255.255.255.0
网关:192.168.100.1
三、现状
虚拟机xp可以直接访问互联网,能ping通192.168.100.1,能访问物理主机上的任何服务,如samba共享等。
物理主机不能访问虚拟机,ping 192.168.100.100也是不通的。
请配过桥接的帮忙下,我的目的是物理主机一定要能访问虚拟机。