Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Forum zu aktuellen Geräten der LANCOM Router/Gateway Serie

Moderator: Lancom-Systems Moderatoren

Antworten
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Hallo,

ich habe hier 1* KabelBW 200/25 und 1*VDSL 100/36 beide aktiv. Die Public IPs habe ich auf der KABELBW Seite. Da momentan leider die Verbindung recht instabil ist habe ich VDSL als Backup & VPN Tunnel für Datareplication (wg. Bandbreite).
Die Public DNS werden jetzt via Action Table auf der KabelBW Seite aktiviert. Bei Establish Failed werden dann mit den u.g. Befehl die Action Table Entries aktiviert. Das funktioniert auch so. Leider gehen (aus welchen Gründen auch immer) ab und zu Befehle verloren (in Realität sind es 23 Stück bei jeder Umschaltung). Auch wäre es schön hier ein Script aufrufen zu können oder eine bessere Idee zu haben.

Vielen Dank

Henri

KABELBW erstablished:
exec:ssh root@gw11 set /Setup/WAN/Action-Table/34 No

KABELBW estbl-failed:
exec:ssh root@gw11 set /Setup/WAN/Action-Table/34 Yes

GW11:

11 No MAIL.DE INTERNET 2160000 Establish https://x:y@dyndns.strato.com/nic/updat ... ckmx=NOCHG contains=good %a?skipiftrue=2
Benutzeravatar
Jirka
Beiträge: 5225
Registriert: 03 Jan 2005, 13:39
Wohnort: Ex-OPAL-Gebiet
Kontaktdaten:

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Jirka »

Hallo Henri,

und wie stehen die beschriebenen Gegenstellen mit dem oder den LANCOMs in Beziehung? Das hört sich ja so an, also ob jede Gegenstelle an einen eigenen LANCOM gebunden ist, wäre es nicht sinnvoll, das an einem Router zusammenzuführen?
Und bezüglich der DynDNS-Adresse, die mal auf den einen, mal auf den anderen Anschluss zeigen soll: Wenn es nur die VPNs betrifft, dann ist es in der Praxis sinnvoller, für diese ein Backup einzurichten, als hier mit der DynDNS-Adresse rumzuhantieren und die auf die Backup-Leitung zeigen zu lassen.

Viele Grüße,
Jirka
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Danke für die Antworten.

Ich habe Probleme mit der verfügbaren Bandbreite und möchte daher beide Leitungen nutzen.
Es gibt hier auch innerhalb der nächsten 2 Jahren keine Glasfaser, daher möchte ich für die VPN "Standleitung" den VDSL Anschluß nutzen und für den Reset KabelBW. Grundsätzlich kein Problem, allerdings ist heute 2 * die KABELBW Verbindung ausgefallen. In diesem Fall versuche ich dann die KABELBW Public IPs via DYNDNS auf die VDSL Leitung zu verschieben, das mach mit den Lock Times etc. ein paar Probleme. Daher die Frage wie so etwas besser geht.

P.S. Bei KABELBW höre ich seit ein paar Wochen dass es eine Großstörung gibt, ohne nähere Angaben...

Danke und viele Grüße

Henri
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Ich sollte noch erwähnen, wir haben wir 5 Public IPs bei KabelBW, es geht also nicht nur um VPN.
Bzgl. der 2 Geräte, der 7100+ unterstützt kein VDSL (mit externen Modem hatte ich auch so meine Probleme) und es sollt auch der Fall abgedeckt werden, dass 1 Geräte ausfällt (d.h. VRRP). Backbone 10Gbit, 3 vSphere Hosts, ca. 40 VMs, Mail, Private Cloud etc..

Mit vielen Grüßen

Henri
Benutzeravatar
Jirka
Beiträge: 5225
Registriert: 03 Jan 2005, 13:39
Wohnort: Ex-OPAL-Gebiet
Kontaktdaten:

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Jirka »

