iptables本地远程桌面转发
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iptables本地远程桌面转发相关的知识,希望对你有一定的参考价值。
远程桌面访问本地LINUX主机(192.168.1.128),经此机的转发/转址功能映射到本地win7主机(192.168.1.120),配置结果如下:[[email protected] ~]# sysctl -a|grep ip_forward
net.ipv4.ip_forward = 1
[[email protected] ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[[email protected] ~]# iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:3389 to:192.168.1.120:3389
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3389 to:192.168.1.120:3389
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
SNAT tcp -- 0.0.0.0/0 192.168.1.120 tcp dpt:3389 to:192.168.1.128
SNAT udp -- 0.0.0.0/0 192.168.1.120 udp dpt:3389 to:192.168.1.128
命令格式:
#目标地址端口为3389的,转换为192.168.1.120:3389
[[email protected] ~]# iptables -t nat -I PREROUTING -p tcp --dport 3389 -j DNAT --to 192.168.1.120:3389
#凡目标地址为192.168.1.120:3389的,把源地址转换为192.168.1.128
[[email protected] ~]# iptables -t nat -I POSTROUTING -p tcp -d 192.168.1.120 --dport 3389 -j SNAT --to 192.168.1.128
以上是关于iptables本地远程桌面转发的主要内容,如果未能解决你的问题,请参考以下文章