Ron Guest

Q: VPN fails when rebooted

I'm having a peculiar problem with the Server VPN Service on Yosemite.

 

Whenever I reboot the Mac the VPN will not allow access. The key error message in the System log when a user tries to connect, from what I can tell, is

racoon[266]: not acceptable Identity Protection mode

 

After a lot of experimenting I have discovered that after a reboot if I simply use the Server app to turn off the VPN, wait a few seconds, then turn the VPN service back on then the VPN service works fine. I am using an account created just for VPN access (e.g. Home Folder is "None - Services Only". Regular local user accounts are not part of the VPN permissions list.

 

Once I go through this process the VPN seems to work just fine until the next reboot.

 

This is a significant issue for me. Any advice on how to fix this would be greatly appreciated!

 

I am running Yosemite 10.10.2 with Server 4.0.3.

Posted on Mar 17, 2015 5:24 PM

Close

Q: VPN fails when rebooted

  • All replies
  • Helpful answers

Page 1 Next
  • by Ron Guest,

    Ron Guest Ron Guest Mar 18, 2015 11:53 AM in response to Ron Guest
    Level 1 (9 points)
    Mar 18, 2015 11:53 AM in response to Ron Guest

    I did some more experimenting and it seems that there is an timing problem with when the network interface is connected and when raccoon starts. I see the below errors. Apparently even though the VPN service shows as Up in the Server app it isn't actually running because raccoon can't bind. Any ideas how to fix this? The computer is on a wired Ethernet connection and has a static IP assigned (a fixed address from the DHCP server). I have no idea why the interface isn't ready immediately. The hostname assigned to the machine is via dynalias.com.

     

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500]: because interface address is/was not ready (flags 2).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500]: because interface address is/was not ready (flags 2).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500]: because interface address is/was not ready (flags 2).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500]: because interface address is/was not ready (flags 2).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[500]: because interface address is/was not ready (flags 2).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500] (Can't assign requested address).

    Mar 18 13:18:25 mydomain.com racoon[291]: failed to bind to address fd30:bd15:8e4d:d4a:ac9c:c970:5377:f344[4500]: because interface address is/was not ready (flags 2).

  • by NicoAv,

    NicoAv NicoAv Mar 19, 2015 8:16 PM in response to Ron Guest
    Level 1 (1 points)
    Mar 19, 2015 8:16 PM in response to Ron Guest

    Ron,

     

    I am having this same issue. I contacted Apple about it and they are not sure what the cause is. Any additional information would greatly be appreciated.

  • by Ron Guest,

    Ron Guest Ron Guest Mar 20, 2015 8:06 AM in response to NicoAv
    Level 1 (9 points)
    Mar 20, 2015 8:06 AM in response to NicoAv

    I've been digging online and through the log files and cannot find a clue of what is causing this or how to 'fix' it. I'll probably test using a script to automatically stop and then restart the VPNs after a reboot

  • by NicoAv,

    NicoAv NicoAv Mar 20, 2015 8:19 AM in response to Ron Guest
    Level 1 (1 points)
    Mar 20, 2015 8:19 AM in response to Ron Guest

    I have tried everything I can think of to make server.app start the VPN upon reboot. I called Apple yesterday and spent about 2 hours with them on the phone and they had no idea either.


    I basically came to the conclusion that a script needs to be written to tell VPN to start about 1 minute following boot up. I will provide the start and stop commands below. I don't have any experience writing a script, so if you could share your finished script with me, I would be very appreciative!

     

     

    sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin stop vpn

    sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin start vpn


  • by NicoAv,

    NicoAv NicoAv Mar 20, 2015 8:49 AM in response to NicoAv
    Level 1 (1 points)
    Mar 20, 2015 8:49 AM in response to NicoAv

    Replace "serveradmin"  with your server admin account name and it should work for you.

  • by Ron Guest,

    Ron Guest Ron Guest Mar 20, 2015 10:48 AM in response to NicoAv
    Level 1 (9 points)
    Mar 20, 2015 10:48 AM in response to NicoAv

    Writing the script isn't a problem for me. Figuring out how to run it a few minutes after a boot up is the trick. It's doable, I just need some time to research a robust approach.

  • by fhainz,

    fhainz fhainz Mar 20, 2015 11:05 AM in response to Ron Guest
    Level 1 (0 points)
    Mar 20, 2015 11:05 AM in response to Ron Guest

    I have the same problem since i've updated to yosemite and server 4.0

  • by NicoAv,

    NicoAv NicoAv Mar 20, 2015 10:33 PM in response to Ron Guest
    Level 1 (1 points)
    Mar 20, 2015 10:33 PM in response to Ron Guest

    Please let me know what script you come up with.

     

    I wish I could contribute more, but this is outside of my expertise... Hopefully the command lines helped.

  • by Ron Guest,Solvedanswer

    Ron Guest Ron Guest Mar 21, 2015 6:32 PM in response to NicoAv
    Level 1 (9 points)
    Mar 21, 2015 6:32 PM in response to NicoAv

    OK, this solution works for me. First, create this script in /usr/local/bin and call it restartvpn.sh:

    #!/bin/sh

    #

    # The "live" version of this script lives in /usr/local/bin

    #

     

    # In Yosemite and Server 4.0.x the racoon daemon fails to start correctly when there is a reboot

    # It gives an error that it can't bind to an address

    # The solution is to turn the VPN off and then back on, which clears this up

    # That can be done manually but it's easy to forget when there is a reboot

    # so this tries to automate that as a launchctl script

     

    # If this runs immediately serveradmin returns an error and the script doesn't work so sleep some first

    sleep 60

     

    # Stop the VPN

    /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin stop vpn

    echo Sleep until things settle down

    sleep 180

     

    # Now start it back up

    echo Restarting VPN

    /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin start vpn

    echo VPN restart complete

    Then create this plist file /Library/LaunchDaemons/yourdomain.restart.plist. Note you should put a domain in the name, instead of yourdomain, in the plist file name and in the Label value in the plist but it isn't mandatory AFAIK

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0">

    <dict>

        <key>Label</key>

        <string>yourdomain.restartvpn</string>

        <key>ProgramArguments</key>

        <array>

            <string>/usr/local/bin/restartvpn.sh</string>

        </array>

        <key>StandardOutPath</key>

        <string>/var/log/restartvpn.log</string>

        <key>StandardErrorPath</key>

        <string>/var/log/restartvpn.log</string>

        <key>RunAtLoad</key>

        <true/>

        <key>ExitTimeOut</key>

        <integer>300</integer>

        <key>LaunchOnlyOnce</key>

        <true/>

    </dict>

    </plist>

     

     

    Now load it using

    sudo launchctl load -w /Library/LaunchDaemons/yourdomain.restartvpn.plist

     

    When you login after reboot this should get the VPN working. It logs to /var/log/restartvpn.log so you can watch the progress. Both sleeps seem necessary though I didn't experiment to see how short they could be.

     

    I'm no expect at these launch daemons but this seems to work and I don't think there are any bad side effects. If there are, don't blame me

  • by NicoAv,

    NicoAv NicoAv Mar 22, 2015 10:01 PM in response to Ron Guest
    Level 1 (1 points)
    Mar 22, 2015 10:01 PM in response to Ron Guest

    Hi Ron,

     

    So I had several unrelated problems with the server today, I was getting an error when trying to enroll device into mdm and https was literally crawling on a website that I host. So I pretty much trashed server app and completely deleted the /library/server/ folder... Then I created a brand new admin user account. I might add that I didn't yet have a chance to try your script.


    Doing these things completely fixed all of my problems, VPN now runs without needing to turn the service off and then back on again. Maybe try just creating a new user account, and see if the VPN will work with the new user admin account.

  • by Ron Guest,

    Ron Guest Ron Guest Mar 23, 2015 5:30 AM in response to NicoAv
    Level 1 (9 points)
    Mar 23, 2015 5:30 AM in response to NicoAv

    Hi Nico - I'm not having any other issues so I don't think I'll try setting up a new admin account but it's good to know that might something to try.

    Ron

  • by NicoAv,

    NicoAv NicoAv Mar 26, 2015 12:08 AM in response to Ron Guest
    Level 1 (1 points)
    Mar 26, 2015 12:08 AM in response to Ron Guest

    Hi Ron,

     

    So it turns out the new account setup didn't fix my problem.. So I went ahead and tried your script... It doesn't look like it is launching though. I'm not sure what I may be doing wrong. I created both the .plist and .sh files. I also ran the sudo launchctl load -w /Library/LaunchDaemons/yourdomain.restartvpn.plist command. I added my own domain in the places where you told me to. I checked the log's and they are blank. So it seems like it's not running?

     

    What do you think?

  • by Ron Guest,

    Ron Guest Ron Guest Mar 26, 2015 5:32 AM in response to NicoAv
    Level 1 (9 points)
    Mar 26, 2015 5:32 AM in response to NicoAv

    The scripts will only run after a reboot. You probably did one but didn't mention it so just in case.

     

    I'm not an expert on launchctl and I've found it to be very fussy. If there is no /var/log/restartvpn.log file then it surely hasn't run. In my tests this file was routinely created, I think before the script even writes out anything.

     

    Do you set the restartvpn.sh file to be executable: chmod +x /usr/local/bin/restartvpn.sh

  • by NicoAv,

    NicoAv NicoAv Mar 26, 2015 1:57 PM in response to Ron Guest
    Level 1 (1 points)
    Mar 26, 2015 1:57 PM in response to Ron Guest

    Should I be using my hostname.domainname.com for the .plist file or just my domain.com?

Page 1 Next