I have a Ubuntu (18.04) linux server with a main network interface eth0
, which has 2 IP addresses assigned to it (via systemd-networkd
). The ip route
routing details are pretty simple, just send all outgoing stuff over IP1. However sometimes I need to make outgoing connections (i.e. ssh connections) that come out from the other IP address, IP2. I could just change the default route for this entire server, but is there a better way? Can I run magiccommand --use-ip=$IP2 ssh whatever
I have root on the machine. I tried firejail, but it errored with Error: the software is not supported for /31 networks
?!) I want to ssh into another server which only allows SSH connections from IP2, not IP1.
ip ro add $other_server/32 dev eth0 src $IP2
).