Hallo Henri,
Henri hat geschrieben:Ich habe Probleme mit der verfügbaren Bandbreite und möchte daher beide Leitungen nutzen.
ok, das sehe ich genauso und ich habe Dir auch nichts anderes empfohlen.
Henri hat geschrieben:das mach mit den Lock Times etc. ein paar Probleme
Das ist in so einem Fall völlig ungeeignet. Das ist ja ein Spezialfall, dafür taugt das Standard-Script nicht.
Henri hat geschrieben:Daher die Frage wie so etwas besser geht.
Auf alle Fälle nicht mit einer Lock-Time. Das geht gar nicht (das ist schon im Standardfall schlecht).
Man muss auf beiden Seiten Scripte laufen haben, die mit einem Repeat von 60 Sek. laufen (oder evt. noch weniger). Um keine doppelten DNS-Updates durchzuführen, sollte man in Umgebungsvariablen den letzten Stand der Dinge festhalten und diese Werte entsprechend auswerten. Ebenso könnte man im jeweils anderen Gerät eine Umgebungsvariable setzen, die dann im Script dazu führt, dass eben ein DNS-Update durchgeführt wird oder eben nicht, so dass die DynDNS-Adresse immer auf die richtige IP-Adresse zeigt.

Scripte ohne Lock-Times siehe z. B. hier: http://www.lancom-forum.de/lancom-faq-f ... t5312.html

Ich kann Dir auch ein Script entwickeln, allerdings bin ich derzeit so mit Aufträgen voll, dass das dieses Jahr zumindest nichts mehr wird.

Viele Grüße,
Jirka
GrandDixence
Beiträge: 1060
Registriert: 19 Aug 2014, 22:41

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von GrandDixence »

Im Beitrag vom "02 Sep 2016, 11:25" ist ein im Alltagsgebrauch zuverlässig und sicher funktionierendes Aktionstabellen-Beispiel für Dynamisches DNS mit dem kostenlosen und sehr empfehlenswerten Anbieter spDYN dargestellt:
http://www.lancom-forum.de/fragen-zum-t ... tml#p86775

Für die Aktualisierung der Dynamischen DNS wird eine verschlüsselte Übertragung (HTTPS) verwendet mit einem Update-Token. SpDyn unterstützt auch IPv6:
http://www.lancom-forum.de/post91716.html

Wie bereits mitgeteilt, sollte für jeden WAN-Anschluss mit dynamisch zugewiesener IP-Adresse (DHCP) ein eigenes Dynamisches DNS verwendet werden (WAN-1 => wan1.spdns.de; WAN-2 => wan2.spdns.de). In der Aktionstabelle muss für jeden WAN-Anschluss die Gegenstelle korrekt konfiguriert werden (WAN-1 => 3 Zeilen Aktionstabelle mit Gegenstelle1; WAN-2 => 3 Zeilen Aktionstabelle mit Gegenstelle2). Bei IPv4 funktioniert das ganze nur, wenn der WAN-Anschluss mit einer öffentlichen IPv4-Adresse betrieben wird!
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Hallo Jirka,

vielen Dank für deine Antwort und den Link. Ich verwende hier Strato, aber das ist recht ähnlich.
Ich habe allerdings ca. 10 DYNDNS Einträge die umzuschalten sind und habe mich bei meinen 23 Action Table Entries schon ein paar Mal vertippt. Gibt es keine Chance unter /MINIFS ein Script mit den HTTPS:// Commands und etwas Logik abzulegen das ich dann in der Action Table aufrufen kann?

Danke und Gutes Neues Jahr und viele Grüße

Henri
Benutzeravatar
Jirka
Beiträge: 5225
Registriert: 03 Jan 2005, 13:39
Wohnort: Ex-OPAL-Gebiet
Kontaktdaten:

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Jirka »

