Hey guys, I need some expert script help on thi one. I used some scripts found on the net and here on the forums, and adjusted them to meet my own requirements .I don't know the exact creator so I can't give the right honours.
I have 2 vlans and 2 related vlan l3 interfaces, where the vlan.20 is the untrust interface. The ip-0/0/0 interface is the 6to4 tunnel interface.
Anyway, I have 3 scripts ( 2xslt and 1 slax) to update my tunnelbroker ip, freedns dyndns and finally one to update the source ip of my ipv6 tunnel. Where the 2 first xslt scripts work perfectly the slax one fails to execute properly. When I look in the messages log I see the following logentries :
[quote]
Dec 16 21:25:27 Mordor eventd[975]: EVENTD_ESCRIPT_EXECUTION: Trying to execute the script 'update-tunnel.slax' from '/var/db/scripts/event/'
Dec 16 21:25:31 Mordor mgd[7461]: UI_LOGIN_EVENT: User 'root' login, class 'super-user' [7461], ssh-connection '', client-mode 'junoscript'
Dec 16 21:25:31 Mordor mgd[7461]: UI_JUNOSCRIPT_CMD: User 'root' used JUNOScript client to run command 'get-interface-information level-extra=terse interface-name=vlan.20'
Dec 16 21:25:37 Mordor mgd[7463]: UI_LOGIN_EVENT: User 'root' login, class 'super-user' [7463], ssh-connection '', client-mode 'junoscript'
Dec 16 21:25:37 Mordor mgd[7463]: UI_JUNOSCRIPT_CMD: User 'root' used JUNOScript client to run command 'load-configuration action="merge" format="xml"'
Dec 16 21:25:38 Mordor mgd[7444]: UI_CMDLINE_READ_LINE: User 'root', command 'show log messages | match SCRIPT '
Dec 16 21:25:47 Mordor mgd[7468]: UI_LOGIN_EVENT: User 'root' login, class 'super-user' [7468], ssh-connection '', client-mode 'junoscript'
Dec 16 21:25:47 Mordor mgd[7468]: UI_JUNOSCRIPT_CMD: User 'root' used JUNOScript client to run command 'commit-configuration'
Dec 16 21:25:47 Mordor mgd[7468]: UI_COMMIT_PROGRESS: Commit operation in progress: start loading commit script changes
Dec 16 21:25:47 Mordor mgd[7468]: UI_COMMIT_PROGRESS: Commit operation in progress: no commit script changes
Dec 16 21:25:47 Mordor mgd[7468]: UI_COMMIT_PROGRESS: Commit operation in progress: no transient commit scrript changes
Dec 16 21:25:47 Mordor mgd[7468]: UI_COMMIT_PROGRESS: Commit operation in progress: finished loading commit script changes
[/quote]
It seems that it executes the script but it doesn't get the new ip of vlan.20 interface and/or doesn't update the ip-0/0/0 tunnel source. It does seem to recognize the vlan.20 variable but more info I don't see.
Here's my related junos config :
[quote]
event-options {
policy scripts-on-wanip-change {
events SYSTEM;
attributes-match {
SYSTEM.message matches "EVENT Add";
}
then {
event-script tunnelbroker-net.xslt;
event-script freedns.xslt;
event-script update-tunnel.slax;
}
}
event-script {
traceoptions {
file log_scripts;
flag events;
flag offline;
flag output;
flag xslt;
flag all;
}
file tunnelbroker-net.xslt;
file freedns.xslt;
file update-tunnel.slax;
}
}
[/quote]
[quote]
}
vlans {
LAN {
description Internal;
vlan-id 10;
interface {
fe-0/0/5.0;
fe-0/0/4.0;
fe-0/0/3.0;
fe-0/0/2.0;
ge-0/0/1.0;
ge-0/0/0.0;
}
l3-interface vlan.10;
}
WAN {
description External;
vlan-id 20;
interface {
fe-0/0/7.0;
fe-0/0/6.0;
}
l3-interface vlan.20;
}
}
[/quote]
[quote]
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
match / {
var $ppp_iface = "vlan.20";
var $tunnel_iface = "ip-0/0/0";
var $rpc = {
<get-interface-information> {
<terse>;
<interface-name> $ppp_iface;
}
}
var $interfaces = jcs:invoke($rpc);
/* Extract PPPoE logical interface local address */
var $ppp_ip = $interfaces/logical-interface[name = $ppp_iface]/address-family[address-family-name = "inet"]/interface-address/ifa-local;
/* Reconfigure tunnel source address */
var $load_config = <load-configuration action = "merge" format = "xml"> {
<configuration> {
<interfaces> {
<interface> {
<name> $tunnel_iface;
<unit> {
<name> "0";
<tunnel> {
<source> $ppp_ip;
}
}
}
}
}
}
var $config = jcs:invoke($load_config);
var $commit = jcs:invoke("commit-configuration");
}
[/quote]