I wanted to always be able to shell to a machine within the Uni network. The Uni network has a firewall that stops incoming requests to most machines. There’s a machine that all undergrads can shell to, which I normally use netcat combined with the ssh ProxyCommand setting. However, it’s a little silly to divert all traffic through another machine when I’m in the network. So, meet the new script I use in the ProxyCommand:
#!/bin/bash HOST=$1 got=`ifconfig eth1 | egrep -o "inet addr:152.78.[0-9]{1,3}\\.[0-9]{1,3}"` got+=`ifconfig eth0 | egrep -o "inet addr:152.78.[0-9]{1,3}\\.[0-9]{1,3}"` if [[ "$got" == "" ]] then ssh uglogin.ecs.soton.ac.uk nc $HOST 22 else nc $HOST 22 fi
Posted at 8:38 am on Wednesday 11th June 2008
Site by Rob Gilton. © 2008 - 2019