Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Sep 2 '09 at 15:14

This question came from our site for professional and enthusiast programmers.

    
One other detail. All the devices use the same RSA key (at least out of the box), so the authorized_keys approach doesn't look like it will help. –  Dave Causey Aug 20 '09 at 4:33
    
I would leverage a web API to acquire the key outside of the connection. Since it is just an incrementing ID, it should be reasonably safe to return. –  TheJacobTaylor Aug 20 '09 at 4:52
2  
just use OpenVPN? –  derobert Aug 20 '09 at 5:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.