使用Solaris IPF将端口80的端点IPredirect到端口8080

有人用Solaris 10防火墙来重现ipf的后续iptables规则吗?

-A PREROUTING -p tcp -m tcp !--src-range 192.168.1.100-192.168.1.200 -dport 80 -j REDIRECT --to-ports 8080 

基本上我想采取所有stream量到端口80上的一个IP和redirect到端口8080(理想情况下,我只想这样做源IP不在一定范围内)

ipf.conf手册页:

..目前还没有一种方法来匹配那些不容易expression自己位置掩码的IP地址范围。

你可以使用多个规则来实现它,尽pipe它不漂亮。 ipnat.conf的以下规则应该满足您的要求(假设e1000g0是您的networking接口,并假设我已经正确完成了子网掩码计算):

 rdr e1000g0 ! from 192.168.1.0/24 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.0/26 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.64/27 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.96/30 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.201/32 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.202/31 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.204/30 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.208/28 to any port = 80 -> 127.0.0.1 port 8080 tcp rdr e1000g0 from 192.168.1.224/27 to any port = 80 -> 127.0.0.1 port 8080 tcp