从Linux端口映射到VMware里的XP的方法

闲着无聊在linux上虚拟了个XP出来
远程连接用VNC连接linux还行,连接XP总是有鼠标问题。而且图像也慢。不是很爽。想用用win的mstsc
在linux上做端口映射如下

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING  -p tcp  --dport  3389 -j DNAT --to-dest 192.168.1.11:3389
iptables -t nat -A POSTROUTING  -j MASQUERADE

如果第一句有就不用加了。
最后一句一定要有,做IP伪装,就是转发的那台.知道是谁发起的请求.要回给谁

详细的也不多说了。我对这个也不熟。

方法2,未测试

主机环境是UBUNTU 7.4

VMware Workstation 6.0.0 build-45731vmware使用NAT是通过vmnet8来是实现,找到这个文件打开/etc/vmware/vmnet8/nat/nat.conf

# be up to 100% longer

timeout = 60

[incomingtcp]

# Use these with care - anyone can enter into your VM through these...

# FTP (both active and passive FTP is always enabled)

# ftp localhost 8887

#8887 = 192.168.0.128:21

4660 = 192.168.0.128:4660

# WEB (make sure that if you are using named webhosting, names point to

# your host, not to guest... And if you are forwarding port other

# than 80 make sure that your server copes with mismatched port

# number in Host: header)

# lynx http://localhost:8888

#8888 = 192.168.0.128:80

# SSH

# ssh -p 8889 root@localhost

#8889 = 192.168.0.128:22

[incomingudp]

# UDP port forwarding example

#6000 = 192.168.0.128:6001



[incomingtcp]

TCP映射

[incomingudp]

UDP映射

举例

8889 = 192.168.0.128:22

保存退出,重启服务

/usr/lib/vmware/net-services.sh restart

上一篇: 安装Debian基本系统以及Gnome   下一篇: rtorrent 图解

提交疑问

回顶部