9.2. Starting and Testing OpenVPN
Problem
You followed the previous recipe and your little test lab works, and you're ready to start running OpenVPN. Now what?
Solution
First, check both OpenVPN machines to see if OpenVPN is already running:
$ ps ax | grep vpnIf it is, stop it:
# killall openvpnThen, open a quick, insecure tunnel between the remote PC and your OpenVPN server with these commands:
root@xena:~# openvpn --remote 192.168.2.100 --dev tun0 \
--ifconfig 10.0.0.1 10.0.0.2
root@stinkpad:~# openvpn --remote 192.168.3.10 \
--dev tun0 --ifconfig 10.0.0.2 10.0.0.1This message shows success, and should be seen on both sides of the connection:
Wed Feb 14 12:53:45 2007 Initialization Sequence Completed
Now, open some new terminals, and try pinging your new virtual IP addresses:
carla@xena:~$ ping 10.0.0.2PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.421 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.314 mscarla@stinkpad:~$ ping 10.0.0.1PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.360 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.317 ms
You may also specify which interface for ping to use:
carla@xena:~$ ping -I tun0 10.0.0.2
carla@stinkpad:~$ ping -I tun0 10.0.0.1Go ahead and give your tunnels a test drive by opening SSH sessions everywhere:
carla@xena:~$ ssh 10.0.0.2
carla@stinkpad:~$ ssh 10.0.0.1Exit your SSH sessions, and hit Ctrl-C to shut down OpenVPN and close the tunnels. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access