Show last authors
1 **~ Table of Contents:**
2
3 {{toc/}}
4
5
6
7
8
9 = 1.  Introduction =
10
11
12 This feature is to filter the unwanted LoRaWAN packets. Purpose is to save the upstream traffic especially for a 4G cellular connection. If configured, gateway will process filter for below two types of message:
13
14 * Unconfirmed Data Up
15
16 * Confirmed Data Up
17
18
19
20 = 2.  FWD Filter Mechanism =
21
22
23 (% style="color:blue" %)**Support Devices:**
24
25 * Firmware Version > ** dragino-lgw~-~-v5.4.1658824252**
26
27 * LG308, DLOS8, LPS8, LIG16, LG308N, DLOS8N, LPS8N
28
29 (% style="color:blue" %)**Filtering rules:**
30
31 (% border="1" style="background-color:#f2f2f2; width:728px" %)
32 |=(% colspan="2" style="width: 351px;background-color:#4F81BD;color:white" %)Fport Filter|=(% colspan="2" style="width: 374px;background-color:#4F81BD;color:white" %)DevAddr Filter
33 |(% style="width:66px" %)**Level 0**|(% style="width:284px" %)Do nothing|(% style="width:68px" %)**Level 0**|(% style="width:306px" %)Do nothing
34 |(% style="width:66px" %)**Level 1**|(% style="width:284px" %)Filter only the Fport in the list|(% style="width:68px" %)**Level 1**|(% style="width:306px" %)Filter only the DevAddr in the list
35 |(% style="width:66px" %)**Level 2**|(% style="width:284px" %)Filter Fport that are not in the database|(% style="width:68px" %)**Level 2**|(% style="width:306px" %)Filter DevAddr that are not in the database
36
37 (((
38 [[image:image-20220726171434-6.png||_mstalt="432081" height="628" width="692"]]
39
40
41 (% style="color:blue" %)**Check if the filter is running**
42
43 [[image:image-20220726164533-3.png||_mstalt="431574" height="465" width="982"]]
44
45
46 == 2.1  Filter By Fport ==
47
48
49 The Gateway FPort filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
50
51
52 (% style="color:red" %)**Important Notice:**
53
54 * By default, Fport Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
55
56 * Fport Filter configured to (% style="color:blue" %)**Level=1**(%%). If the Fport in the list matches the Fport received by the gateway, it will be dropped.
57
58 * Fport Filter configured to (% style="color:blue" %)**Level=2**(%%). If the Fport in the list does not match the Fport received by the gateway, it will be dropped.
59
60 If you want to **forward only a certain Fport**, use level=2 and add the desired fport in the Filter value textbox. **Add Filter Value 0 to forward Join requests**.
61
62 [[image:image-20221129101012-1.png||_mstalt="425282"]]
63
64
65 In this case, we set Fport Filter Level=1 and add the filter (server | fport | 0), when the gateway receives a Lorawan packet with Fport=0, it will be dropped.
66
67 [[image:image-20220726165311-4.png||_mstalt="430287" height="718" width="798"]]
68
69
70 [[image:image-20220726170532-5.png||_mstalt="431054"]]
71
72
73 == 2.2  Filter By DevAddr ==
74
75
76 The Gateway DevAddr filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
77
78
79 (% style="color:red" %)**Important Notice:**
80
81 * By default, DevAddr Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
82
83 * DevAddr Filter configured to (% style="color:blue" %)**Level=1**(%%). If the DevAddr in the list matches the DevAddr received by the gateway, it will be dropped.
84
85 * DevAddr Filter configured to (% style="color:blue" %)**Level=2**(%%). If the DevAddr in the list does not match the DevAddr received by the gateway, it will be dropped.
86
87 In this case, we set DevAddr Filter Level=1 and add the filter (server | DevAddr | 12664787 ), when the gateway receives a Lorawan packet with DevAddr=12664787, it will be dropped.
88
89
90 [[image:image-20220726171555-7.png||_mstalt="433745" height="754" width="765"]]
91
92
93 [[image:image-20220726171808-8.png||_mstalt="434434"]]
94
95
96 (% style="color:red" %)**If user need to set the Secondary LoRaWAN Server Packet Filter, the configuration is similar to that above.**
97
98
99 == 2.3 Filter By NwkID ==
100
101
102 Since firmware , the gateway supports NwkID filter.
103
104 The Gateway NwkID filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
105
106
107 (% style="color:red" %)**Important Notice:**
108
109 * By default, NwkID Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
110
111 * NwkID Filter configured to (% style="color:blue" %)**Level=1**(%%). If the NwkID in the list matches the NwkID received by the gateway, it will be dropped.
112
113 * NwkID Filter configured to (% style="color:blue" %)**Level=2**(%%). If the NwkID in the list does not match the NwkID received by the gateway, it will be dropped.
114
115 In this case, we set NwkID Filter Level=0 and add the filter (server | NwkID | 13 ), when the gateway receives a Lorawan packet with NwkID=00000013, it will be dropped.
116
117 NwkID is calculated as follows: DevAddr counts shifted right by 25 bits
118
119 For example, devaddr=260B67F6 ,NwkID= 260B67F6 >> 25 = 13
120
121 [[image:image-20231012111032-1.png]]
122
123
124 == 2.4 Add Filter rules via Linux Command. ==
125
126
127 (% class="box infomessage" %)
128 (((
129 $ sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('$filter_name', '$filter_type', '$filter_value');"
130
131
132
133 name: server name. eg: server1/server2
134
135 type: filter type. eg: fport/devaddr
136
137 value: 0,1,2,3/000000
138 )))
139
140 (% class="box" %)
141 (((
142 eg:
143
144 sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('server1', 'fport', '1');"
145
146 sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('server1', 'devaddr', '00000000');"
147
148 sqlite3 /etc/lora/devskey "SELECT *from filter"
149 )))
150
151 [[image:image-20230519104800-2.png||_mstalt="428714"]]
152 )))
153
154
155 = 3.  PKT_FWD Filter Mechanism =
156
157
158 (% style="color:blue" %)**Support Devices:**
159
160 * Firmware Version >** lgw~-~-build-v5.4.1602379434-20201011-0926** [[Firmware Download>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/Firmware/Release/]]
161
162 * LG308, DLOS8
163
164 * LPS8
165
166 (% style="color:blue" %)**Fport & DevAddr Filter**
167
168 [[image:image-20220527150138-1.png||_mstalt="429598"]]
169
170
171 (% style="color:blue" %)**Check if the filter is running**
172
173 [[image:image-20220527150222-2.png||_mstalt="427921" height="379" width="1062"]]
174
175
176 == 3.1  Filter By Fport ==
177
178
179 The Gateway FPort filter will check all the below LoRaWAN message: Unconfirmed Data Up & Confirmed Data Up. If the packet's FPort doesn't match the FPort setting, it will be dropped.
180
181 (((
182 By default , this value is 0 means can upstream all packets with any FPort. We can set to other FPort so specify only one FPort works.
183 )))
184
185 [[image:image-20220527150303-3.png||_mstalt="428285"]]
186
187
188 In case we set the FPort filter to 45, and the End Node send a packet with Fport other than 45, it will be dropped.
189
190
191 == 3.2  Filter By DevAddr ==
192
193
194 Gateway will use a DevAddr mask to check if the Unconfirmed Data Up & Confirmed Data Up packets match the mask . If not, gateway will drop it.
195
196 [[image:image-20220527150404-4.png||_mstalt="429299"]]
197
198
199 This screenshot shows packets is dropped if DevAddr mask doesn't match.
200
201
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0