Jac*_*cob 5 tomato nat iptables
我正在尝试使用本指南在 TomatoUSB 上启用多个 IP。我们的防火墙规则需要 NAT 并允许 1 对 1 到两个服务器。
/usr/sbin/ip addr add 208.x.x.133/30 dev vlan1
/usr/sbin/ip addr add 208.x.x.132/30 dev vlan1
/usr/sbin/iptables -t nat -I PREROUTING -d 208.x.x.133 -j DNAT --to-destination 192.168.7.100
/usr/sbin/iptables -t nat -I PREROUTING -d 208.x.x.132 -j DNAT --to-destination 192.168.7.130
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.7.130 --dport 25 -j ACCEPT
/usr/sbin/iptables -I FORWARD -p tcp -d 192.168.7.101 --dport 80 -j ACCEPT
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.7.130 -j SNAT --to 208.x.x.132
/usr/sbin/iptables -t nat -I POSTROUTING 1 -p all -s 192.168.7.101 -j SNAT --to 208.x.x.133
Run Code Online (Sandbox Code Playgroud)
我用指南写了这些,但路由器只转发1个IP,是我做错了还是指南错了?你能偶然指出什么是错误的吗?
#For each IP you need this command and this rule:
/sbin/ifconfig vlan1:0 208.x.x.130 netmask 255.255.255.224
/usr/sbin/iptables -t nat -I PREROUTING 2 -d 208.x.x.130 -j WANPREROUTING
#For each open port you need rules like these two:
/usr/sbin/iptables -t nat -A WANPREROUTING -p tcp -d 208.x.x.130 --dport 80 -j DNAT --to-destination 192.168.1.130:80
/usr/sbin/iptables -I wanin -p tcp -m tcp -d 192.168.1.130 --dport 80 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
在“管理”下的“防火墙”选项卡中输入这些规则。对我有用。
归档时间: |
|
查看次数: |
1914 次 |
最近记录: |