Hey kids — here's fun.
Say — purely for the sake of argument, you understand — that you'd set up a couple of OS X v10.7 servers for a client, and had configured VPN via the Server.app (very simple, neat, alarmingly sparse in detail), and then discovered that a hitherto unknown device on the network had seized the static address you'd assigned to the server.
Were this to happen, it would be time to reach into the bag o' DNS tricks and breakout "sudo changeip" to switch the server static IP from the incompatible IP (192.168.0.254) to the new and improved IP (192.168.0.250). All pretty straightforward, and everything would seem to be perfectly happy with this new state of affairs. All would be right with the world, the sun would shine, and small bluebirds would alight upon your shoulder to pipe their miniature, joyous odes to your firm jaw and carefree brow. No? No.
The beauty of having VPN service snagged by Server.app is that it makes it terribly simple to set up VPN. And the curse of having VPN service snagged by Server.app is the same thing, but with an emphasis on "terrible" and "simple". Other than a spot to plug in a shared secret and a giant on/off switch, there's not a hell of a lot else there to help you out with fine tuning — unlike Snow Leopard Server which, by comparison, gave you a lot more to think about. What to do?
Well, for starters, I'd recommend using the serveradmin command line tool to take a look at what's going on. Thankfully, the serveradmin tool still maintains control of a huge swathe of what your server is actually boiling away on under the GUI, so plugging in this:
sudo serveradmin settings vpn
…returns this:
vpn:vpnHost = "" vpn:Servers:com.apple.ppp.pptp:Server:Logfile = "/var/log/ppp/vpnd.log" vpn:Servers:com.apple.ppp.pptp:Server:VerboseLogging = 1 vpn:Servers:com.apple.ppp.pptp:Server:MaximumSessions = 128 vpn:Servers:com.apple.ppp.pptp:DNS:OfferedSearchDomains:_array_index:0 = "mysteryclientname.net" vpn:Servers:com.apple.ppp.pptp:DNS:OfferedServerAddresses:_array_index:0 = "192.168.0.254" vpn:Servers:com.apple.ppp.pptp:DNS:OfferedServerAddresses:_array_index:1 = "192.168.0.254" vpn:Servers:com.apple.ppp.pptp:Radius:Servers:_array_index:0:SharedSecret = "1" vpn:Servers:com.apple.ppp.pptp:Radius:Servers:_array_index:0:Address = "1.1.1.1" vpn:Servers:com.apple.ppp.pptp:Radius:Servers:_array_index:1:SharedSecret = "2" vpn:Servers:com.apple.ppp.pptp:Radius:Servers:_array_index:1:Address = "2.2.2.2" vpn:Servers:com.apple.ppp.pptp:EAP:KerberosServicePrincipalName = "vpn/server1.mysteryclientname.net@server1.mysteryclientname.net" vpn:Servers:com.apple.ppp.pptp:enabled = no vpn:Servers:com.apple.ppp.pptp:Interface:SubType = "PPTP" vpn:Servers:com.apple.ppp.pptp:Interface:Type = "PPP" vpn:Servers:com.apple.ppp.pptp:PPP:LCPEchoFailure = 5 vpn:Servers:com.apple.ppp.pptp:PPP:DisconnectOnIdle = 1 vpn:Servers:com.apple.ppp.pptp:PPP:AuthenticatorEAPPlugins:_array_index:0 = "EAP-RSA" vpn:Servers:com.apple.ppp.pptp:PPP:AuthenticatorACLPlugins:_array_index:0 = "DSACL" vpn:Servers:com.apple.ppp.pptp:PPP:CCPEnabled = 1 vpn:Servers:com.apple.ppp.pptp:PPP:IPCPCompressionVJ = 0 vpn:Servers:com.apple.ppp.pptp:PPP:ACSPEnabled = 1 vpn:Servers:com.apple.ppp.pptp:PPP:LCPEchoEnabled = 1 vpn:Servers:com.apple.ppp.pptp:PPP:LCPEchoInterval = 60 vpn:Servers:com.apple.ppp.pptp:PPP:MPPEKeySize128 = 1 vpn:Servers:com.apple.ppp.pptp:PPP:AuthenticatorProtocol:_array_index:0 = "MSCHAP2" vpn:Servers:com.apple.ppp.pptp:PPP:MPPEKeySize40 = 0 vpn:Servers:com.apple.ppp.pptp:PPP:AuthenticatorPlugins:_array_index:0 = "DSAuth" vpn:Servers:com.apple.ppp.pptp:PPP:Logfile = "/var/log/ppp/vpnd.log" vpn:Servers:com.apple.ppp.pptp:PPP:VerboseLogging = 1 vpn:Servers:com.apple.ppp.pptp:PPP:DisconnectOnIdleTimer = 7200 vpn:Servers:com.apple.ppp.pptp:PPP:CCPProtocols:_array_index:0 = "MPPE" vpn:Servers:com.apple.ppp.pptp:IPv4:ConfigMethod = "Manual" vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:0 = "192.168.0.224" vpn:Servers:com.apple.ppp.pptp:IPv4:DestAddressRanges:_array_index:1 = "192.168.0.254" vpn:Servers:com.apple.ppp.pptp:IPv4:OfferedRouteAddresses = _empty_array vpn:Servers:com.apple.ppp.pptp:IPv4:OfferedRouteTypes = _empty_array vpn:Servers:com.apple.ppp.pptp:IPv4:OfferedRouteMasks = _empty_array vpn:Servers:com.apple.ppp.l2tp:Server:LoadBalancingAddress = "1.2.3.4" vpn:Servers:com.apple.ppp.l2tp:Server:MaximumSessions = 128 vpn:Servers:com.apple.ppp.l2tp:Server:LoadBalancingEnabled = 0 vpn:Servers:com.apple.ppp.l2tp:Server:Logfile = "/var/log/ppp/vpnd.log" vpn:Servers:com.apple.ppp.l2tp:Server:VerboseLogging = 1 vpn:Servers:com.apple.ppp.l2tp:DNS:OfferedSearchDomains:_array_index:0 = "mysteryclientname.net" vpn:Servers:com.apple.ppp.l2tp:DNS:OfferedServerAddresses:_array_index:0 = "192.168.0.254" vpn:Servers:com.apple.ppp.l2tp:DNS:OfferedServerAddresses:_array_index:1 = "192.168.0.254" vpn:Servers:com.apple.ppp.l2tp:Radius:Servers:_array_index:0:SharedSecret = "1" vpn:Servers:com.apple.ppp.l2tp:Radius:Servers:_array_index:0:Address = "1.1.1.1" vpn:Servers:com.apple.ppp.l2tp:Radius:Servers:_array_index:1:SharedSecret = "2" vpn:Servers:com.apple.ppp.l2tp:Radius:Servers:_array_index:1:Address = "2.2.2.2" vpn:Servers:com.apple.ppp.l2tp:EAP:KerberosServicePrincipalName = "vpn/server1.mysterclientname.net@server1.mysteryclientname.net""
vpn:Servers:com.apple.ppp.l2tp:enabled = yes
vpn:Servers:com.apple.ppp.l2tp:Interface:SubType = "L2TP" vpn:Servers:com.apple.ppp.l2tp:Interface:Type = "PPP" vpn:Servers:com.apple.ppp.l2tp:PPP:LCPEchoFailure = 5 vpn:Servers:com.apple.ppp.l2tp:PPP:DisconnectOnIdle = 1 vpn:Servers:com.apple.ppp.l2tp:PPP:AuthenticatorEAPPlugins:_array_index:0 = "EAP-KRB" vpn:Servers:com.apple.ppp.l2tp:PPP:AuthenticatorACLPlugins:_array_index:0 = "DSACL" vpn:Servers:com.apple.ppp.l2tp:PPP:VerboseLogging = 1 vpn:Servers:com.apple.ppp.l2tp:PPP:IPCPCompressionVJ = 0 vpn:Servers:com.apple.ppp.l2tp:PPP:ACSPEnabled = 1 vpn:Servers:com.apple.ppp.l2tp:PPP:LCPEchoInterval = 60 vpn:Servers:com.apple.ppp.l2tp:PPP:LCPEchoEnabled = 1 vpn:Servers:com.apple.ppp.l2tp:PPP:AuthenticatorProtocol:_array_index:0 = "MSCHAP2" vpn:Servers:com.apple.ppp.l2tp:PPP:AuthenticatorPlugins:_array_index:0 = "DSAuth" vpn:Servers:com.apple.ppp.l2tp:PPP:Logfile = "/var/log/ppp/vpnd.log" vpn:Servers:com.apple.ppp.l2tp:PPP:DisconnectOnIdleTimer = 7200 vpn:Servers:com.apple.ppp.l2tp:IPSec:SharedSecretEncryption = "Keychain" vpn:Servers:com.apple.ppp.l2tp:IPSec:LocalIdentifier = "" vpn:Servers:com.apple.ppp.l2tp:IPSec:SharedSecret = "com.apple.ppp.l2tp" vpn:Servers:com.apple.ppp.l2tp:IPSec:AuthenticationMethod = "SharedSecret" vpn:Servers:com.apple.ppp.l2tp:IPSec:RemoteIdentifier = "" vpn:Servers:com.apple.ppp.l2tp:IPSec:IdentifierVerification = "None" vpn:Servers:com.apple.ppp.l2tp:IPSec:LocalCertificate = <> vpn:Servers:com.apple.ppp.l2tp:IPv4:ConfigMethod = "Manual" vpn:Servers:com.apple.ppp.l2tp:IPv4:DestAddressRanges:_array_index:0 = "192.168.0.201" vpn:Servers:com.apple.ppp.l2tp:IPv4:DestAddressRanges:_array_index:1 = "192.168.0.240" vpn:Servers:com.apple.ppp.l2tp:IPv4:OfferedRouteAddresses = _empty_array vpn:Servers:com.apple.ppp.l2tp:IPv4:OfferedRouteTypes = _empty_array vpn:Servers:com.apple.ppp.l2tp:IPv4:OfferedRouteMasks = _empty_array vpn:Servers:com.apple.ppp.l2tp:L2TP:Transport = "IPSec" vpn:Servers:com.apple.ppp.l2tp:L2TP:IPSecSharedSecretValue = "pencil123" server1:~ ladmin$
Whoa. Trawling through this reveals a couple of interesting things. Firstly, the IPSec shared secret is stored unencrypted in plain text, which seems like a bit of a security grey area to me, but hey, what do I know? Secondly, the DNS settings for both L2TP and PPTP are both set to
DNS:OfferedServerAddresses:_array_index:0 = "192.168.0.254"
Aha. With that in hand, you'd roll up your sleeves and screw your thinking cap firmly into place, then go hunting for the config plist for the VPN service. To save you time, I'll tell you where it is. Aren't I nice? It's at:
/Library/Preferences/SystemConfiguration/com.apple.RemoteAccessServers.plist
Editing it with su permissions, all you have to do is scroll through and replace the old, broken DNS settings with the new and improved ones.
Old and busted:
<key>DNS</key>
<dict>
<key>OfferedSearchDomains</key>
<array>
<string>mysteryclientname.net</string>
</array>
<key>OfferedServerAddresses</key>
<array>
<string>192.168.0.254</string>
<string>192.168.0.254</string>
</array>
New hotness:
<key>DNS</key>
<dict>
<key>OfferedSearchDomains</key>
<array>
<string>mysteryclientname.net</string>
</array>
<key>OfferedServerAddresses</key>
<array>
<string>192.168.0.250</string>
<string>192.168.0.251</string>
</array>
Once you've saved the file out, simply stop and start the VPN service, and the new DNS info should replicate out to VPN clients. In the examples above, I've included 192.168.0.251, which is the secondary DNS we set up.




