Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

Reply
Question marked as Best reply

Posted on Mar 18, 2015 11:53 AM

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).

25 replies
Question marked as Best reply

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).

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

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 🙂

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.

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?

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

Mar 26, 2015 2:07 PM in response to NicoAv

Hi Nico. Either one would work. It is just a naming convention Apple recommends everyone use. The recommendation as I understand it is like the Java convention which puts everything in 'reverse' order. E.g.

com.domain.scriptname.plist


What is critical is to ensure you have it exactly the same everywhere. Any typo or variation tends to break things. If you post yours I can try to look it over.


Also, this page is useful: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystem Startup/Chapters/CreatingLaunchdJobs.html

VPN fails when rebooted

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.