Mac – PPTP VPN connected but cannot open webpage with Mac

macpptpvpn

I've setup a PPTPD on my VPS(Debian) which I used to use very well from my android phone and windows laptop. Now I want my new Mac Mini to use it too. It's shown the Mac can establish the vpn connection, only the browser(or curl) cannot open any webpages.

What's the problem?

BTW, I'm accessing internet through my wifi router. My android phone and windows laptop can use the vpn without any problems. Another strange thing: If my mac mini access internet directly without the router, the vpn works fine, i.e., I can connect the vpn and browser webpage as well.

The following is a session after it shows that my Mac has established a VPN connection:

JohnsMM:~ john$ nslookup www.youtube.com
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
www.youtube.com canonical name = youtube-ui.l.google.com.
Name:   youtube-ui.l.google.com
Address: 74.125.192.91
Name:   youtube-ui.l.google.com
Address: 74.125.192.190

JohnsMM:~ john$ ping www.youtube.com
PING youtube-ui.l.google.com (74.125.192.91): 56 data bytes
Request timeout for icmp_seq 0
64 bytes from 74.125.192.91: icmp_seq=0 ttl=49 time=1202.066 ms
64 bytes from 74.125.192.91: icmp_seq=1 ttl=49 time=306.454 ms
^C
--- youtube-ui.l.google.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 306.454/605.227/1202.066/422.029 ms

JohnsMM:~ john$ curl -v www.youtube.com
* About to connect() to www.youtube.com port 80 (#0)
*   Trying 74.125.192.91...
* connected
* Connected to www.youtube.com (74.125.192.91) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r     zlib/1.2.5
> Host: www.youtube.com
> Accept: */*
>

As the above shows, when I use curl to access youtube, it stopped at the last line(after the line > Accept: */*), looks like curl is waiting for a response.

Best Answer

It seems, with the ping functioning, that the problem is with your MTU being too high, as the VPN adds headers, it means packets are getting fragmented and dropped. To adjust the MTU on your mac, open

System Preferences > Network > [your connection] > Advanced > Hardware > Configure: {Manually,Automatically}

There you will see if it is configured automatically, it will be 1500, as that works fine on normal ethernet connections. You will want to adjust this down, there is a fairly simple way of understanding how large your MTU needs to be. Following this guide here, you can use ping to determine the optimum MTU. Connect your VPN and open a Terminal window:

Type: ping -c 2 -D -s 1472 www.youtube.com 1472 is the packet size in this case. You will get one of two reponses, ping: sendto: Message too long or a normal ping reply.

Since 1472 + 28 is 1500, you should get a Message too long error. Reduce the ping number down until you get a positive reply. take the functioning number, add 28 and use that as your MTU.