Skip to content

Instantly share code, notes, and snippets.

@scue
Created May 11, 2015 01:15
Show Gist options
  • Save scue/2c4218d54cbfdfeeb37c to your computer and use it in GitHub Desktop.
Save scue/2c4218d54cbfdfeeb37c to your computer and use it in GitHub Desktop.
ssh vpn client config generator
#!/bin/bash -
#===============================================================================
#
# FILE: client.sh
#
# USAGE: ./client.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: lwq (28120), [email protected]
# ORGANIZATION:
# CREATED: 04/22/2015 05:22:16 PM HKT
# REVISION: ---
#===============================================================================
tnum=${1:-1}
pnum=${2:-8}
cat <<-EOT
# run command on sshvpn server
sudo -i
ssh-keygen
vi ~/.ssh/config # add server config
ssh -CgNfTw $tnum:$tnum root@wsc
sudo ip link set tun$tnum up
sudo ip addr add 10.1.${pnum}.200/32 peer 10.1.${pnum}.100 dev tun$tnum
sudo route add -host 200.200.0.40 tun$tnum
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment