我设法在testing服务器中设置openvpn,configurationPKI并分发证书来testing客户端机器。 我可以使用tun桥的另一端的IP从客户端机器ssh到openvpn服务器:
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.1.0.2 PtP:10.1.0.1 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
这是用openvpnconfiguration文件中的这一行来实现的:
ifconfig 10.1.0.2 10.1.0.1
我用下面的openvpn-startup.sh脚本启动openvpn
dir=/home/lurscher/openvpn/testChapter8/sample-config-files/ # load the firewall $dir/firewall.sh # load TUN/TAP kernel module modprobe tun # enable IP forwarding echo 1 > /proc/sys/net/ipv4/ip_forward openvpn --script-security 2 --cd $dir --daemon --config tls-office.conf --log $dir/log/vpn.log
这是tls-office.conf:
dev tun ifconfig 10.1.0.1 10.1.0.2 up ./office.up # the office.up script has this: ##!/bin/sh #route add -net 10.0.1.0 netmask 255.255.255.0 gw $5 #(in the openvpn manual, it says that if the Device is TUN, $5 stands for Remote IP) tls-server dh /home/lurscher/keys/dh1024.pem ca /home/lurscher/keys/ca.crt cert /home/lurscher/keys/vpnCh8TestServer.crt key /home/lurscher/keys/vpnCh8TestServer.key verb 3
对于客户端机器,我使用下面的configuration文件:
dev tun remote my.server.com # 10.1.0.2 is our local VPN endpoint (home). # 10.1.0.1 is our remote VPN endpoint (office). ;ifconfig 10.1.0.2 10.1.0.1 # Our up script will establish routes # once the VPN is alive. up ./home.up ##!/bin/sh #route add -net 10.0.0.0 netmask 255.255.255.0 gw $5 #(in the openvpn manual, it says that if the Device is TUN, $5 stands for Remote IP) tls-client ca /home/chuckq/keys/ca.crt cert /home/chuckq/keys/vpnCh8TestClient.crt key /home/chuckq/keys/vpnCh8TestClient.key ns-cert-type server ; port 1194 ; user nobody ; group nogroup verb 3
但是,我有点在丢失如何连接/看到其他机器在openvpn服务器是隧道的同一侧的其他机器。 我假设他们在10.1.XX范围内获得IP,但是我没有看到他们中的任何一个。 也许我只是不知道如何看看隧道后面分配了什么IP,因为我只是使用ifconfig来知道一台机器有什么本地IP,但是每台机器只报告tun IP桥节点(客户机和服务器),但是没有提到任何一端的其他机器
所以,假设在openvpn服务器后面的机器上有一个http服务器,它不在同一台机器上; 我如何达到它或从openvpn客户端看到它?
谢谢!
以下指令
状态/var/log/openvpn-status.log
在OpenVPN服务器的configuration文件中将会维护/var/log/openvpn-status.log文件中的所有OpenVPN客户端的端点地址和路由networking列表,只要运行OpenVPN,该文件每60秒更新一次。