linux 查看网卡是否有网线连接
ethtool eth0
[root@test ~]# ethtool eth0
Settings for eth0:
Current message level: 0x00000007 (7)
Link detected: yes(表示插线), No(表示未插线)
防火墙规则链接跟踪
chain WANSTATEDETECTION(网络状态跟踪)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0
state RELATED, ESTABLISHED
此处就开启了链接跟踪。对于原地址和目的地址并且状态为:established的就通过。一般会挂在 INPUT chain上,用于对出去的链接进行跟踪。
1.防火墙创建首先创建表链
iptables -N WANSTATEDETECTION
2.将表链加入INPUT规则
iptables -A INPUT -j WANSTATEDETECTION
3. 修改表链,允许链接跟踪
iptables -I WANSTATEDETECTION -m state --state ESTABLISHED, RELATED -j ACCEPT