iptables应用

有什么用

管理Linux防火墙
开启Openwrt上的clash服务中转

实现方法



iptables 应用

在OpenWrt上面,
开放OpenWrt中OpenClash的HTTP & SOCKS5 Proxy Port

iptables -I INPUT -p tcp --dport 7893 -j ACCEPT


service iptables restart ## 这个是可选的,没执行成功
## OpenWrt上会自动马上生效,估计重启OP会重置,所以需要加到配置文件中

##查询 iptables 所有列表
iptables -L -n
可以查询到当前列表中的所有项目,包括新增进去的section

Chain INPUT (policy DROP)
target     prot opt source               destination         
SSR-SERVER-RULE  all  --  0.0.0.0/0            0.0.0.0/0           
REJECT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:443 /* OpenClash QUIC REJECT */ ! match-set china_ip_route dst reject-with icmp-port-unreachable
openclash_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            ! match-set localnetwork src
openclash_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            ! match-set localnetwork src
openclash_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            ! match-set localnetwork src
openclash_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            ! match-set localnetwork src
openclash_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            ! match-set localnetwork src
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:7893
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
input_rule  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3: Custom input rule chain */
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED /* !fw3 */
DROP       all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID /* !fw3 */
syn_flood  tcp  --  0.0.0.0/0            0.0.0.0/0            tcp flags:0x17/0x02 /* !fw3 */
zone_lan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_wan_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
zone_docker_input  all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */
reject     all  --  0.0.0.0/0            0.0.0.0/0            /* !fw3 */


posted @ 2023-11-27 07:41  CarlZeng  阅读(46)  评论(0编辑  收藏  举报