Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
517 B
2
Indexable
Never
#!/bin/bash

readarray -t interfaces < <(basename -a /sys/class/net/* | awk '/eth/{print $1}')
gateway=$(ip route | awk '/default / {print $3}'y)
network=$(ip route show dev "$interfaces" | awk 'NR==2 {print $1}')

for interfaces in "${interfaces[@]}";
do
ip rule add from "$network" table vrack
ip route add "$network" dev "$interfaces" table vrack
ip route add default via "$gateway" dev "$interfaces" table vrack
ip route add "$network" dev "$interfaces" table vrack

done

systemctl restart NetworkManager.service
Leave a Comment