I am basically trying to SSH into a RPi that is always connected to a VPN, which makes SSH fails. I received few ideas on how to solve the issue, and the best IMHO is to make the SSH traffic go through a 2nd routing table.
The problem is this is rather complicated for a network noob like me. So I was wondering whether I could get some pointers to get started, as I am completely lost. Especially on how to mark SSH traffic to go through the 2nd table.
EDIT: Thanks again for the answer Marius. I finally found some time to work on this, and here is what I have done.
- sudo modprobe ip_conntrack
- sudo iptables -A INPUT -m state --state NEW -p tcp --dport 22 -j CONNMARK --set-mark 1
- then as root:
- echo 200 hma >> /etc/iproute2/rt_tables
- ip route add 10.0.1.0/24 dev eth0 table hma
- ip rule add fwmark 1 table hma
but it does not seem to work. As I am really not sure as to what to do, this is not really a surprise.
More specifically, I am really unsure about 2) and 4). Is 2) correct at all? And for 4), where do I find the right IP to add, what does the /24 mean, and should it go through eth0 (my vpn appears to be tun0)?
EDIT2: After a reboot, I have actually lost SSH access to the pi :(