360ITO技术社区
  • 首页
  • 文章
  • 快讯
  • 讨论
  • 问答
  • 小贴士
  • 代码块
  • 开源
  • 老论坛
登录 | 注册

360ITO技术社区  > 文章

订阅文章

通过有公网IP的linux服务器,使用远程桌面连入内网windows2008服务器

无相 发布于 7年前 ( comment 0条评论  查看:5985  收藏:0 )
服务器OS:CentOS 6.3 
服务器网卡:
eth0:内网192.168.6.86
eth1:外网58.183.93.97

内网windows2008服务器IP:192.168.6.100

原理:端口转发,windows远程桌面的默认端口是3389

执行的命令行:
iptables -t nat -A PREROUTING -d 58.183.93.97 -p tcp --dport 3389 -j DNAT --to-destination 192.168.6.100:3389  
iptables -t nat -A POSTROUTING -d 192.168.6.100 -p tcp --dport 3389 -j SNAT --to 192.168.6.86  
  
service iptables save  
service iptables restart  

查看是否保存:
cat /etc/sysconfig/iptables

查看是否生效: 
iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
DNAT       tcp  --  anywhere             58.183.93.97       tcp dpt:ms-wbt-server to:192.168.6.100:3389 

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
SNAT       tcp  --  anywhere             192.168.6.100       tcp dpt:ms-wbt-server to:192.168.6.86 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

或者
service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    DNAT       tcp  --  0.0.0.0/0            58.183.93.97       tcp dpt:3389 to:192.168.6.100:3389 

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    SNAT       tcp  --  0.0.0.0/0            192.168.6.100       tcp dpt:3389 to:192.168.6.86 

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

注意:如果开了防火墙,要打开指定端口:
iptables -A FORWARD -o eth0 -d 192.168.6.100 -p tcp --dport 3389 -j ACCEPT 




0 有用 0 无用
本站原创,欢迎转载;尊重他人劳动,转载时保留以下信息:
本文转自:360ITO技术社区
原文标题:通过有公网IP的linux服务器,使用远程桌面连入内网windows2008服务器
原文地址:http://www.360ito.com/article/297.html
360ito.com
Linux

共有0个评论 我要评论»

按时间排 按有用数排 按支持数排

网友回复/评论仅代表其个人看法,并不表明本社区同意其观点或证实其描述。

请尽量让自己的回复能够对别人有帮助

1.不欢迎无意义的回复/评论和类似“顶”、“沙发”之类没有营养的文字
如果只是想简单的表个态,请点 有用无用支持反对 等按钮
2.发言之前请再仔细看一遍文章,或许是您遗漏、误解了,理性讨论、切莫乱喷
3.严禁发布违法、违规的信息,请勿到处招贴广告、发布软文;
4.如果您发现自己的回复/评论不见了,请参考以上3条
5.不停制造违规、垃圾信息的,账户将被禁止

热门标签

  • android 20
  • Flash 15
  • 游戏 12
  • Linux 12
  • Python 11
  • 工作笔记 11
  • 社交游戏 7
  • delphi 5
  • jquery 5
  • 编程 4
  • 谷歌 4
  • git 4
  • Centos 4
  • JavaScript 3
  • 开发者 3
  • C/C++ 3
  • 安全 2
  • 代码 2
  • 浏览器 2
  • 移动应用 2

相关文章

周热点

  • 1周前qifei233333333333 (83)

月热点

  • 3周前qifei233333333333 (179)
  • 3周前qifei233333333333 (167)
  • 1周前qifei233333333333 (132)
  • 1周前qifei233333333333 (112)
  • 1周前qifei233333333333 (83)
Copyright ©2011-2012 360ITO技术社区 All Rights Reserved. | 关于 | 联系我们 | 杭州精创信息技术有限公司 浙ICP备09019653号-26|
▲