I've had some success with using ssh tunnels over a public wireless network to mimic a private wireless network. This is a very light weight approach as it only requires a few lines of code:
net="192.168.4."
id="5"
ssh -M -f -w0:${id} ${svraddr} ''ifconfig tun${id} ${net}1 pointopoint ${net}${id}''
sleep 3
ifconfig tun0 ${net}${id} pointopoint ${net}1
Works like a champ. The problem is that the client has to dictate the tun device index on the server. This means that each device has to be provisioned a unique static index before it can connect to the network, which is unacceptable.
It's easy enough to omit the ID and let the server assign the next available, but then I can't figure out how to retrieve the assigned value to configure the network. I tried using udev rules, but so far that hasn't gotten me anywhere.
Does anyone have any ideas on how to retrieve the server-side id for a newly created tun device?
Thanks.
serverfault.com– pilcrow Aug 20 '09 at 4:37