shaping: introduce downstream shaping
This commit is contained in:
parent
ab68c6c879
commit
64685f254f
|
@ -1,6 +1,6 @@
|
||||||
upstream:
|
upstream:
|
||||||
interface: ipredator
|
interface: ipredator
|
||||||
nat66-interface: ipredator
|
nat66-interface: ipredator
|
||||||
up-bandwidth: 10000
|
up-bandwidth: 10400
|
||||||
flow-keys: nfct-src
|
down-bandwidth: 180000
|
||||||
flows: 4096
|
flows: 4096
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
upstream:
|
upstream:
|
||||||
interface: up1
|
interface: up1
|
||||||
nat66-interface: 6to4
|
nat66-interface: 6to4
|
||||||
up-bandwidth: 6200
|
up-bandwidth: 6000
|
||||||
flow-keys: nfct-src
|
down-bandwidth: 95000
|
||||||
flows: 2048
|
flows: 2048
|
||||||
|
|
|
@ -2,7 +2,7 @@ upstream:
|
||||||
interface: up2
|
interface: up2
|
||||||
nat66-interface: up2
|
nat66-interface: up2
|
||||||
up-bandwidth: 12400
|
up-bandwidth: 12400
|
||||||
flow-keys: nfct-src
|
down-bandwidth: 195000
|
||||||
flows: 2048
|
flows: 2048
|
||||||
|
|
||||||
port-forwarding:
|
port-forwarding:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "$IFACE" = "{{ pillar['upstream']['interface'] }}" ]; then
|
if [ "$IFACE" = "{{ iface }}" ]; then
|
||||||
tc qdisc del dev $IFACE root 2> /dev/null > /dev/null
|
tc qdisc del dev $IFACE root 2> /dev/null > /dev/null
|
||||||
tc qdisc add dev $IFACE root handle 1 hfsc default 1
|
tc qdisc add dev $IFACE root handle 1 hfsc default 1
|
||||||
tc class add dev $IFACE parent 1: classid 1:1 hfsc sc rate {{ pillar['upstream']['up-bandwidth'] }}kbit ul rate {{ pillar['upstream']['up-bandwidth'] }}kbit
|
tc class add dev $IFACE parent 1: classid 1:1 hfsc sc rate {{ bandwidth }}kbit ul rate {{ bandwidth }}kbit
|
||||||
tc qdisc add dev $IFACE parent 1:1 handle 11: fq_codel flows {{ pillar['upstream']['flows'] }}
|
tc qdisc add dev $IFACE parent 1:1 handle 11: fq_codel flows {{ pillar['upstream']['flows'] }}
|
||||||
tc filter add dev $IFACE parent 11: handle 11 protocol all flow hash keys {{ pillar['upstream']['flow-keys'] }} divisor {{ pillar['upstream']['flows'] }}
|
tc filter add dev $IFACE parent 11: handle 11 protocol all flow hash keys {{ flow_keys }} divisor {{ pillar['upstream']['flows'] }}
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,10 +3,30 @@
|
||||||
iproute2:
|
iproute2:
|
||||||
pkg.installed: []
|
pkg.installed: []
|
||||||
|
|
||||||
/etc/network/if-up.d/shaping:
|
{%- if upstream.get('up-bandwidth') %}
|
||||||
|
/etc/network/if-up.d/up-shaping:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://upstream/shaping
|
- source: salt://upstream/shaping
|
||||||
- template: 'jinja'
|
- template: 'jinja'
|
||||||
|
- context:
|
||||||
|
iface: {{ pillar['upstream']['interface'] }}
|
||||||
|
bandwidth: {{ pillar['upstream']['up-bandwidth'] }}
|
||||||
|
flow_keys: nfct-src
|
||||||
- mode: 755
|
- mode: 755
|
||||||
- require:
|
- require:
|
||||||
- pkg: iproute2
|
- pkg: iproute2
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if upstream.get('down-bandwidth') %}
|
||||||
|
/etc/network/if-up.d/down-shaping:
|
||||||
|
file.managed:
|
||||||
|
- source: salt://upstream/shaping
|
||||||
|
- template: 'jinja'
|
||||||
|
- context:
|
||||||
|
iface: core
|
||||||
|
bandwidth: {{ pillar['upstream']['down-bandwidth'] }}
|
||||||
|
flow_keys: nfct-dst
|
||||||
|
- mode: 755
|
||||||
|
- require:
|
||||||
|
- pkg: iproute2
|
||||||
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in New Issue