由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - how to do this Iptables setting?
相关主题
help: iptables 问题再问个iptables rule的安全性问题
iptables禁用的ip存在哪里?请问个ssh登陆的问题
how to do this iptables setup?请教,如果建立家里电脑和学校电脑的连接。
simulate connection drop by iptables?请问网络高手
trick to use JMX on EC2 (转载)求助: How to add Trusted Devices in Firewall on RedHat 5 (or Centos 5)?
Mysql无法远程连接,求助 (转载)[求教]: openvpn over http-proxy dns 设置问题 (转载)
iptables高手看过来,哪些端口是必需的?iptables can kill the network connection if booting from nfs ?
service iptables start 咋没反应啊?能否建立一个虚拟网卡并监听端口?
相关话题的讨论汇总
话题: 8888话题: iptables话题: dport话题: localhost话题: setting
进入Linux版参与讨论
1 (共1页)
c******n
发帖数: 4965
1
for all traffic going to remote box 1.2.3.4 : 8888
I want to route the traffic to localhost : 8888, and I already have a ssh
tunnel
listening on localhost : 8888 to route the traffic to 1.2.3.4:8888
Thanks
I did something like this: but doesn't seem to work
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
--dport 8888 -j DNAT --to 192.168.0.2:80
/sbin/iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j ACCEPT
j*a
发帖数: 14423
2
/proc/sys/net/ipv4/ip_forward
把这个打成1

ACCEPT

【在 c******n 的大作中提到】
: for all traffic going to remote box 1.2.3.4 : 8888
: I want to route the traffic to localhost : 8888, and I already have a ssh
: tunnel
: listening on localhost : 8888 to route the traffic to 1.2.3.4:8888
: Thanks
: I did something like this: but doesn't seem to work
: /sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
: --dport 8888 -j DNAT --to 192.168.0.2:80
: /sbin/iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j ACCEPT

S*A
发帖数: 7142
3
how about:
iptables -t nat -A OUTPUT -p tcp -d 1.2.3.4 -j REDIRECT --to-ports 8888
That will redirect any port to port 8888. You can add --dport 8888
for only 1.2.3.4:8888

ACCEPT

【在 c******n 的大作中提到】
: for all traffic going to remote box 1.2.3.4 : 8888
: I want to route the traffic to localhost : 8888, and I already have a ssh
: tunnel
: listening on localhost : 8888 to route the traffic to 1.2.3.4:8888
: Thanks
: I did something like this: but doesn't seem to work
: /sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
: --dport 8888 -j DNAT --to 192.168.0.2:80
: /sbin/iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j ACCEPT

c******n
发帖数: 4965
4
thanks, I figured out, actually I need to redirect to localhost, not only
ports.
I ended up using
-t nat -A OUTPUT ....... -j DNAT --to 127.0.0.1:8888

【在 S*A 的大作中提到】
: how about:
: iptables -t nat -A OUTPUT -p tcp -d 1.2.3.4 -j REDIRECT --to-ports 8888
: That will redirect any port to port 8888. You can add --dport 8888
: for only 1.2.3.4:8888
:
: ACCEPT

S*A
发帖数: 7142
5
I think redirect by default is localhost.

【在 c******n 的大作中提到】
: thanks, I figured out, actually I need to redirect to localhost, not only
: ports.
: I ended up using
: -t nat -A OUTPUT ....... -j DNAT --to 127.0.0.1:8888

1 (共1页)
进入Linux版参与讨论
相关主题
能否建立一个虚拟网卡并监听端口?trick to use JMX on EC2 (转载)
问个firewall(iptables)的问题Mysql无法远程连接,求助 (转载)
how to build corp projects in ur EC2 boxiptables高手看过来,哪些端口是必需的?
echo $VAR is not working in bash shell script ?service iptables start 咋没反应啊?
help: iptables 问题再问个iptables rule的安全性问题
iptables禁用的ip存在哪里?请问个ssh登陆的问题
how to do this iptables setup?请教,如果建立家里电脑和学校电脑的连接。
simulate connection drop by iptables?请问网络高手
相关话题的讨论汇总
话题: 8888话题: iptables话题: dport话题: localhost话题: setting