Hallo Henri,
Henri hat geschrieben:Ich verwende hier Strato, aber das ist recht ähnlich.
genau, die verwenden ja fast alle die DynDNS-API.
Henri hat geschrieben:Ich habe allerdings ca. 10 DYNDNS Einträge die umzuschalten sind und habe mich bei meinen 23 Action Table Entries schon ein paar Mal vertippt.
Ich kenne das Problem... Wobei, ob Du letztlich eine oder 10 DynDNS-Adressen aktualisieren musst, spielt nicht so wirklich die Rolle, man muss nur die entsprechenden Code-Zeilen kopieren (und anpassen; die Länge der Aktionstabelle ist ja nicht mehr so wie früher begrenzt). Leider kann man ja auch eine DynDNS-Adresse nicht einfach auf eine andere DynDNS-Adresse verweisen, das ist ein eklatanter Mangel, aber da ich DynDNS nicht mehr so intensiv nutze, habe ich es mir verkniffen, die darauf mal hinzuweisen. Aber bei Strato könnte man ja mal anfragen... wobei der Aufwand für die Aktualisierung der vielen Adressen vermutlich geringer ausfällt.
Das Vertippen gerade beim Springen ist lästig, aber da kann einem so eine Excel-Tabelle echt weiter helfen.
Henri hat geschrieben:Gibt es keine Chance unter /MINIFS ein Script mit den HTTPS:// Commands und etwas Logik abzulegen das ich dann in der Action Table aufrufen kann?
Scripte kann man auf einem USB-Stick ablegen. Die kann man auch von der Aktionstabelle aus starten. Aber mit https und Logik sieht es ganz schlecht aus, das gibt es nicht. Logik- und Sprung-Funktionen sind ausschließlich in der Aktionstabelle zu haben.
Henri hat geschrieben:und Gutes Neues Jahr
Danke, ebenfalls.

Viele Grüße,
Jirka
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Hallo Jirka,

ich habe einmal ein wenig herumgebastelt. Bekomme ich Javascript auch in einen LANCOM HTTP Server eingebaut?
Hab's noch nicht getestet.

P.S: geht das auch noch etwas besser? Das sind 62 Action Table Entries pro Adresse, damit komme ich auch 620 Stück für meine Konfiguration.

Danke und viele Grüße

Henri

Code: Alles auswählen

#! /usr/local/bin/node

// curl "http://127.0.0.1:60443/?host=mail&domain=xxx.net&userid=user&password=pass&action=10&mailto=ich@xxx.net&peer=Internet&ipaddr=1.1.1.1&ssh=root@gw11&dyndns=dyndns=dyndns.strato.com/nic/update"
// curl "http://127.0.0.1:60443/?host=mail&domain=xxx.net&userid=user&password=pass&action=10&mailto=ich@xxx.net&peer=Internet&ipaddr=1.1.1.1&dyndns=dyndns.strato.com/nic/update"


var http = require('http');
var url = require('url');
var querystring = require('querystring');

const port = 60443;

const actionTable = "/Setup/WAN/Action-Table";
const establish = '"Establish"';
const establish_failed = '"Establish-Failure"';
const def = '{Routing-Tag}  0';

const $userid   = "${userid}";
const $password = "${password}";
const $host     = "${host}";  
const $domain   = "${domain}";  
const $dyndns   = "${dyndns}";  
const $mailto   = "${mailto}";  
const $ipaddr   = "${ipaddr}";
const $bipaddr = "${bipaddr}";
const $ssh      = "${ssh}"
const $peer     = "${peer}"
const $yesno    = "${yesno}"
const $event    = "${event}"
const $action    = "${action}"
const $actionssh   = "${actionssh}"
const $actionTable   = "${actionTable}"

var actionNUM = 0;

var script = new Array;
var i = 0;

