tcpstreamsniffer
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tcpstreamsniffer [2025/05/08 17:14] – created millerjs | tcpstreamsniffer [2025/05/08 17:17] (current) – [Services] millerjs | ||
---|---|---|---|
Line 2: | Line 2: | ||
I guess rebroadcaster isn't quite the right term, but what this script does is capture a TCP stream from a mirrored switch port and make it available on a local socket for use by other tools. For example, streaming to an NTRIP mountpoint. | I guess rebroadcaster isn't quite the right term, but what this script does is capture a TCP stream from a mirrored switch port and make it available on a local socket for use by other tools. For example, streaming to an NTRIP mountpoint. | ||
- | === Usage === | + | ==== Usage ==== |
Deploying this script has a few requirements. In my example, a network device with IP address 172.16.0.108 is transmitting a TCP stream on port 2201. On the switch this device is connected to, its port is mirrored to another, so any traffic sent or received by that device can be transparrently rebroadcasted to another device. You'll need another device with a network interface that supports being run in promiscious mode so that it can capture the traffic. This should be separate from its primary network interface. The second network interface will need to be put into promiscious mode - an example systemd service definition is provided below. | Deploying this script has a few requirements. In my example, a network device with IP address 172.16.0.108 is transmitting a TCP stream on port 2201. On the switch this device is connected to, its port is mirrored to another, so any traffic sent or received by that device can be transparrently rebroadcasted to another device. You'll need another device with a network interface that supports being run in promiscious mode so that it can capture the traffic. This should be separate from its primary network interface. The second network interface will need to be put into promiscious mode - an example systemd service definition is provided below. | ||
- | <file promisc-enp2s0.service> | + | ==== Services ==== |
+ | < | ||
[Unit] | [Unit] | ||
Description=Control promiscuous mode for interface enp2s0 | Description=Control promiscuous mode for interface enp2s0 | ||
Line 21: | Line 22: | ||
</ | </ | ||
- | === Script === | + | <file ini sniffedstream2newstream.service> |
+ | [Unit] | ||
+ | Description=Hyfix2TCPStream | ||
+ | After=network.target | ||
+ | Wants=network-online.target | ||
+ | After=network-online.target | ||
+ | |||
+ | [Service] | ||
+ | ExecStart=/ | ||
+ | Restart=always | ||
+ | RuntimeMaxSec=43200 | ||
+ | RestartSec=10 | ||
+ | TimeoutStartSec=30 | ||
+ | User=root | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=default.target | ||
+ | </ | ||
+ | ==== Script | ||
<file python sniffedstream2newstream.py> | <file python sniffedstream2newstream.py> | ||
# | # |
tcpstreamsniffer.1746724462.txt.gz · Last modified: 2025/05/08 17:14 by millerjs