wolf74
June 1, 2011, 11:05pm
1
Hello everyone.
I need to create an IPSec VPN with a firewall (the ZyWALL) remote that has dynamic public IP address.
Following these indications I made a script that updates the IP address in IP IPSec Peer.
But it does not work as I enter the address must have the suffix "/ 32 ", while the resolved address does not have this suffix.
How do I add the suffix “/ 32” to my variable resolvedIP?
TIA
here my actual script
add name=resolver policy=reboot,read,write,policy,test,password,sniff,sensitive source={
:local resovedIP [:resolve "xxxxxxx.dyndns.org"];
:local peerID [/ip ipsec peer find comment="myipsec"];
:local currentIP [/ip ipsec peer get $peerID address];
:if ($resolvedIP != $currentIP) do={ /ip ipsec peer set $peerID address=$resolvedIP ; /log info "peer ip updated";
}
}
petrn
June 2, 2011, 4:50am
2
Hi,
address=($resolvedIP."/32")
thank you.
I modified the script according to your suggestion, but it doesn’t work.
I’m new to routeros scripting, please, can you check my script and see where i’m wrong?
or tell me where I can check to make a debug by myself
I need to update 2 fields:
/ip ipsec peers set 0 address=“x.x.x.x/32”
/ip ipsec policy set 0 sa-dst-address=“x.x.x.x”
TIA
actual script
:local resolvedIP [:resolve "xxxxx.dyndns.org"];
:local finalIP=($resolvedIP."/32")
/ip ipsec policy set 0 sa-dst-address=$resolvedIP;
/ip ipsec peer set 0 address=$finalIP;
petrn
June 2, 2011, 6:08pm
4
:local resolvedIP [:resolve "xxxxx.dyndns.org"];
:local finalIP=($resolvedIP."/32")
/ip ipsec policy set [find dst-address="<IP to match>"] sa-dst-address=$resolvedIP;
/ip ipsec peer set [find comment="myipsec"] address=$finalIP;
You cannot use item number before ‘print’ or ‘find’.