Last modified by Kilight Cao on 2024/05/17 10:07

Hide last authors
Xiaoling 11.2 1 **~ Table of Contents:**
Xiaoling 1.2 2
Xiaoling 1.1 3 {{toc/}}
4
Xiaoling 9.1 5
6
7
8
Xiaoling 35.2 9 = 1.  Introduction =
Xiaoling 1.1 10
Xiaoling 33.2 11
Xiaoling 1.2 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:
Xiaoling 1.1 13
Xiaoling 1.2 14 * Unconfirmed Data Up
Xiaoling 35.4 15
Xiaoling 1.2 16 * Confirmed Data Up
Xiaoling 1.1 17
Kilight Cao 54.1 18 = (% data-sider-select-id="a6563476-6957-435c-a8e6-64925b496a09" %)2.  FWD Filter Mechanism(%%) =
Xiaoling 33.2 19
Kilight Cao 13.1 20
Xiaoling 41.4 21 (% style="color:blue" %)**Support Devices:**
Kilight Cao 13.1 22
Kilight Cao 54.1 23 * Firmware Version > (% data-sider-select-id="96ad6b3a-7145-4307-84cb-f96bf2963143" %)** **(% data-sider-select-id="4543141b-3f38-468e-b55c-42b857536714" %)**dragino-lgw~-~-v5.4.1699325460**
Xiaoling 35.4 24
Kilight Cao 30.1 25 * LG308, DLOS8, LPS8, LIG16, LG308N, DLOS8N, LPS8N
Kilight Cao 13.1 26
Xiaoling 41.4 27 (% style="color:blue" %)**Filtering rules:**
Kilight Cao 13.1 28
Kilight Cao 54.1 29 (% border="1" style="background-color:#f2f2f2; width:1063px" %)
30 |=(% colspan="2" data-sider-select-id="2963d404-f9df-47a3-9421-ad8343c28190" style="width: 326px; background-color: rgb(79, 129, 189); color: white;" %)Fport Filters|=(% colspan="2" data-sider-select-id="b75fb8fe-614b-43de-866c-7df1f0e1351c" style="width: 328px; background-color: rgb(79, 129, 189); color: white;" %)DevAddr Filter|=(% colspan="2" data-sider-select-id="b75fb8fe-614b-43de-866c-7df1f0e1351c" rowspan="1" style="width: 403px; background-color: rgb(79, 129, 189); color: white;" %)(% data-sider-select-id="66b78721-94c2-42f2-9700-2d53738af37c" %)NwkID Filter
31 |(% data-sider-select-id="48ec1aac-dbc7-42b1-b4cf-5efa6cebeb7b" style="width:66px" %)**Level 0**|(% style="width:259px" %)Do nothing|(% data-sider-select-id="93e39a51-390d-40f8-b384-3e2013f30f59" style="width:67px" %)**Level 0**|(% data-sider-select-id="7a32435a-480f-4394-8307-c01a996c309e" style="width:261px" %)Do nothing|(% data-sider-select-id="bbac18ba-6ebe-4919-a75e-006067aa9702" style="width:78px" %)(% data-sider-select-id="a5a992a8-2aba-48cb-b876-6441732df6a5" %)**Level 0**|(% style="width:326px" %)Do nothing
32 |(% style="width:66px" %)**Level 1**|(% style="width:259px" %)Filter only the Fport in the list|(% style="width:67px" %)**Level 1**|(% data-sider-select-id="97e7e7ae-2f87-4c08-9730-569c9628f9a7" style="width:261px" %)Filter only the DevAddr in the list|(% data-sider-select-id="5a23d47e-2f84-4f36-a62b-d3b2bd094087" style="width:78px" %)(% data-sider-select-id="8dfd7850-dada-4703-bf77-3dc67e3d3e13" %)**Level 1**|(% data-sider-select-id="87522df9-2acc-4194-9b27-61085236248e" style="width:326px" %)Filter only the NwkID in the list
33 |(% style="width:66px" %)**Level 2**|(% style="width:259px" %)Filter Fport that are not in the database|(% style="width:67px" %)**Level 2**|(% data-sider-select-id="58fb49e7-bec6-4701-8dd9-8c4a3a3138fa" style="width:261px" %)Filter DevAddr that are not in the database|(% data-sider-select-id="41c0816f-cc2a-45ce-a04c-5499e54b8347" style="width:78px" %)(% data-sider-select-id="1d8fbf98-cc3e-430c-824c-fe435a1b7330" %)**Level 2**|(% data-sider-select-id="323e6d5b-9fd3-4ec8-a767-ac5339de7160" style="width:326px" %)Filter NWkID that are not in the database
Kilight Cao 13.1 34
35 (((
Kilight Cao 54.1 36 [[image:image-20240517094256-2.png||height="785" width="976"]]
Kilight Cao 13.1 37
Kilight Cao 24.1 38
Xiaoling 41.4 39 (% style="color:blue" %)**Check if the filter is running**
Kilight Cao 24.1 40
Kilight Cao 54.1 41 [[image:image-20240517094552-3.png||height="568" width="974"]]
Kilight Cao 24.1 42
43
Xiaoling 35.2 44 == 2.1  Filter By Fport ==
Kilight Cao 24.1 45
46
47 The Gateway FPort filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
48
49
50 (% style="color:red" %)**Important Notice:**
51
Kilight Cao 26.1 52 * By default, Fport Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
Kilight Cao 24.1 53
Kilight Cao 26.1 54 * 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.
Kilight Cao 24.1 55
Kilight Cao 26.1 56 * 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.
Kilight Cao 24.1 57
Kilight Cao 54.1 58 (% data-sider-select-id="a52abdcb-0f07-49a7-a84d-dbbdfc7912d8" %)
Jean-Philippe Gagné 35.1 59 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**.
Kilight Cao 24.1 60
Kilight Cao 54.1 61 [[image:image-20240517094721-4.png]]
Jean-Philippe Gagné 35.1 62
Xiaoling 35.2 63
Jean-Philippe Gagné 35.1 64
Xiaoling 35.2 65 == 2.2  Filter By DevAddr ==
Xiaoling 33.2 66
Kilight Cao 24.1 67
Kilight Cao 33.1 68 The Gateway DevAddr filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
Kilight Cao 24.1 69
Kilight Cao 25.1 70
Kilight Cao 24.1 71 (% style="color:red" %)**Important Notice:**
72
Kilight Cao 26.1 73 * By default, DevAddr Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
Kilight Cao 24.1 74
Kilight Cao 26.1 75 * 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.
Kilight Cao 24.1 76
Kilight Cao 26.1 77 * 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.
Kilight Cao 24.1 78
Kilight Cao 54.1 79 (% data-sider-select-id="1c5a3ce7-94da-41b2-b4f5-a83321d225e4" %)
Kilight Cao 41.1 80 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.
Kilight Cao 24.1 81
Kilight Cao 54.1 82 [[image:image-20240517095315-5.png||height="373" width="1085"]]
Xiaoling 33.2 83
Kilight Cao 24.1 84
85
Kilight Cao 27.1 86
Kilight Cao 54.1 87 == (% data-sider-select-id="66b78721-94c2-42f2-9700-2d53738af37c" %)2.3 Filter By NwkID(%%) ==
Kilight Cao 27.1 88
89
Kilight Cao 41.1 90 The Gateway NwkID filter will check all the below LoRaWAN messages: Unconfirmed Data Up & Confirmed Data Up.
91
92
93 (% style="color:red" %)**Important Notice:**
94
95 * By default, NwkID Filter (% style="color:blue" %)**Level=0**(%%). which means do nothing
96
97 * 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.
98
99 * 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.
100
Kilight Cao 45.1 101 In this case, we set NwkID Filter Level=0 and add the filter (server | NwkID | 13 ), when the gateway receives a packet that is not NwkID=00000013, it will be dropped.
Kilight Cao 41.1 102
103 NwkID is calculated as follows: DevAddr counts shifted right by 25 bits
104
Kilight Cao 45.1 105 For example, Devaddr=01CC1907,NwkID= 01CC1907 >> 25 = 0
Kilight Cao 41.1 106
Kilight Cao 45.1 107 Devaddr=260B748A,NwkID= 260B748A >> 25 = 13
Kilight Cao 41.1 108
Kilight Cao 54.1 109 [[image:image-20240517095458-6.png]]
Kilight Cao 41.1 110
Kilight Cao 45.1 111
112
113
Kilight Cao 54.1 114 (% data-sider-select-id="77834038-9f62-4c79-9e9e-8761b751e708" style="color:red" %)**If user need to set the Secondary LoRaWAN Server Packet Filter, the configuration is similar to that above.**
Kilight Cao 41.1 115
Kilight Cao 54.1 116 == (% data-sider-select-id="94c45e8c-41a9-45df-bd1c-0253901140bb" %)2.4 Add Filter rules via Linux Command.(%%) ==
Kilight Cao 41.1 117
Kilight Cao 54.1 118
Xiaoye 38.1 119 (% class="box infomessage" %)
120 (((
121 $ sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('$filter_name', '$filter_type', '$filter_value');"
122
123
124
125 name: server name. eg: server1/server2
126
127 type: filter type. eg: fport/devaddr
128
129 value: 0,1,2,3/000000
130 )))
131
132 (% class="box" %)
133 (((
134 eg:
135
136 sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('server1', 'fport', '1');"
137
138 sqlite3 /etc/lora/devskey "INSERT INTO filter (name, type, value ) VALUES ('server1', 'devaddr', '00000000');"
139
140 sqlite3 /etc/lora/devskey "SELECT *from filter"
141 )))
142
Xiaoling 41.6 143 [[image:image-20230519104800-2.png||_mstalt="428714"]]
Xiaoling 41.5 144 )))
Xiaoye 38.1 145
146
Kilight Cao 54.1 147 (% data-sider-select-id="e156bc15-52eb-407c-ac7d-e4f5dc536721" %)
148 == (% data-sider-select-id="94c45e8c-41a9-45df-bd1c-0253901140bb" %)2.5 (%%)Check results ==
149
150
151 (% data-sider-select-id="eb82d072-f936-4456-812b-2d4072ad5fe7" %)
152 After the configuration is complete, you can enable Logread Debug level on System~-~->General, return to LoRaWAN~-~->Semtech UDP, and click "Save&Apply".
153
154 [[image:image-20240517100303-7.png||height="784" width="1120"]]
155
156
Xiaoling 35.2 157 = 3.  PKT_FWD Filter Mechanism =
Kilight Cao 27.1 158
159
Xiaoling 41.4 160 (% style="color:blue" %)**Support Devices:**
Kilight Cao 27.1 161
162 * 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/]]
Xiaoling 35.4 163
Kilight Cao 27.1 164 * LG308, DLOS8
Xiaoling 35.4 165
Kilight Cao 27.1 166 * LPS8
167
Xiaoling 41.4 168 (% style="color:blue" %)**Fport & DevAddr Filter**
Xiaoling 35.4 169
Kilight Cao 41.1 170 [[image:image-20220527150138-1.png||_mstalt="429598"]]
Kilight Cao 27.1 171
172
Xiaoling 41.5 173 (% style="color:blue" %)**Check if the filter is running**
Kilight Cao 27.1 174
Kilight Cao 41.1 175 [[image:image-20220527150222-2.png||_mstalt="427921" height="379" width="1062"]]
Kilight Cao 27.1 176
177
Xiaoling 35.2 178 == 3.1  Filter By Fport ==
Kilight Cao 27.1 179
180
181 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.
182
183 (((
184 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.
185 )))
186
Kilight Cao 41.1 187 [[image:image-20220527150303-3.png||_mstalt="428285"]]
Kilight Cao 27.1 188
189
190 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.
191
192
Xiaoling 35.2 193 == 3.2  Filter By DevAddr ==
Xiaoling 33.2 194
Kilight Cao 27.1 195
196 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.
197
Kilight Cao 41.1 198 [[image:image-20220527150404-4.png||_mstalt="429299"]]
Kilight Cao 27.1 199
200
201 This screenshot shows packets is dropped if DevAddr mask doesn't match.
202
203
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0