script[i++] = '# Script to Setup Strato DYNDNS for one Address ';
script[i++] = 'lang English';
script[i++] = 'flash no'
script[i++] = 'cd ' + actionTable;
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "exec:getenv ${host}" {Check-For} "isequal=${ipaddr}?skipiftrue=20" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "isequal=?skipiffalse=2" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "exec:sleep 1m" {Check-For} "" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "dnscheck:${host}.${domain}" {Check-For} "isequal=${ipaddr}?skipiftrue=16" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "http://${userid}:${password}@${dyndns}?hostname=${host}.${domain}&myip=${ipaddr}&wildcard=NOCHG&mx=${host}.${domain}&backmx=NO" {Check-For} "contains=good ${ipaddr}?skipiftrue=15" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=nochg ${ipaddr}?skipiftrue=14" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=HTTP protocol error 401?skipiftrue=8" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=nohost?skipiftrue=7" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=notfqdn?skipiftrue=6" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=!yours?skipiftrue=5" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=numhost?skipiftrue=4" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=dnserr?skipiftrue=4" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=911?skipiftrue=3" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "lastresult:" {Check-For} "contains=abuse?skipiftrue=4" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "repeat:600"  {Check-For} "contains=timer started?skipiftrue=6" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "mailto:${mailto}?subject=Update ${host}.${domain} failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} failed!" {Check-For} "contains=?skipiftrue=5" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "mailto:${mailto}?subject=Update ${host}.${domain} temporary failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} temporary failed. Retry in 1h." {Check-For} "" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "repeat:3600" {Check-For} "contains=timer started?skipiftrue=3" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "mailto:${mailto}?subject=Update ${host}.${domain} failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} failed due to abuse. Retry in 24h." {Check-For} "" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "repeat:86400" {Check-For} "contains=timer started?skipiftrue=1" ' + def; 
script[i++] = 'add ${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ' + establish + ' {Action} "exec:setenv ${host} ${ipaddr}" {Check-For} "" ' + def; 

ssh = "ssh ${ssh} "
sshScript = 'add ${action} {Active} Yes {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${event} {Action} "exec:' + ssh + ' set ${actionssh} {Active} ${yesno}" {Check-For} "" ' + def; 


//
function invokeReplace ( host, domain, dyndns, userid, password, actionNUM, actionNUMssh, mailto, peer, ipaddr, yesno, event, line, ssh ) {
			
	    var i = 20;
		
	    while ( line.includes("${") ) {
			
		     	line = line.replace($userid,userid);
				line = line.replace($userid,userid);
				line = line.replace($password,password);
			 	line = line.replace($domain,domain);
				line = line.replace($host,host);
				line = line.replace($dyndns,dyndns);
				line = line.replace($mailto,mailto);
				line = line.replace($peer,peer);
				line = line.replace($ipaddr,ipaddr);
				line = line.replace($ipaddr,ipaddr);
				line = line.replace($event,event);
				line = line.replace($yesno,yesno);
				line = line.replace($ssh,ssh);
				line = line.replace($action,actionTable + "/" + actionNUM);
				line = line.replace($actionssh,actionTable + " " + actionNUMssh);
							
				i = i -1;
				
				if ( i <= 0 ) {
					console.log("Loop Protection, variable not resolved:" + line );
					throw 'Loop Protection, variable not resolved:' + line;
				}
			}
			
		return line
}

//
function invokeSSH (ssh,cmd,out) {
	
	if ( ssh != null ) {
		var r = "ssh " + ssh + " " + cmd;
		out = out + "\n" + r;
	}
	 
	return out;
}

