I'm trying to stand up an OpenVPN server on OS X Server (Mountain Lion) to replace OS X Server's native L2TP/PPTP-based VPN service and get a secure certificate-based VPN solution on iOS.
Should be easy, and I'm almost there, but not quite: clients can connect, but the networking is fouled up I'm still too much of a n00b to figure out the problem. Any help would be much appreciated.
The networking problem is strange: the client (ip 10.0.9.2) can ping/ssh/http/etc. to the server's IP (10.0.1.3), but cannot do the same with the server's domain name, which resolves to 10.0.1.3 on the LAN. I'm pushing 10.0.1.3 as the name server to clients, so the client should be able to resolve the server's domain name. But this is not simply a DNS snafu: the client cannot ping the router (10.0.1.1), though the server can ping the client!
server$ ping -c 1 10.0.9.2
PING 10.0.9.2 (10.0.9.2): 56 data bytes
64 bytes from 10.0.9.2: icmp_seq=0 ttl=64 time=470.780 ms
iPhone$ ping -c 1 10.0.1.3
PING 10.0.1.3 (10.0.1.3): 56 data bytes
64 bytes from 10.0.1.3: icmp_seq=0 ttl=64 time=170.943 ms
64 bytes from 10.0.1.3: icmp_seq=1 ttl=64 time=112.755 ms
64 bytes from 10.0.1.3: icmp_seq=2 ttl=64 time=129.476 ms
--- 10.0.1.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 112.755/137.725/170.943/24.461 ms
iPhone$ ping domainname.com
ping: unknown host
iPhone$ ping 10.0.1.1
PING 10.0.1.1 (10.0.1.1): 56 data bytes
--- 10.0.1.1 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
My LAN looks like this:
- Airport Extreme Router (10.0.1.1, DHCP+NAT, DNS) <----->
Airport Express network extension (10.0.1.2, 255.255.255.0) <----->
OS X Server (10.0.1.3, 255.255.255.0, DNS)
For the server, I've tried both Tunnelblick and a simple command 'openvpn2 --conf server.conf'. The router is set up to forward udp port 1194 to the server, and though I've added the ipfw rule,
$ sudo ipfw add 12368 allow udp from any to any 1194
OS X firewalling is completely disabled (and double-checked) using the commands:
$ sudo pfctl -d
$ sudo ipfw disable firewall
$ /usr/sbin/sysctl net.inet.ip.fw.enable
net.inet.ip.fw.enable: 0
The client is GuizmOVPN on iOS. Both Tunnelblick and openvpn2 servers exhibit the same networking problems descibed above.
Configs:
Server (OS X Server 10.8.2)
local 10.0.1.3
port 1194
proto udp
dev tun
ca /opt/local/etc/openvpn2/keys/ca.crt
cert /opt/local/etc/openvpn2/keys/server.crt
key /opt/local/etc/openvpn2/keys/server.key
tls-auth /opt/local/etc/openvpn2/keys/ta.key 0
dh /opt/local/etc/openvpn2/keys/dh2048.pem
server 10.0.9.0 255.255.255.0
topology subnet
push "route 10.0.1.0/255.255.255.0"
push "dhcp-option DNS 10.0.1.3"
push "dhcp-option DOMAIN domainname.com"
client-to-client
keepalive 10 120
comp-lzo
max-clients 100
user nobody
group nobody
persist-key
persist-tun
ifconfig-pool-persist /opt/local/etc/openvpn2/ipp.txt
verb 3
Client (GuizmOVPN on iPhone)
client
dev tun
proto udp
remote server.domainname.com 1194
redirect-gateway def1
resolv-retry infinite
nobind
;user nobody
;group nobody
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
tls-auth ta.key 1
;auth-user-pass
tls-remote server
tls-cipher DHE-RSA-AES256-SHA
comp-lzo
verb 3
ifconfig's:
server$ ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
ether 15:20:c3:fb:56:4d
inet 10.0.1.3 netmask 0xffff0000 broadcast 10.0.255.255
media: autoselect (1000baseT <full-duplex,flow-control>)
status: active
en1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
ether 61:f3:33:1e:88:cd
media: autoselect (<unknown type>)
status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
ether 02:f3:33:1e:88:cd
media: autoselect
status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
lladdr ee:14:63:c0:ff:fb:a5:42
media: autoselect <full-duplex>
status: inactive
tun0: flags=8851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 10.0.9.1 --> 10.0.9.1 netmask 0xffffff00
open (pid 14410)
iPhone$ ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
ap0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
ether 46:5d:15:8e:39:03
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 24:5b:6c:58:22:59
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 24:4a:15:75:21:f4
pdp_ip0: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1430
inet 10.167.208.92 --> 10.167.208.92 netmask 0xffffffff
pdp_ip1: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
pdp_ip2: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
pdp_ip3: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1024
ppp0: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1500
inet 10.0.9.2 --> 10.0.9.2 netmask 0xffffff00