Unifi

Aus Freifunk Franken
Wechseln zu:Navigation, Suche

Mit diesem Code können ganz schnell viele APs in einen Controller angelegt werden. Einfach die ersten 2 Zeilen anpassen und im gleichen Subnetz ausführen wo die laufenden APs hängen. Danach nur noch im Controller adopt klicken code type="php" <?php //Hier das Interface und die Controllerurl eingeben $interface="eno2"; $controllerurl="http://x/inform";

//Ab hier nichts mehr editieren! exec('ping6 ff02::1%'.$interface.' -c 2', $out); $i=0; while (count($out) > $i) {

       echo "
"; $start = strpos($out[$i],"fe80"); $ende = strpos($out[$i],$interface)-$start; $ip = substr($out[$i],$start,$ende); $host = $ip.$interface; echo $host; $password="ubnt"; $port=22; $user="ubnt"; $sshCommand="mca-cli-op set-inform $controllerurl"; $command = 'sshpass -p "' . $password . '" ssh -p '.$port.' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ' . $user. '@'. $host. ' "' . $sshCommand.'" '; echo "
"; echo $command; $result = exec($command, $out2); echo "
"; var_dump($out2); $out2=""; $command=""; $i++;

} ?> /code