//
function invokeScript ( host, domain, dyndns, userid, password, action, mailto, peer, ipaddr, bipaddr, script, ssh ) {
	
	var output = new String("");
	
	actionNUM = action;	
	actionNUMssh = action;	
	
	for (var i = 0 ; i < script.length ; i++) {
		
		var text = script[i];
		
		var record  = invokeReplace(host,domain, dyndns, userid, password, actionNUM, null, mailto, peer, ipaddr, 'Yes', null, text,null);
		var b_record  = invokeReplace(host,domain, dyndns, userid, password, actionNUM, null, mailto, peer, bipaddr, 'No', null, text,null);
		
		if ( text.includes($action) ) {
			
			if ( output.length = 0 ) {	 
				output = "del " + actionTable + " " + actionNUM;
				output = invokeSSH(ssh,"del " + actionTable + "/" + actionNUM,output);
			}
			else {
				output = output + '\n' + "del " + actionTable + "/" + actionNUM;
				output = invokeSSH(ssh,"del " + actionTable + "/" +  actionNUM,output);
			}	
		actionNUM++;
		
		}
				
		if ( output.length = 0  ) {	 
			output = record;
		}
		else {
			output = output + '\n' + record;
			if ( text.includes($action) ) {
				output = invokeSSH(ssh,b_record,output);
			}	
		}
	}
	
	for (var i = 0 ; i < script.length ; i++) {
		
		var text = script[i];
				
		if ( ssh != null ) {
			if ( text.includes($action) ) {
				
				output = output + '\n' + "del " + actionTable + "/" + actionNUM;
				output = output + '\n' + invokeReplace(host, domain, dyndns, userid, password, actionNUM, actionNUMssh, mailto, peer, ipaddr, 'No', establish, sshScript, ssh);
				actionNUM++;
				actionNUMssh++;	
				
				output = output + '\n' + "del " + actionTable + "/" + actionNUM;
				output = output + '\n' + invokeReplace(host, domain, dyndns, userid, password, actionNUM, actionNUMssh, mailto, peer, ipaddr, 'Yes', establish_failed , sshScript, ssh);
				actionNUM++;
				actionNUMssh++;				
			}	
		}	
	}
	
	output = output + '\n' + 'cd /';
	output = output + '\n' + 'flash Yes';
	output = output + '\n' + '# done';
	output = output + '\n' + 'exit';
	
	console.log('Finished, Action-Tbl-Start:' + action + ', Action-Tbl-End:' + actionNUM);
	
	return output;
}

var server = http.createServer(
	
	function(req, res) {
	
		var page = url.parse(req.url).pathname;
    	var params = querystring.parse(url.parse(req.url).query);
	
    	res.writeHead(200, {"Content-Type": "text/plain"});
		
		var host 	    = params['host'];
		var domain 	    = params['domain'];
		var dyndns 	    = params['dyndns'];
		var userid 		= params['userid'];
		var password 	= params['password'];
		var action 		= params['action'];
		var mailto 		= params['mailto'];
		var ssh 		= params['ssh'];
		var ipaddr 		= params['ipaddr'];
		var bipaddr 	= params['bipaddr'];
		var peer	 	= params['peer'];
		
		if ( ipaddr == null) {
			 ipaddr = "%a"
		}
		if ( bipaddr == null) {
			 bipaddr = "%a"
		}
		
		
		var msg = '${Page}:' + page + ' ' + $host + ":" + host + " " + $domain + ":" + domain + ' ' + $userid + ":" + userid + ' ' + $ipaddr + ':' + ipaddr;
		
		switch (page) {
			
		case '/favicon.ico':
			console.log('Ignore:/favicon.ico' + " ¢{Page}:" + page);
			break;
			
		case '/': 		
			if ( domain != null && userid != null && password != null && action != null && mailto != null && peer != null && ipaddr != null ) {	
				
				console.log(msg);
				res.write(invokeScript(host,domain, dyndns, userid, password, action, mailto, peer, ipaddr, bipaddr, script, ssh));
    		}
    		else {
				console.log('Missing Parameter:' + msg);
        		res.write('Missing Parameter');
    		}
			break;
			
		default:
				console.log('Wrong Page' + msg);
        		res.write('Wrong Page');
    		break;
		}
		
		res.end();
		
	}
);

console.log('LANCOM DYNDNS Script Generator Version 0.1, by Henri Hoffmann, Listening Port:' + port);

server.listen(port);
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Hallo,

