VPN sharing on Mac OS X 10.5 machine

I have a rather weird problem. I want to share a VPN connection that has been established by my Mac OS X 10.5 computer with another machine in my network. This is what I did:

  1. In the /etc/hostcongig file on the main computer I added the line: IPFORWARDING=-YES-

  2. I assigned a fixed IP address to my computer (192.168.178.30), a fixed one to the other machine (192.168.178.60) and my computer's IP address as gateway on the other machine.

  3. I connected to my VPN using the internal Mac OS X VPN client (PPTP connection)

  4. I run this script:

    #!/bin/sh

    natd -same_ports -use_sockets -unregistered_only -dynamic -interface ppp0 -clamp_mss
    ipfw -f flush
    ipfw add divert natd ip from any to any via ppp0
    ipfw add pass all from any to any
    sysctl -w net.inet.ip.forwarding=1

    Source: Using (and sharing) a VPN connection on your Mac

Now everthing works smootly, however speed is an issue. I get 1,8 MBit/s on my main machine and only 0,3 - 0,6 MBit/s on the other one.

My question: What could possibly be wrong? Do I have to tweak MTU settings, is there any packet inspection ongoing that needs time....? Any help appreciated!


Solution 1:

Lower the MTU size in the secondary computer (the one NOT running the VPN) to see if the transmission speed increases. If the secondary computer is running OS X go to System Preferences, Select Networks, on the left side select the device (AirPort, Ethernet, etc), then select advanced in the bottom right hand corner. In the series of tabs that open at the top, select Ethernet. You can adjust the MTU size in one of the drop downs. After saving, you have changed the MTU size. My guess is you are seeing slow speeds due to fragmentation as a 1500 MTU is being pushed from the secondary computer to the primary (the one with the VPN connection), then overhead is being added, the packets are being fragmented, and moved through your VPN tunnel. Try a new size in the secondary computer, restart it, and test speeds.