openvpn & apache issue
Posted: Fri Apr 15, 2011 9:29 am
Hi, I'm having an issue with the following configuration:
- router connected to internet via cable modem (LAN: 192.168.0.1, WAN: 222.X.X.X)
- mac connected to the router (LAN: 192.168.0.100)
The mac runs an openvpn client & apache webserver (apache configured to listen to 192.168.0.100:8888), and the router forwards port 8888 to 192.168.0.100 8888
With vpn turn off, the website running on the mac is available for external access (http://222.X.X.X:8888/). This is the needed behavior.
Once the openvpn is on, the website becomes only available from LAN (http://192.168.0.100:8888/)
the routes on the mac (netstat -n -r):
without VPN:
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.0.1 UGSc 13 24 en1
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 6 94416 lo0
169.254 link#5 UCS 0 0 en1
192.168.0 link#5 UCS 8 0 en1
192.168.0.1 28:4f:54:d4
a5 UHLWI 13 67 en1 1195
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 1 2 en1
OPENVPN runs the following when connected
/sbin/route add -net 223.X.X.X 192.168.0.1 255.255.255.255
/sbin/route add -net 0.0.0.0 10.13.65.21 128.0.0.0
/sbin/route add -net 128.0.0.0 10.13.65.21 128.0.0.0
/sbin/route add -net 10.13.65.1 10.13.65.21 255.255.255.255
and the routing table becomes:
Internet:
Destination Gateway Flags Refs Use Netif Expire
0/1 10.13.65.21 UGSc 1 0 tun0
default 192.168.0.1 UGSc 4 24 en1
10.13.65.1/32 10.13.65.21 UGSc 0 0 tun0
10.13.65.21 10.13.65.22 UH 5 0 tun0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 3 94444 lo0
128.0/1 10.13.65.21 UGSc 1 0 tun0
169.254 link#5 UCS 0 0 en1
192.168.0 link#5 UCS 11 0 en1
192.168.0.1 28:4f:54:d4
a5 UHLWI 4 37 en1 1197
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 en1
223.X.X.X/32 192.168.0.1 UGSc 1 0 en1
I need the website to be available via the WAN address and the mac to surf the internet via the VPN
This works fine if I use L2TP vpn. Routing table when connecting with L2TP is:
default 10.21.0.1 UGSc 5 0 ppp0
default 192.168.0.1 UGScI 0 0 en1
10 ppp0 USc 0 0 ppp0
10.21.0.1 10.21.0.100 UH 6 0 ppp0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 3 94718 lo0
169.254 link#5 UCS 0 0 en1
223.X.X.X 192.168.0.1 UGHS 1 45 en1
192.168.0 link#5 UCS 7 0 en1
192.168.0.1 28:4f:54:d4
a5 UHLWI 4 98 en1 1194
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 1 3 en1
Anyone has any idea why using the open vppn things fail? How to fix it ?
- router connected to internet via cable modem (LAN: 192.168.0.1, WAN: 222.X.X.X)
- mac connected to the router (LAN: 192.168.0.100)
The mac runs an openvpn client & apache webserver (apache configured to listen to 192.168.0.100:8888), and the router forwards port 8888 to 192.168.0.100 8888
With vpn turn off, the website running on the mac is available for external access (http://222.X.X.X:8888/). This is the needed behavior.
Once the openvpn is on, the website becomes only available from LAN (http://192.168.0.100:8888/)
the routes on the mac (netstat -n -r):
without VPN:
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.0.1 UGSc 13 24 en1
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 6 94416 lo0
169.254 link#5 UCS 0 0 en1
192.168.0 link#5 UCS 8 0 en1
192.168.0.1 28:4f:54:d4
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 1 2 en1
OPENVPN runs the following when connected
/sbin/route add -net 223.X.X.X 192.168.0.1 255.255.255.255
/sbin/route add -net 0.0.0.0 10.13.65.21 128.0.0.0
/sbin/route add -net 128.0.0.0 10.13.65.21 128.0.0.0
/sbin/route add -net 10.13.65.1 10.13.65.21 255.255.255.255
and the routing table becomes:
Internet:
Destination Gateway Flags Refs Use Netif Expire
0/1 10.13.65.21 UGSc 1 0 tun0
default 192.168.0.1 UGSc 4 24 en1
10.13.65.1/32 10.13.65.21 UGSc 0 0 tun0
10.13.65.21 10.13.65.22 UH 5 0 tun0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 3 94444 lo0
128.0/1 10.13.65.21 UGSc 1 0 tun0
169.254 link#5 UCS 0 0 en1
192.168.0 link#5 UCS 11 0 en1
192.168.0.1 28:4f:54:d4
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 en1
223.X.X.X/32 192.168.0.1 UGSc 1 0 en1
I need the website to be available via the WAN address and the mac to surf the internet via the VPN
This works fine if I use L2TP vpn. Routing table when connecting with L2TP is:
default 10.21.0.1 UGSc 5 0 ppp0
default 192.168.0.1 UGScI 0 0 en1
10 ppp0 USc 0 0 ppp0
10.21.0.1 10.21.0.100 UH 6 0 ppp0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 3 94718 lo0
169.254 link#5 UCS 0 0 en1
223.X.X.X 192.168.0.1 UGHS 1 45 en1
192.168.0 link#5 UCS 7 0 en1
192.168.0.1 28:4f:54:d4
192.168.0.100 127.0.0.1 UHS 34 13980 lo0
192.168.0.255 ff:ff:ff:ff:ff:ff UHLWbI 1 3 en1
Anyone has any idea why using the open vppn things fail? How to fix it ?