在ubuntu上装了virtualbox来跑xp,选择了host-only网络。host:192.168.56.1,guest:192.168.56.2,这样host与guest之间可以互访。将主机连接外网的网卡共享出来,guest就是以访问外网了。
让主机外网网卡NAT转发:
sudo sysctl -w net.ipv4.ip_forward=1 设置系统参数,允许转发。
sudo iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE 设置NAT规则。
查看是否允许转发:
cat /proc/sys/net/ipv4/ip_forward
查看iptables的NAT规则:
sudo iptables -t nat -L