Re: Unusual packet forwarding task

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Martin!

I'm not at the point of adding code to this project yet ... close but
not yet :) This will certainly give me a head start if that happens.
-> Rob


On Fri, Oct 25, 2024 at 4:39 AM Martin Tonusoo <martin@xxxxxxxxxx> wrote:
>
> Hi Rob,
>
> perhaps something like this will do:
> https://gist.github.com/tonusoo/0490bc5cf564689f3999f1de4eef098d
>
> On Debian based distributions the dependencies can be installed with
> "apt install --no-install-recommends python3-pcapy python3-scapy".
> Pcapy is a wrapper library for libpcap which processes the filter in
> Berkeley Packet Filter syntax, builds the binary bytecode and
> eventually sends it to the kernel via the SO_ATTACH_FILTER. Thus,
> there should be very little impact on throughput or CPU usage.
>
> I used a following systemd service to manage the script:
>
> root@deb12-1:~# systemctl cat packet-forwarder
> # /etc/systemd/system/packet-forwarder.service
> [Unit]
> Description=Forwards certain packets received on eth0 out from eth1
> After=network.target
>
> [Service]
> Type=simple
> Restart=always
> ExecStart=/usr/local/sbin/packet-forwarder.py
>
> [Install]
> WantedBy=multi-user.target
> root@deb12-1:~#
>
>
> Martin





[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux