Linux网络配置:防火墙、QoS与VPN部署实践
1. 防火墙与QoS配置
1.1 协议流量标记
为了限制BitTorrent和DC++协议的带宽使用,我们使用L7 - filter标记匹配的数据包,并通过 tc 工具进行带宽限制。具体操作是使用 nfmark 5 标记相关数据包,示例命令如下:
iptables -t mangle -A POSTROUTING –o eth2 -m layer7 --l7proto bittorrent -j MARK --set-mark 5
iptables -t mangle -A POSTROUTING –o eth2 -m layer7 --l7proto directconnect -j MARK --set-mark 5
1.2 防火墙脚本设置
在Linux路由器上,我们创建一个脚本来按正确顺序添加防火墙规则,以下是脚本示例:
#!/bin/bash
#define where iptables is
IPT=/sbin/iptables
############# Begin the NAT table opperations ######
#Flush all the rules in the nat table
$IPT -t nat -F
#SNAT sales and accounting to port 53 UDP (DNS)
$IPT -t nat -A
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