FYI, there's a thread at the Apple Discussion forums on this topic, which points out a way to use the serveradmin tool to change those config settings directly, instead of having to edit the plist.:
sudo serveradmin settings
vpn:Servers:com.apple.ppp.l2tp:DNS:OfferedServerAddresses:_array_index:0 = "172.28.1.101"
vpn:Servers:com.apple.ppp.pptp:DNS:OfferedServerAddresses:_array_index:0 = "172.28.1.101"
[ctrl+d]
Where was that thread when we were trying to figure the damn thing out last year
Nice find. Thanks, Sylvan!
hi!,
i have a big problem since im not really a techy guy. i would like to setup my vpn.i have server admin tool and server app uploaded.can you help me setup all of these? a simple step by step tutorial would be great.i have come acrossed alot of tutorials already but i got stucked one way or another.specially entering my password to the TERMINAL and i cant find a vpn service in my server admin.pls help me…
If you're not a big techy guy, that's perfectly fine. Working with VPN on Lion server is an uphill climb for everyone, so if you'd prefer to keep your sanity and you don't feel comfortable with the Terminal, I'd suggest skipping the whole miserable experience and using a VPN server app like iVPN instead.
iVPN is actually really simple and nice and does it all for you. I haven't worked with it much, but Seth rates it highly (and will probably be writing a more in-depth article about it soon).
Good luck!