iptables应用

发布时间 2023-11-27 08:25:45作者: CarlZeng
title: iptables应用
tags: [iptables,debian]
url: https://www.carlzeng.top
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
date: 2023-11-14 10:39:43
categories:

有什么用

管理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 */