内网机器,共享IP的方法

来源:互联网 发布:指尖陀螺推荐 知乎 编辑:程序博客网 时间:2024/05/05 02:40

内网机器A 内网IP 10.10.0.1 ,有外网IP
内网机器B 内网IP 10.10.0.9 ,无外网IP

外网机器C 外网IP 123.5.6.13

想要在B机器上,向C机器传一个文件

在A机器上配置,防火墙iptables
# iptables -t nat -A PREROUTING -p tcp -d 10.10.0.1 –dport 10002 -j DNAT –to-destination 123.5.6.13:22
# iptables -t nat -A POSTROUTING -p tcp -d 123.5.6.13 –dport 22 -j MASQUERADE

然后,在B机器上可以向C传文件,注意端口号
scp -P 10002 test 10.10.0.1:/tmp/

0 0
原创粉丝点击