Changing routing rules if destination of port forwarding rule is not available.


New Member
Aug 22, 2021
Reaction score
I am currently using iptables on my raspberry pi to reroute publicly available port 8000 to a server. The server as well as the pi are running ssh on this port. So normally I connect to the server with ssh via the pi on port 8000, though as the server has a slight downtime sometimes as a failsafe for when the server is not running I would like to connect to the pi instead. Problem is I have only been granted access to a couple ports on the internet gateway, so I can't just allocate another port on the internet gateway just for the pi's ssh.

So here comes the question: Other than creating a funny bash script (maybe cron job) that pings the server every minute to check for connectivity and changes the ip forwarding rules accordingly, is there any way to achieve the desired effect I described. Also, the main traffic comes from another port - 8001. Is there any way to check if the server is off and WOL it, if there is traffic from the internet coming on port 8001. Again same requirements as with last question. Really what I am asking is, what solution would be used in a production enviroment?

Members online