nach einigen Updates funktioniert der Mechanismus nun wohl, vielen Dank nachmals an Jirka, ich habe seine DynDNS Definitionen kopiert.

Erkenntnisse:

1.) loadscript http://host:port/dyndns?a=1&b=2 funktioniert nicht.
loadscript http://host:port/dyndns?a=1&b=2
RcDownload: invalid URL

Syntax Error:
Ist das so beabsichtigt, wenn ja wieso?

2.) ssh in loadscript:

"ssh root@gw11 set /Setup/WAN/Action-Table/459 {Active} No {Host-Name} "aerofs" {Peer} "Internet" {Lock-Time} 0 {Condition} "Establish-Failure"" executed

ca. 5-10% des SSH Kommandos in den Script werden nicht ausgeführt. Welche ist Zufall. Wenn ich das Script 5 Mal starte ist alles da.

Frage: geht das dann auch in der Action Table schief? Wenn ja wird dann mein Mechanismus nicht korrekt funktionieren, das wäre schlecht.

Vielen Dank nachmals und viele Grüße

Henri
Henri
Beiträge: 401
Registriert: 23 Jul 2005, 01:42

Re: Backup KabelBW & VDSL (Beide aktiv) mit dyndns

Beitrag von Henri »

Okay, jetzt funktioniert es korrekt.

Leider funktionieren die SSH Befehle in dieser Menge nicht. Ich habe daher nach einen guten Tipp vom Support 2 Scripte zu Ein-/Ausschalten der Action Table Entries auf dem WEBserver der 7100+ gespeichert, diese werden dann mit ssh loadscript http:// in der Action Table des 7100+ aktiviert.
In Jirkas Script fehlt noch ein "unset" sonst funktioniert es nicht so gut.

Vielen Dank für die Hilfe

Henri

cd ${actionTable}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "exec:getenv ${host}" {Check-For} "isequal=${ipaddr}?skipiftrue=20" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "isequal=?skipiffalse=2" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "exec:sleep 1m" {Check-For} "" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "dnscheck:${host}.${domain}" {Check-For} "isequal=${ipaddr}?skipiftrue=16" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "http://${userid}:${password}@${dyndns}?hostname=${host}.${domain}&myip=${ipaddr}&wildcard=NOCHG&mx=${host}.${domain}&backmx=NO" {Check-For} "contains=good ${ipaddr}?skipiftrue=15" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=nochg ${ipaddr}?skipiftrue=14" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=HTTP protocol error 401?skipiftrue=8" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=nohost?skipiftrue=7" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=notfqdn?skipiftrue=6" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=!yours?skipiftrue=5" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=numhost?skipiftrue=4" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=dnserr?skipiftrue=4" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=911?skipiftrue=3" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "lastresult:" {Check-For} "contains=abuse?skipiftrue=4" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "repeat:600" {Check-For} "contains=timer started?skipiftrue=6" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "mailto:${mailto}?subject=Update ${host}.${domain} failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} failed!" {Check-For} "contains=?skipiftrue=5" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "mailto:${mailto}?subject=Update ${host}.${domain} temporary failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} temporary failed. Retry in 1h." {Check-For} "" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "repeat:3600" {Check-For} "contains=timer started?skipiftrue=3" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "mailto:${mailto}?subject=Update ${host}.${domain} failed?body=DNS Update FQDN ${host}.${domain} WAN-IP ${ipaddr} failed due to abuse. Retry in 24h." {Check-For} "" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "repeat:86400" {Check-For} "contains=timer started?skipiftrue=1" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} ${Condition} {Action} "exec:setenv ${host} ${ipaddr}" {Check-For} "" ${def}
set ${actionTable}/${action} {Active} ${yesno} {Host-Name} "${host}.${domain}" {Peer} "${peer}" {Lock-Time} 0 {Condition} "Establish-Failure" {Action} "exec:unset ${host}" {Check-For} "" ${def}
Antworten