Skip to content

Instantly share code, notes, and snippets.

@dungsaga
Last active January 14, 2020 05:59
Show Gist options
  • Save dungsaga/fc8bd2662d927f71c9e28f9339aa3775 to your computer and use it in GitHub Desktop.
Save dungsaga/fc8bd2662d927f71c9e28f9339aa3775 to your computer and use it in GitHub Desktop.
Access remote host via a specific network interface
#!/bin/bash
# SSH can access a remote host using a specified network interface
# just use -b with local address of that network interface
ssh -b 10.20.30.40 [email protected]
# add a route to a remote host via a specified network interface
sudo ip route add 12.34.56.0/24 via 40.30.20.10 dev wlp2s0
# delete a route in the routing table
sudo ip route delete 12.34.56.0/24
# see current routes
ip route show
route -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment