Giter Club home page Giter Club logo

logipv6routeros's Introduction

IPv6+IPv4 - PPPoE/DHCPv6 PD - Mikrotik/RouterOS

Tutorial de instalação

https://blog.remontti.com.br/3931

On UP

{
  :global TOKEN "xxxxxxxxxxxxxxxx";
  :global URLUP "http://________________/log6.php";
  :global checkconnection "200.200.200.200";
  :local ii 0;
  :local tt 300; # Aguarda até 5min para tentar 
  while ( $ii < $tt && ([/ping $checkconnection count=1]=0) ) do={
    :put $ii
    :set $ii ($ii + 1)
    :delay delay-time=1s
    :log error "Awaiting connection ... $checkconnection";
  }
  :local localAddr $"local-address"
  :local remoteAddr $"remote-address"
  :local callerId $"caller-id"
  :local calledId $"called-id"
  :local interfaceName [/interface get $interface name]
  :local RemoteIPv6 [/ipv6 nd prefix get value-name=prefix [find interface=$interfaceName]]
  :local i 0;
  :local x 1;  
  :local t 60; # Segundos aguardando ipv6 ser configurado no cliente
  while ($i < $t && [ :len [/ipv6 dhcp-server binding find server=$interfaceName] ] < $x) do={
    :put $i
    :set $i ($i + 1)
    :delay delay-time=1s
  }
  if ($i = $t) do={
    :log warning message="UP: $user | $callerId | $calledId | $remoteAddr | $localAddr | $RemoteIPv6 | NULL"
    /tool fetch url="$URLUP" http-data="action=i&token=$TOKEN&user=$user&mac=$callerId&nas=$localAddr&service=$calledId&ipv4=$remoteAddr&remoteipv6=$RemoteIPv6" http-method=post
  } else={
    :local DHCPv6PD [/ipv6 dhcp-server binding get value-name=address [find server=$interfaceName]]
    :log warning message="UP: $user | $callerId | $calledId | $remoteAddr | $localAddr | $RemoteIPv6 | $DHCPv6PD"
    /tool fetch url="$URLUP" http-data="action=i&token=$TOKEN&user=$user&mac=$callerId&nas=$localAddr&service=$calledId&ipv4=$remoteAddr&remoteipv6=$RemoteIPv6&dhcpv6pd=$DHCPv6PD" http-method=post
  }
  file remove log6.php
}

On Down

{
  :global TOKEN "xxxxxxxxxxxxxxxx"
  :global URLDOWN "http://________________/log6.php"
  :local localAddr $"local-address"
  :local callerId $"caller-id"
  /tool fetch url="$URLDOWN" http-data="action=u&token=$TOKEN&user=$user&mac=$callerId&nas=$localAddr" http-method=post
  :log error message="DOWN: $user | $callerId | $localAddr"
  file remove log6.php
}

logipv6routeros's People

Contributors

remontti avatar mazuco avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.