-
Notifications
You must be signed in to change notification settings - Fork 0
/
traffic-policy.sh
136 lines (112 loc) · 7.33 KB
/
traffic-policy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
## ----------------------------------------------------------------------------
## traffic-policy rules for ubiquiti edgeOS / edgeRouter / vyatta
## ...
## ----------------------------------------------------------------------------
## link download
set traffic-policy shaper 100-Download bandwidth auto
## ****************************************************************************
## link: garantia para openvpn
set traffic-policy shaper 100-Download class 10 bandwidth 80%
set traffic-policy shaper 100-Download class 10 burst 15k
set traffic-policy shaper 100-Download class 10 ceiling 100%
set traffic-policy shaper 100-Download class 10 description 'QOS OpenVPN'
set traffic-policy shaper 100-Download class 10 match icmp ip protocol icmp
set traffic-policy shaper 100-Download class 10 match openvpn1 ip destination port 1194
set traffic-policy shaper 100-Download class 10 match openvpn1 ip protocol udp
set traffic-policy shaper 100-Download class 10 match openvpn2 ip destination port 1294
set traffic-policy shaper 100-Download class 10 match openvpn2 ip protocol udp
set traffic-policy shaper 100-Download class 10 queue-type fair-queue
## ----------------------------------------------------------------------------
## link: garantia para ssh
set traffic-policy shaper 100-Download class 20 bandwidth 2%
set traffic-policy shaper 100-Download class 20 burst 15k
set traffic-policy shaper 100-Download class 20 ceiling 100%
set traffic-policy shaper 100-Download class 20 description SSH
set traffic-policy shaper 100-Download class 20 match ssh ip destination port 22
set traffic-policy shaper 100-Download class 20 match ssh ip dscp lowdelay
set traffic-policy shaper 100-Download class 20 match ssh ip protocol tcp
set traffic-policy shaper 100-Download class 20 queue-type fair-queue
## ----------------------------------------------------------------------------
## link1: garantia para dns
set traffic-policy shaper 100-Download class 30 bandwidth 2%
set traffic-policy shaper 100-Download class 30 burst 15k
set traffic-policy shaper 100-Download class 30 ceiling 100%
set traffic-policy shaper 100-Download class 30 description DNS
set traffic-policy shaper 100-Download class 30 match dns-t ip destination port 53
set traffic-policy shaper 100-Download class 30 match dns-t ip protocol tcp
set traffic-policy shaper 100-Download class 30 match dns-u ip destination port 53
set traffic-policy shaper 100-Download class 30 match dns-u ip protocol udp
set traffic-policy shaper 100-Download class 30 queue-type fair-queue
## ----------------------------------------------------------------------------
## link: garantia para servicos de email
set traffic-policy shaper 100-Download class 40 bandwidth 5%
set traffic-policy shaper 100-Download class 40 burst 15k
set traffic-policy shaper 100-Download class 40 ceiling 100%
set traffic-policy shaper 100-Download class 40 description Outros
set traffic-policy shaper 100-Download class 40 match imap ip destination port 143
set traffic-policy shaper 100-Download class 40 match imap ip protocol tcp
set traffic-policy shaper 100-Download class 40 match imap2 ip destination port 993
set traffic-policy shaper 100-Download class 40 match imap2 ip protocol tcp
set traffic-policy shaper 100-Download class 40 match pop3 ip destination port 110
set traffic-policy shaper 100-Download class 40 match pop3 ip protocol tcp
set traffic-policy shaper 100-Download class 40 match pop3s ip destination port 995
set traffic-policy shaper 100-Download class 40 match pop3s ip protocol tcp
set traffic-policy shaper 100-Download class 40 match smtp ip destination port 25
set traffic-policy shaper 100-Download class 40 match smtp ip protocol tcp
set traffic-policy shaper 100-Download class 40 match smtp2 ip destination port 587
set traffic-policy shaper 100-Download class 40 match smtp2 ip protocol tcp
set traffic-policy shaper 100-Download class 40 match smtps ip destination port 465
set traffic-policy shaper 100-Download class 40 match smtps ip protocol tcp
set traffic-policy shaper 100-Download class 40 queue-type fair-queue
## ----------------------------------------------------------------------------
## link: garantia para demais servicos (navegacao e outros servicos)
set traffic-policy shaper 100-Download default bandwidth 11%
set traffic-policy shaper 100-Download default burst 15k
set traffic-policy shaper 100-Download default ceiling 100%
set traffic-policy shaper 100-Download default queue-type fair-queue
## ----------------------------------------------------------------------------
## link: upload
set traffic-policy shaper 100-Upload bandwidth auto
## ****************************************************************************
## link: garantia para openvpn
set traffic-policy shaper 100-Upload class 10 bandwidth 80%
set traffic-policy shaper 100-Upload class 10 burst 15k
set traffic-policy shaper 100-Upload class 10 description VPN
set traffic-policy shaper 100-Upload class 10 match icmp ip protocol icmp
set traffic-policy shaper 100-Upload class 10 match openvpn ip destination port 1194
set traffic-policy shaper 100-Upload class 10 match openvpn ip protocol udp
set traffic-policy shaper 100-Upload class 10 match openvpn2 ip destination port 1294
set traffic-policy shaper 100-Upload class 10 match openvpn2 ip protocol udp
set traffic-policy shaper 100-Upload class 10 queue-type fair-queue
## ----------------------------------------------------------------------------
## link: garantia para servicos de email
set traffic-policy shaper 100-Upload class 20 bandwidth 5%
set traffic-policy shaper 100-Upload class 20 burst 15k
set traffic-policy shaper 100-Upload class 20 description Outros
set traffic-policy shaper 100-Upload class 20 match imap ip destination port 143
set traffic-policy shaper 100-Upload class 20 match imap ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match imap2 ip destination port 993
set traffic-policy shaper 100-Upload class 20 match imap2 ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match pop3 ip destination port 110
set traffic-policy shaper 100-Upload class 20 match pop3 ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match pop3s ip destination port 995
set traffic-policy shaper 100-Upload class 20 match pop3s ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match smtp ip destination port 25
set traffic-policy shaper 100-Upload class 20 match smtp ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match smtp2 ip destination port 587
set traffic-policy shaper 100-Upload class 20 match smtp2 ip protocol tcp
set traffic-policy shaper 100-Upload class 20 match smtps ip destination port 465
set traffic-policy shaper 100-Upload class 20 match smtps ip protocol tcp
set traffic-policy shaper 100-Upload class 20 queue-type fair-queue
## ----------------------------------------------------------------------------
## link: garantia para demais servicos
set traffic-policy shaper 100-Upload default bandwidth 15%
set traffic-policy shaper 100-Upload default burst 15k
set traffic-policy shaper 100-Upload default queue-type fair-queue
## ----------------------------------------------------------------------------
## aplicar esta regra na interface LAN
set interfaces ethernet eth0 traffic-policy out 100-Download
## aplicar esta regra nas interfaces WAN
set interfaces ethernet eth1 traffic-policy out 100-Upload