3

I wanted to know if it was possible to have a server running OpenVPN with server key and have multiple clients connect to it?

I would like the server to be 10.9.8.1, the first client to be 10.9.8.2 (this works) and have a third one be 10.9.8.3 so the three of them appear on the same private network. I couldn't manage to connect the third one, I get

TCP/UDP: Socket bind failed on local address [undef]:1194: Address already in use.

when I try to connect the third one to the VPN server.

2

Of course it's possible. The configuration you might want to try is tap rather than tun if you wonder about that, even though it might bit a bit harder to configure, it's easier to get hosts together in one network that way. You might need to enable client-to-client connections for that - there is a line for that commented out in example OpenVPN configs.

Your error is another matter, though. It means that the program using port 1194 (OpenVPN in that case) is already running, so you have to specify some other port in config, or make sure that the previous instance is off if it shouldn't be on.

ps ax | grep openvpn

If there is OpenVPN running and shouldn't be, and it has PID of, say, 1234 (first number on the left) you can type kill 1234 to turn it off.

2
  • Thanks a lot! This seems to do the trick :) if you can, could you explain a bit what is the difference between tun and tap, and why tap would be more appropriate here? Can I still use tun devices here? Apr 19 '13 at 17:26
  • In tap devices are like connected in one physical network with same address range. tun on the other hand makes device act as if they were on different networks and it requires special measures (ie. routing) for them to interconnect. It's hard to explain shortly if you don't know how it goes. Due to addresses you want to use in this case only tap is appropriate.
    – TNW
    Apr 19 '13 at 18:51
0

That error indicates that port 1194 on local host is not bindable (probably been used by another openvpn connection). You can examine the process using it with netstat command (PID 946, openvpn process on this example):

netstat -npa | grep 1194
udp        0      0 0.0.0.0:1194      0.0.0.0:*      946/openvpn

Openvpn client try to use 1194 as port on local host by default (I think it shouldn't, not really relevant but probably decided to configure a firewall rule).

In this case, the solution is to configure openvpn client with the nobind option:

--nobind
   Do  not bind to local address and port.  The IP stack will allocate a dynamic
   port for returning packets.  Since the value of the dynamic port could not be
   known in advance by a peer, this option is only suitable for peers which will
   be initiating connections by using the --remote option.

Try to start your client with --nobind argument option or add a line with nobind on your configuration file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.