Hi Ron, good information in your post with regard to your supposition that racoon can't bind to these IP adddresses behind a NAT when OSx server starts up. Like many on this thread I have been experiencing this issue since OS 10.10.1. I too have not found any solution and your launchd daemon is a good work around. Thanks for that.
This VPN connection failure after a OSx restart (reboot) is quite repeatable after a reboot on this particular configuration.
However on some systems we deal with, the VPN is ready every time!
Here's some more information I'd like to contribute. This is a sequence from today's maintenance OSX 10.10.5 update restart of our main server.
Like clockwork, VPN L2TP clients fail authentication to connect to the VPN. Our procedure is to ssh in and severadmin stop/start VPN. VPN connections then succeed flawlessly from then on. Yep this always works.
We noticed that the racoon/vpnd agent is underway PRIOR to the successful establishment of the other NIC's on this particular macmini. (Ethernet [subnet 1] and THUNDERBOLT/ethernet [subnet 2] ). . The /var/log sequence for vpnd, L2TP and racoon is:
Sep 6 09:28:29 macmini-server.msf.studio vpnd[262]: Server 'com.apple.ppp.l2tp' starting...
Sep 6 09:28:29 macmini-server.msf.studio vpnd[262]: Loading plugin /System/Library/Extensions/L2TP.ppp
,.....
Sep 6 09:28:30 macmini-server kernel[0]: L2TP domain init
Sep 6 09:28:30 macmini-server kernel[0]: L2TP domain init complete
Sep 6 09:28:30 macmini-server kernel[0]: l2tp_udp_init_threads: changing # of threads from 0 to 7
Sep 6 09:28:30 macmini-server.msf.studio vpnd[262]: Listening for connections...
Sep 6 09:28:30 macmini-server.msf.studio swupd_syncd[272]: Download for "Deprecations.plist" failed (reason: The Internet connection appears to be offline.)
.....
Sep 6 09:28:31 macmini-server.msf.studio racoon[371]: accepted connection on vpn control socket.
Sep 6 09:28:32 macmini-server kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en4, 1-Gigabit, Full-duplex, Symmetric flow-control, EEE enabled, Debug [796d,0301,0de1,0300,c5e1,3800]
Sep 6 09:28:32 macmini-server.msf.studio servermgr-notify[338]: up and running
Sep 6 09:28:32 macmini-server.msf.studio ServerEventsDaemon[264]: Connected to the Notify Service
Sep 6 09:28:32 macmini-server kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en0, 1-Gigabit, Full-duplex, Symmetric flow-control, Debug [796d,2301,0de1,0300,cde1,3800]
....
This is curious only because of our attention to your post , we noted the following behaviour:
- and also that we could not see this same sequence on our test OSX 10.9.5 system. This may just be coincidence.
- 09:28:32 Of note above is that the Thunderbolt/Ethernet EN4 interface becomes initialised/active PRIOR to the EN0 (on board ethernet). The EN4 NIC subnet is NIC service order is 2 ... strange that it is enabled before the EN) which is service order 1 (the Bluetooth service order 0) is disabled on these servers) . The EN0 NIC accesses a Lan port DHCP on an Apple Airport Extreme 802.11AC 2013 model. The server's IP address is DHCP reserved.
- at these log event point, there's no indication that the VPN racoon service recognises the upstream PUBLIC/WAN gateway address(WAN).
- 09:28:30 earlier, obviously from the last system.log entry at this point in the system initialisation / startup/"boot" above, that the system has no access to the WAN yet the VPN is started and ready for connections.
macmini-server:~ warwick$ networksetup -listnetworkserviceorder
(1) Bluetooth DUN
(Hardware Port: Bluetooth DUN, Device: Bluetooth-Modem)
(2) Ethernet
(Hardware Port: Ethernet, Device: en0)
(3) Thunderbolt Ethernet
(Hardware Port: Thunderbolt Ethernet, Device: en4)
(4) Wi-Fi
(Hardware Port: Wi-Fi, Device: en1)
(5) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)
The vpnd initialisation/start sequence continues three seconds later ....
Sep 6 09:31:09 macmini-server com.apple.xpc.launchd[1] (com.apple.ppp.l2tp): This service is defined to be constantly running and is inherently inefficient.
Sep 6 09:31:09 macmini-server.msf.studio vpnd[835]: Server 'com.apple.ppp.l2tp' starting...
Sep 6 09:31:09 macmini-server.msf.studio vpnd[835]: Loading plugin /System/Library/Extensions/L2TP.ppp
Sep 6 09:31:09 macmini-server.msf.studio vpnd[835]: Listening for connections...
The initialisation subjectively appears event seems to out or order such that the VPND agent is ready but theres no LAN interface enabled. The state information in use is then used to service any incoming connections that are in turn failed.
Also we confirm the usual "racoon[nnn]: failed to bind to address ..... because interface address is/was not ready (flags 2)." messages early in this sequence ...
Sep 6 09:28:50 macmini-server.msf.studio msf[371]: failed to bind to address fdf3:7e55:2f5b:59b6:a1b2:bab8:8b4c:5fae[500] (Can't assign requested address).
Sep 6 09:28:50 macmini-server.msf.studio msf[371]: failed to bind to address fdf3:7e55:2f5b:59b6:a1b2:bab8:8b4c:5fae[500]: because interface address is/was not ready (flags 2).
- Initiation LAG? between the 2013 apple airport extreme router LAN port, and 24 port GBE unmanaged switch and the ethernet ports on the macmini
- the above (1.) is slow
- will look into replacing apple 2013 AC router with commercial grade router for test to determine if the Apple router 2013 is the issue. Sadly we cannot get any logs for this appliance fro Network Util nor snmp. any clues are helpful.
I will post any further developments here.
Please post any results for others to see.
Warwick
Hong Kong