<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>I’m using the Mac OS X widget to connect to a VPN, version 5.2.1 (1) .</div>
<div><br>
</div>
<div>Sometimes, the VPN goes down.  The tail of the log from such an event is included at the bottom of this e-mail.  For the moment, I’m less worried about the specific reason for the loss of the connection; I will probably try to troubleshoot that further
 with a coworker, but for now I’m interested in detecting that fact that it’s down, and automatically trying to reestablish the connection.</div>
<div><br>
</div>
<div>Assuming that sometimes the VPN will go down for whatever reason, is there a way to get at the strongSwan components from bash?</div>
<div><br>
</div>
<div>I’m imagining writing a little script, whose pseudo-code would be:</div>
<div><br>
</div>
<div>If (vpn_is_down) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>reconnet;</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>I can think of ways to answer the question “Is the VPN down?” (e.g. Pinging a host that is on the other network) but I don’t know if there is a way to bring the connection up from the command line?</div>
<div><br>
</div>
<div>Thanks in advance for any advice or suggestions.</div>
<div><br>
</div>
<div><br>
</div>
<div>-Dan</div>
<div><br>
</div>
<div>======log snippet=====</div>
<div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>sending DPD request</div>
<div>generating INFORMATIONAL request 449 [ N(NATD_S_IP) N(NATD_D_IP) ]</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (124 bytes)</div>
<div>received packet: from x.x.x.x[4500] to 192.168.0.8[56570] (124 bytes)</div>
<div>parsed INFORMATIONAL response 449 [ N(NATD_S_IP) N(NATD_D_IP) ]</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>sending DPD request</div>
<div>generating INFORMATIONAL request 450 [ N(NATD_S_IP) N(NATD_D_IP) ]</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (124 bytes)</div>
<div>received packet: from x.x.x.x[4500] to 192.168.0.8[56570] (124 bytes)</div>
<div>parsed INFORMATIONAL response 450 [ N(NATD_S_IP) N(NATD_D_IP) ]</div>
<div>initiating IKE_SA Certifi VPC[21] to x.x.x.x</div>
<div>generating CREATE_CHILD_SA request 451 [ SA No KE ]</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>retransmit 1 of request with message ID 451</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>retransmit 2 of request with message ID 451</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>retransmit 3 of request with message ID 451</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>retransmit 4 of request with message ID 451</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>retransmit 5 of request with message ID 451</div>
<div>sending packet: from 192.168.0.8[56570] to x.x.x.x[4500] (1116 bytes)</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>sending keep alive to x.x.x.x[4500]</div>
<div>giving up after 5 retransmits</div>
<div>rekeying IKE_SA failed, peer not responding</div>
</div>
<div><br>
</div>
</body>
</html>