现在我们利用第一部分做好的WEB-PROXY 来进行限速
主要用QUEUE TREE 功能来限速
我们先来看看1些基本的环境情况
LAN 本地局域网,WAN 外网 本地局域网我这里是192.168.0.X 网段的,外网IP 58.59.133.217 ROS IP 192.168.0.1
admin@Legou] > in pr
# NAME TYPE RX-RATE TX-RATE MTU
0 R WAN ether 0 0 1500
1 R lan wlan 0 0 1500
[admin@Legou] > ip ad pr
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 58.59.133.217/24 58.59.133.0 58.59.133.255 WAN
1 192.168.0.1/24 192.168.0.0 192.168.0.255 lan
[admin@Legou] > ip web-proxy pr
enabled: yes
src-address: 0.0.0.0
port: 8080
hostname: "proxy"
transparent-proxy: yes
parent-proxy: 0.0.0.0:0
cache-administrator: "Please Contact QQ1980469"
max-object-size: 4096KiB
cache-drive: system
max-cache-size: none
max-ram-cache-size: unlimited
status: running
reserved-for-cache: 0KiB
reserved-for-ram-cache: 0KiB
Firewall NAT
[admin@Legou] ip firewall nat> pr
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat out-interface=WAN
src-address=192.168.0.0/24 action=masquerade
1 chain=dstnat in-interface=LAN src-address=192.168.0.0/24 dst-address=!192.168.0.1/32 protocol=tcp dst-port=80 action=redirect to-ports=8080
Mangle Setup
现在精彩的内容来了这个就是这个案例的核心部分
我们要做2条标记包的规则来标记下行和上行的数据包,上行的数据包我们就标记为upload 下行的数据包我们就标记为 download。因为用了web-proxy 之后上行的数据只有1条路,所以1条规则标记就可以了,而对于下行的数据因为有2条途经下载,所以我们需要2条规则来标记它们(通过web-proxy 下载的和非代理下载的)
[admin@Legou] > ip firewall mangle print
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; UPLOAD TRAFFIC
chain=prerouting in-interface=lan
src-address=192.168.0.0/24 action=mark-packet
new-packet-mark=upload passthrough=no
1 ;;; CONN-MARK
chain=forward src-address=192.168.0.0/24
action=mark-connection
new-connection-mark=conn passthrough=yes
2 ;;; DOWN-DIRECT CONNECTION (直接下载的标记)
chain=forward in-interface=WAN
connection-mark=conn action=mark-packet
new-packet-mark=download passthrough=no
3 ;;; DOWN-From PROXY (通过代理下载的标记 注意他们的区别)
chain=output out-interface=lan
dst-address=192.168.0.0/24 action=mark-packet
new-packet-mark=download passthrough=no
Queue Tree Setup
OK 我们现在就做1个QUEUE TREE 的设置把它们都限速起来。下载流就命名为downstream 上传流就命名为upstream。注意我们这里启用了上层流的限制,下载我们选择了LAN流,上传我们选择了全局的流量
[admin@Legou] > queue tree pr
Flags: X - disabled, I - invalid
0 name="downstream" parent=lan packet-mark=download
limit-at=256000 queue=default priority=8
max-limit=1024000 burst-limit=1500000
burst-threshold=750000 burst-time=15s
1 name="upstream" parent=global-in
packet-mark=upload limit-at=128000
queue=default priority=8
max-limit=256000 burst-limit=512000
burst-threshold=200000 burst-time=10s
OK 大功告成~!
主要用QUEUE TREE 功能来限速
我们先来看看1些基本的环境情况
LAN 本地局域网,WAN 外网 本地局域网我这里是192.168.0.X 网段的,外网IP 58.59.133.217 ROS IP 192.168.0.1
admin@Legou] > in pr
# NAME TYPE RX-RATE TX-RATE MTU
0 R WAN ether 0 0 1500
1 R lan wlan 0 0 1500
[admin@Legou] > ip ad pr
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 58.59.133.217/24 58.59.133.0 58.59.133.255 WAN
1 192.168.0.1/24 192.168.0.0 192.168.0.255 lan
[admin@Legou] > ip web-proxy pr
enabled: yes
src-address: 0.0.0.0
port: 8080
hostname: "proxy"
transparent-proxy: yes
parent-proxy: 0.0.0.0:0
cache-administrator: "Please Contact QQ1980469"
max-object-size: 4096KiB
cache-drive: system
max-cache-size: none
max-ram-cache-size: unlimited
status: running
reserved-for-cache: 0KiB
reserved-for-ram-cache: 0KiB
Firewall NAT
[admin@Legou] ip firewall nat> pr
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat out-interface=WAN
src-address=192.168.0.0/24 action=masquerade
1 chain=dstnat in-interface=LAN src-address=192.168.0.0/24 dst-address=!192.168.0.1/32 protocol=tcp dst-port=80 action=redirect to-ports=8080
Mangle Setup
现在精彩的内容来了这个就是这个案例的核心部分
我们要做2条标记包的规则来标记下行和上行的数据包,上行的数据包我们就标记为upload 下行的数据包我们就标记为 download。因为用了web-proxy 之后上行的数据只有1条路,所以1条规则标记就可以了,而对于下行的数据因为有2条途经下载,所以我们需要2条规则来标记它们(通过web-proxy 下载的和非代理下载的)
[admin@Legou] > ip firewall mangle print
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; UPLOAD TRAFFIC
chain=prerouting in-interface=lan
src-address=192.168.0.0/24 action=mark-packet
new-packet-mark=upload passthrough=no
1 ;;; CONN-MARK
chain=forward src-address=192.168.0.0/24
action=mark-connection
new-connection-mark=conn passthrough=yes
2 ;;; DOWN-DIRECT CONNECTION (直接下载的标记)
chain=forward in-interface=WAN
connection-mark=conn action=mark-packet
new-packet-mark=download passthrough=no
3 ;;; DOWN-From PROXY (通过代理下载的标记 注意他们的区别)
chain=output out-interface=lan
dst-address=192.168.0.0/24 action=mark-packet
new-packet-mark=download passthrough=no
Queue Tree Setup
OK 我们现在就做1个QUEUE TREE 的设置把它们都限速起来。下载流就命名为downstream 上传流就命名为upstream。注意我们这里启用了上层流的限制,下载我们选择了LAN流,上传我们选择了全局的流量
[admin@Legou] > queue tree pr
Flags: X - disabled, I - invalid
0 name="downstream" parent=lan packet-mark=download
limit-at=256000 queue=default priority=8
max-limit=1024000 burst-limit=1500000
burst-threshold=750000 burst-time=15s
1 name="upstream" parent=global-in
packet-mark=upload limit-at=128000
queue=default priority=8
max-limit=256000 burst-limit=512000
burst-threshold=200000 burst-time=10s
OK 大功告成~!