Outputting LoRaWAN data as PCAP
Description
This uses LoRa packet forwarder to forward the LoRa packets to a localhost with port 1700. Once packet forwarder is running, another process executes tcpdump that captures a loopback interface and outputs it as a pcap file. Afterwards, we remove the Ethernet, IP and UDP headers (14+20+8) of the pcap file and set linktype to user (147). Finally, the edited pcap file is loaded to Wireshark, where the protocol is changed to LoRaWAN.
Instructions
-
Users should first flash the correct configuration of LoRadar on the microSD card.
-
Clone the
local_packet_forwaderdirectory to the Raspberry Pi. -
Install the following dependencies.
sudo apt-get update -y sudo apt-get install -y bittwist sudo apt-get install -y tcpdump sudo apt-get install -y screen -
Create a screen session.
screen -
Within this screen session,
cdto the 'local_packet_forwarder' directory within Raspberry Pi. Execute the following to start capturing packets on port 1700 and outputting it ascapture.pcap:cd lora_pkt_fwd/ sudo tcpdump -s 0 -AUq port 1700 -w capture.pcap -
Detach from the screen by pressing
ctrl + a + don the keyboard. -
Start a new screen session by typing
screenin the terminal. -
cdto the 'local_packet_forwarder' directory within Raspberry Pi. Execute the following to start forwarding packets to localhost:cd lora_pkt_fwd/ sudo chmod +x lora_pkt_fwd sudo ./lora_pkt_fwd -
To terminate the packet forwarder session, press
ctrl + con the keyboard and typeexitin the terminal to end the screen session. -
Navigate to the other screen by typing
screen -r -din the terminal. -
End the packet capture session by pressing
ctrl + con the keyboard. You will now see a newcapture.pcapfile created in the directory. -
Process the .pcap data to remove the unnecessary Ethernet, IP and UDP headers (14+20+8) of the pcap file and set linktype to user (147). This process will intake the
capture.pcapfile and output it asprocessed_capture.pcap.bittwiste -I capture.pcap -O dump_dlt_user.pcap -M 147 -D 1-42 -
Open the
processed_capture.pcapfile in Wireshark. -
Navigate to
Edit -> Preferences -> Protocols -> DLT_USER -> Edit.... -
Input
lorawanas the Payload protocol,14as the header size, then click OK. -
You will now see LoRaWAN fields under the frame information.