Skip to content

Instantly share code, notes, and snippets.

@LevitatingBusinessMan
Created June 7, 2024 01:29
Show Gist options
  • Save LevitatingBusinessMan/cda9ecd12a7868f3b4606c5877c4f02d to your computer and use it in GitHub Desktop.
Save LevitatingBusinessMan/cda9ecd12a7868f3b4606c5877c4f02d to your computer and use it in GitHub Desktop.
[Match]
Name=eth0
[Network]
Address=10.20.30.40/24
Address=10.20.30.135/24
Gateway=10.20.30.1
DNS=10.20.30.1
From=10.20.30.40
#!/usr/bin/env sh
# add the ip
# handled by systemd-networkd
# ip addr add 10.20.30.135/24 dev eth0
# change the default route to include standard src ip
# handled by systemd-networkd
# ip route change default via 10.20.30.1 src 10.20.30.40
# Create a new routing table 100 with other src ip
ip route add default via 10.20.30.1 src 10.20.30.135 table 100
ip route list table 100
# Make mark 33 use table 100
ip rule add fwmark 33 table 100
# Mark transmissions outgoing packets with 33
iptables -A OUTPUT -m cgroup --path /system.slice/transmission.service -j MARK --set-mark 33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment