
Aca les dejo un tutorial de como configurarlo en un router con OPENWRT. Al final van a poder aprender el video
Link origina el ingles: https://bit.ly/2JopqEE
Instalacion
Si ya no esta instalado instale zerotier en tu router. Aqui te lo muestro
Instalacion via GUI/WEB LUCI : System -> Software luego click en Update lists para obtener los ultimos paquetes. Despues use el filtro y busque zerotier Solamente vera un solo paquete, luego haga click en INSTALL
Como seria via cli (Linea de Comandos)
Código: Seleccionar todo
root@openwrt:~# opkg update
root@OpenWrt:~# opkg install zerotier
Installing zerotier (1.2.12-2) to root...
Downloading ...
Installing libstdcpp (7.3.0-1) to root...
Downloading ...
Installing kmod-tun (4.14.95-1) to root...
Downloading ...
Installing libmnl (1.0.4-1) to root...
Downloading ...
Installing ip-tiny (4.16.0-8) to root...
Downloading ...
Installing libminiupnpc (2.0.20170509-1) to root...
Downloading ...
Installing libnatpmp (20150609-1) to root...
Downloading ...
Configuring kmod-tun.
Configuring libmnl.
Configuring libstdcpp.
Configuring ip-tiny.
Configuring libminiupnpc.
Configuring libnatpmp.
Configuring zerotier.
disabled in config
Vaya a https://my.zerotier.com y cree una red con las caracteristicas similares a esta:
Código: Seleccionar todo
ZeroTier Controller
-------------------
Network ID: 8ad5123ed69d6f69
IPv4 Auto-Assign (advanced)
[x] Auto-Assign from Range: 172.28.28.1-172.28.28.255
Managed Routes:
172.28.28.0/24 (LAN)
192.168.1.0/24 (172.28.28.1)
IPv6 Auto-Assign
[ ] ZeroTier RFC4193 (/128 for each device)
[ ] ZeroTier 6PLANE (/80 routable for each device)
[ ] Auto-Assign from Range
Loguearse via SSH - CLI y ejecutar el siguiente comand (es un comando show)
Código: Seleccionar todo
root@openwrt:~# uci show zerotier
zerotier.sample_config=zerotier
zerotier.sample_config.enabled='0'
zerotier.sample_config.join='8056c2e21c000001'
Código: Seleccionar todo
root@OpenWrt:~# cat /etc/config/zerotier
config zerotier sample_config
option enabled 0
# persistent configuration folder (for ZT controller mode)
#option config_path '/etc/zerotier'
#option port '9993'
# Generate secret on first start
option secret ''
# Join a public network called Earth
list join '8056c2e21c000001'
#list join '<other_network>'
Nuestra nueva red sera esta openwrt_network
Código: Seleccionar todo
root@OpenWrt:~# uci set zerotier.openwrt_network=zerotier
root@OpenWrt:~# uci add_list zerotier.openwrt_network.join='8ad5123ed69d6f69'
root@OpenWrt:~# uci set zerotier.openwrt_network.enabled='1'
root@OpenWrt:~# uci commit zerotier
Código: Seleccionar todo
root@openwrt:~# uci del_list zerotier.openwrt_network.join='<network id to remove from join list>'
Código: Seleccionar todo
root@openwrt:~# cat /etc/config/zerotier
config zerotier 'sample_config'
option enabled '0'
list join '8056c2e21c000001'
config zerotier 'openwrt_network'
list join '8ad5123ed69d6f69'
option enabled '1'
Despues del reboot tenemos que tirar el siguiente comando para ver que la interface que creamos con todos los comandos que hemos venido tirando este up arriba. Sintaxis de la misma seria algo asi ZTXXXXXXX
Código: Seleccionar todo
root@openwrt:~# ip a
... (several networks)
6: ztXXXXXXXX: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2800 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 6a:04:a7:8b:b8:6a brd ff:ff:ff:ff:ff:ff
inet6 fe80::6804:a7ff:fe8b:b86a/64 scope link
valid_lft forever preferred_lft forever
Código: Seleccionar todo
root@openwrt:~# zerotier-cli info
200 info 41c7017c10 ONLINE 1.1.14
Código: Seleccionar todo
root@OpenWrt:~# uci show zerotier
zerotier.sample_config=zerotier
zerotier.sample_config.enabled='0'
zerotier.sample_config.join='8056c2e21c000001'
zerotier.openwrt_network=zerotier
zerotier.openwrt_network.join='8ad5123ed69d6f69'
zerotier.openwrt_network.enabled='1'
zerotier.openwrt_network.secret='6b3a5d8678:0:...'
Ahora si se dirigue al manager de https://my.zerotier.com/ podra ver que existe una relacion entre su router y ZEROTIER. El atributo auth? no se olvide de marcarlo. Seria como un tipo de autorizacion a la relacion "router <-------> ZEROTIER"
El siguiente comando es para que usted vea la IP que le asigno a sus dispositivo, en este caso al router. Esta IP la asigno ZEROTIER
Código: Seleccionar todo
root@openwrt:~# ip a
... (several networks)
6: ztXXXXXXXX: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2800 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 6a:04:a7:8b:b8:6a brd ff:ff:ff:ff:ff:ff
inet 172.28.28.1/24 brd 172.28.28.255 scope global ztXXXXXXXX
valid_lft forever preferred_lft forever
inet6 fe80::6804:a7ff:fe8b:b86a/64 scope link
valid_lft forever preferred_lft forever
Via luci seria algo como lo que se explica
En OpenWrt 18.06 LuCI ir Network -> Firewall -> Traffic Rules y en Open ports on router configurar:
Código: Seleccionar todo
Name: Allow-ZeroTier-Inbound
Protocol: UPD
External port: 9993
Código: Seleccionar todo
Match:
Incoming IPv4 and IPv6, protocol UDP
From any zone
To this device, port 9993
Action:
Accept input
USANDO LINEA DE COMANDO
Código: Seleccionar todo
root@OpenWrt:~# uci add firewall rule
root@OpenWrt:~# uci set firewall.@rule[-1].name='Allow-ZeroTier-Inbound'
root@OpenWrt:~# uci set firewall.@rule[-1].src='*'
root@OpenWrt:~# uci set firewall.@rule[-1].target='ACCEPT'
root@OpenWrt:~# uci set firewall.@rule[-1].proto='udp'
root@OpenWrt:~# uci set firewall.@rule[-1].dest_port='9993'
root@OpenWrt:~# uci commit firewall
root@OpenWrt:~# /etc/init.d/firewall restart
Código: Seleccionar todo
config rule
option enabled '1'
option target 'ACCEPT'
option proto 'udp'
option dest_port '9993'
option name 'Allow-ZeroTier-Inbound'
option src '*'
Configurando enrutamiento dentro del router
Algo parecido a esto seria nuestra actual configuracion relacionada al enrutamiento
Código: Seleccionar todo
WAN-Interface of the OpenWRT router : a public IP on the internet
IP-Range of the LAN switch on the OpenWRT router : 192.168.1.0/24
IP-Address of the zt interface on the OpenWRT router : 172.28.28.1
ZeroTier network route on the OpenWRT router : 172.28.28.0/24 via zt
Código: Seleccionar todo
Name of the new interface : ZeroTier
Protocol of the new interface : Unmanaged
Create a bridge over multiple interfaces : [ ]
Cover the following interface : Ethernet Adapter: "ztXXXXXXXX"
Para ver la IP de la interface relacionada a Zerotier esta solamente se puede ver via cli ip a
Por ultimo debemos crear una zona. Ahi en el video explico bien para que sirve este paso
Luego ir a Network -> Firewall, click en Add to create a new zone con la siguiente informacion
Código: Seleccionar todo
Name: vpn
Input: accept
Output: accept
Forward: accept
Masquerading: [x]
MSS clamping: [ ]
Covered networks: [x] ZeroTier:
[ ] lan:
[ ] wan:
[ ] wan6:
Inter-Zone Forwarding
Allow forward to destination zones: [x] lan:
[x] wan: wan6:
Allow forward from source zones : [x] lan:
[ ] wan: wan6:
TEST
El test lo van a ver en el video que pongo a continuacion
Escenario de prueba

Video