I installed openvpn on a remote server and had my ssh sessions break because the default route had been changed and so, packets sent to me (at client) were going out through the VPN and, presumably, either not landing at my computer or being rejected due to incorrect source address.
I paste below a solution which I COMPLETELY don't understand. They do work though. I just pasted them into /etc/rc.local
ip rule add from $(ip route get 1 | grep -Po '(?<=src )(\S+)') table 128
ip route add table 128 to $(ip route get 1 | grep -Po '(?<=src )(\S+)')/32 dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
ip route add table 128 default via $(ip -4 route ls | grep default | grep -Po '(?<=via )(\S+)')
No comments:
Post a Comment