TCP protocol and different ports

The default protocol that OpenVPN uses is UDP, as it is generally more suitable for VPN connections. However, if the TCP protocol is required, then the preceding example needs to be modified only slightly:

On the listening end, start the OpenVPN server instance:

[root@server] # openvpn \
    --ifconfig \
    --dev tun \
    --proto tcp-server

On the client side, the code is as follows:

[root@client] # openvpn \
    --ifconfig \
     --dev tun \
    --proto tcp-client \

OpenVPN will now connect over TCP port 1194. It is also possible to override the port number using the --port parameter, for example, --port 5000.

The TAP mode

If non-TCP/IP traffic needs ...

Get Mastering OpenVPN now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.