oriolrius.cat

Des del 2000 compartiendo sobre…

Category: Networking and Internet

Resize Squashfs/Ext4 partition of OpenWRT in a Raspberry PI

Reading time: < 1 minute

Quick cookbook for just doing what the subject of the post says:

opkg update
opkg install cfdisk
cfdisk
# change partition size using the UI
opkg install losetup resize2fs
BOOT="$(sed -n -e "/\s\/boot\s.*$/{s///p;q}" /etc/mtab)"
DISK="${BOOT%%[0-9]*}"
PART="$((${BOOT##*[^0-9]}+1))"
ROOT="${DISK}0p${PART}"
LOOP="$(losetup -f)"
losetup ${LOOP} ${ROOT}
fsck.ext4 -y ${LOOP}
resize2fs ${LOOP}
reboot

TEDxAlcoi 2022, una experiencia de crecimiento

Reading time: 9 – 14 minutes

Los que ya hace tiempo que me conocéis sabéis que estoy en las fechas de las efemérides. Entre abril y mayo acumulo muchas emociones que me mueven de arriba abajo. Cada mes de abril empiezo por la fecha en que perdí a mi padre. Seguidamente, el nacimiento de Pol y su posterior despedida después de 3 días, coincidiendo con el aniversario de boda. Después viene mi renacimiento, del que este año se han celebrado los 19 años. Y tal día como hoy es mi cumpleaños. Hoy cumplo 45 años.

Pero este año añado a la lista de efemérides, una que no sé si voy a contar anualmente, pero que seguro que ha servido para hacer un gran paso de gigante en mi crecimiento personal. Los tres días superintensos que he pasado con mis compañeros de la TEDxAlcoi. Todo un reto de crecimiento que tendréis la oportunidad de valorar el resultado cuando se publique el video. De momento me limitaré a contar por qué fue una experiencia tan enriquecedora.

Pasé casi todo el miércoles repitiendo y escenificando el texto de mi charla. Llegó el momento de los ensayos del jueves por la tarde en el escenario real. El ambiente estaba cargado de muchos nervios y mucha presión. El nivel de estos era inusualmente alto. Tengo que remontarme a cuando tenía 20 años y tenía presentaciones en aforos de altos ejecutivos para recordar tantos nervios.

Cada vez que intentaba fluir encima del escenario me notaba más bloqueado y menos inspirado. Dicho de otra forma, fui incapaz de decir el texto sin equivocarme y bloquearme varias veces. Fue un golpe muy duro ver que no era capaz de escenificar eso que había repetido más de un centenar de veces.

Unos momentos muy duros para mí, tuve que aislarme de los ensayos un buen rato para poder empezar mis ejercicios de meditación y que estos me permitieran volver a conectar conmigo y recuperar mi confianza. Me sentía como un farsante encima del escenario. Después de saberme el texto a la perfección y escenificarlo de forma magistral delante de mi mujer, pensaba que ya lo tenía controlado.

Pero la realidad era muy distinta, ese gran teatro Calderón de Alcoi lleno de voluntarios y profesionales trabajando a contra-reloj para tenerlo todo listo me imponía tanto que me sentía como un principiante. Por suerte, David, el gran maestro de ceremonias, me dio la oportunidad de repetir mis ensayos a última hora. Esa oportunidad fue clave para empezar a fluir y a sentir que podía hacerlo. El nivel estaba muy lejos de donde yo sabía que puedo llegar, pero al menos era algo presentable delante de la audiencia.

Llegó el viernes después de una noche dura, había dormido como un bebé hasta las 4 de la mañana, pero desde que algo me había despertado ya no pude pegar ojo. Suerte que pude dedicar ese tiempo a meditar y visualizar en mi interior como iría el evento. Decidí no desayunar para poder seguir fluyendo en mi preparación del gran momento. Además, tuve la suerte de poder hablar con Estefanía y los niños. Las 9 de la mañana aparecieron en el reloj de forma implacable y el evento empezó puntual en una sala llena de jóvenes de diferentes institutos y de la universidad de Alcoi.

Yo era el tercero en subir al escenario, honestamente había tenido mucha suerte. Solo tenía que esperar una hora antes de poder compartir mi idea inspiradora con la audiencia. Decidí olvidarme de ese tema hasta que tocara levantarme de la silla; lo mejor que podía hacer era abrirme al evento y disfrutar todo lo que estaba pasando a mi alrededor. La inspiradora puesta en escena de Hugo y las sabias palabras de Aitziber; dejaron que mi reloj volara. Cuando me di cuenta David me estaba presentando y yo me dirigía al punto rojo. Ese momento que llevaba soñando durante los últimos 4 años de mi vida.

Empecé nervioso y tenso, pero convencido de que no me iba a equivocar ni tampoco me quedaría en blanco. Y así fue. No hice la mejor interpretación de mi vida, pero me había quedado muy bien. Durante un buen rato estaba convencido de que había dicho el texto perfectamente, hasta que me hicieron notar que había cambiado una palabra al inicio del texto. Un cambio sutil, pero cargado de semántica: no son muchas competencias laborales, sino muchas competencias digitales lo que necesitan los jóvenes. Es alucinante como la mente puede confundir dos palabras sin darse ni cuenta.

Lo bueno de estas cosas es que el público ni se da cuenta. Ya que la idea queda igualmente bien explicada. Que al final es de lo que se trata. Al igual que hay que destacar este pequeño desliz quiero mencionar que tuve al menos un momento magistral. Porque una parte del texto habla de OnlyFans, una red social que los jóvenes asocian con temas eróticos y sexuales. Así pues, al mencionar esta red los chicos empezaron a gritar y a decir tonterías. Pues bien, fui capaz de reconducir la atención y seguir de una forma que hasta a mí me sorprendió positivamente.

Las palabras se quedan cortas para describir las sensaciones que uno siente después de haber acumulado tanta tensión, tantos nervios y tantas ganas de hacerlo bien. El momento había pasado y lo había hecho bien, yo diría más, lo había hecho muy bien. Todo se puede mejorar, pero podía estar orgulloso del resultado obtenido y eso me llenaba por dentro. Además, el “show” seguía vivo y mis compañeros seguían evolucionando con sus charlas, cosa que me permitía revivir una y otra vez esas grandes sensaciones. Unas sensaciones que ponente tras ponente acababan con el público en pie aplaudiendo y gritando.

Sábado tarde, el gran momento de TEDxAlcoi. Llegaba al evento en unas condiciones muy diferentes al día anterior. Había podido dormir mejor, descansar y hasta estirar las piernas. Los lazos con mis compañeros nos había convertido en amigos. La tensión no tenía nada que ver con la del día anterior. Lejos de estar relajados, pero con un nivel de seguridad en uno mismo muy superior al día anterior. Creo que ese relax, en general, nos hizo cometer algunos errores más que en el día anterior.

En mi caso, creo que lo hice muy y muy bien encima del punto rojo. Interpreté el texto de una forma excelente. Siempre con puntos de mejora, pero con un resultado mejor que en los días anteriores. Era muy curioso la sensación de ver el texto en mi cabeza, la memoria visual me mostraba las páginas del texto y cada una de las líneas que yo iba convirtiendo en una historia encima del escenario. Pero nada es perfecto y muy pocas líneas antes de llegar al final visualicé dos líneas que era incapaz de leer. No había manera de ver qué ponía en ellas y tenía que cerrar la charla. Así pues, me tocó saltarme un par de líneas. Toda una lástima por qué ambas eran una provocación para el público, la suerte es que no añadían contenido a la idea más allá de buscar tocar la fibra.

Con este sabor agridulce acabé mi puesta en escena. El público se levantó y aplaudió con fuerza. La adrenalina se convirtió en oxitocina; dicho de otra forma como esa tensión por hacerlo bien se convertía en la recompensa del trabajo bien hecho. Y así finalizaba esta experiencia que me había ocupado durante tanto tiempo. En mi lista de tareas, proyectos, iniciativas, objetivos y sueños desaparecía una palabra que me había acompañado como un ítem fijo. El símbolo de check se dibujaba y liberaba el espacio para dejar sitio a un nuevo sueño que cumplir.

Lo había hecho, se había cumplido, lo había conseguido. Estaba contento y me costaba creer que todo había acabado. Pero mi naturaleza perfeccionista me recordaba esa espinita clavada por no haber conseguido hacerlo tan bien como sé que puedo hacerlo. Por suerte, ya son 45 años compartiendo el día a día con mi voz interior. Y ahora he aprendido a perdonarme, a aceptarme y a disfrutar de los buenos momentos haciendo callar a esa voz.

Ese ha sido mi viaje durante estos últimos días. Me he esforzado, he trabajado, he llorado, he sufrido, he reído, he crecido y sobre todo he sido un poco más humano al lado de unas personas increíbles. Muchas gracias a la organización, voluntarios, a los otros oradores y al público. Sin vosotros no hubiera sido posible. Pero sobre todo gracias a mi mujer por tener esa paciencia infinita aguantándome y a mis hijos por inspirarme.

Resumiendo, la TEDx me ha permitido poner por encima de mí una gran idea que vale la pena compartir. Los oradores, organizadores y voluntarios estamos al servicio de una causa mayor que nosotros mismos. Se trata de hacer atractivas ideas potentes para tocar el público. Al final todos trabajamos para ser el cambio que queremos ver en el mundo. Y con ello nos llevamos nuestro propio crecimiento, nuestra propia maduración.

Network traffic sniffing: tcpdump on Linux + Wireshark on Windows

Reading time: 2 – 2 minutes

From the Windows box using the CLI console (cmd):

ssh USER@HOST "tcpdump -s 0 -U -n -w - -i NETIF FILTER" | "c:\Program Files\Wireshark\Wireshark.exe" -k -i -

# USER - remote user of the linux box
# HOST - host address of the remote linux box
# NETIF - network interface to snif in the remote linux box
# FILTER - (optional) rules for filtering traffic to capture

Use case:

C:\Windows\System32\OpenSSH>ssh root@192.168.4.74 "tcpdump -s 0 -U -n -w - -i eno2 udp and not port 53" | "c:\Program Files\Wireshark\Wireshark.exe" -k -i -

Let me present a rare use case of this useful trick. I use a QNAP NAS as a gateway in my home network, where I have 5 NICs. So it’s really useful to snif traffic remotly but I have no tcpdump packet in the system. What I did is use tcpdump as Docker container and finally the commands is like that.

# sniffing SIP traffic (port 5060) on interface eth0
# remote linux host (QNAP NAS) use SSH port 55222
# docker container is created and when work is done is removed
C:\Windows\System32\OpenSSH>ssh -p 55222 admin@10.2.0.1 "cd /share/Container/tcpdump && docker run --rm --net=host corfr/tcpdump -s 0 -U -n -w - -i eth0 not port 22 and port 5060" | "c:\Program Files\Wireshark\Wireshark.exe" -k -i -

Windows 10: Internal Virtual Switch with NAT

Reading time: 2 – 4 minutes

When you are playing with Windows Hyper-V and you want to create a completely virtual internal network with private virtual machines inside your Windows 10 machine virtual switch are mandatory.

Then it’s the time to connect that virtual switch with the host machine using a virtual network interface. All those steps can be done using Hyper-V manager user interface, but you cannot control 100% of parameters like enable, or not, the NAT of the virtual internal network.

Using PowerShell the steps are:

New-VMSwitch -SwitchName NATSwitch -SwitchType Internal
New-NetIPAddress -IPAddress 10.46.1.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNAT -Name NATNetwork -InternalIPInterfaceAddressPrefix 10.46.1.0/24

Of course, change “NATSwitch” for your switch name and “10.46.1.1” for the IP address of the host virtual network card. Finally “NATNetwork” is another arbitrary name for referring to the NAT rule, and “10.46.1.0/24” is the network address of the virtual internal host network.

Running the commands looks like:

For removing what you did:

Remove-VMSwitch -Name "NATSwitch"
Remove-NetIPAddress -InterfaceAlias "vEthernet (NATSwitch)"
Remove-NetNAT -Name NATNetwork

In Windows 10 IP forwarding is not enabled and packets between interfaces are not routed. According to the Microsoft forums, you can enable IP forwarding (routing) using the following steps:

Go to Start and search on cmd or command. Right click on either cmd or command then select Run as administrator. At the command prompt type regedit. Navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\Tcpip\Parameters\IPEnableRouter setting, right click and select Modify. Change 0 to 1 and exit the editor.

When your back at the command prompt type services.msc and navigate to the Routing and Remote Access service. Right click and select Properties. Change to Automatic and click on Start to start the service.

I had to research a long time until I found all this information, but in my case leverage my proofs of concepts to another level.

rp_filter Linux kernel feature

Reading time: 1 – 2 minutes

It’s just an IP spoofing protection which is by default enabled on Linux kernels. When it’s value is ‘1’ means that all IP address which are not directly routable and received form a network interface they are directly discarded.

So, if you want to scan a range of IP address in your LAN which not belong to that interface address space when packets from IP addresses are received they are going to be discarded by the kernel. So, take that into account when you have those “unusual” requirements.

It can be enable/disabled by all interfaces or just one:

root@mini9:/proc/sys/net/ipv4# cat ./conf/all/rp_filter
1
root@mini9:/proc/sys/net/ipv4# cat ./conf/ztly5q4n37/rp_filter
1

Zerotier peers monitored on Windows PowerShell

Reading time: < 1 minute

No words just a simple an powerful .ps1 script:

while (1) { Start-Process -NoNewWindow -FilePath 'C:\ProgramData\ZeroTier\One\zerotier-one_x64.exe' -ArgumentList "-q","peers"; sleep 5; cls }

Or just a command, even equally useful.

DRY DHCP Client: request and IP address to the DHCP server without a DHCP Client

Reading time: < 1 minute

When you want to discover LAN metadata without being part of that network. So, when you want to discover network address range, gateway, DNS IPs, DHCP server IPs, etc. this simple nmap parameter will help you so much.

# nmap --script broadcast-dhcp-discover

Starting Nmap 7.60 ( https://nmap.org ) at 2021-05-19 15:07 CEST
Pre-scan script results:
| broadcast-dhcp-discover:
|   Response 1 of 1:
|     IP Offered: 192.168.1.127
|     DHCP Message Type: DHCPOFFER
|     Subnet Mask: 255.255.255.0
|     Renewal Time Value: 4d00h00m00s
|     Rebinding Time Value: 7d00h00m00s
|     IP Address Lease Time: 8d00h00m00s
|     Server Identifier: 192.168.1.1
|     Router: 192.168.1.1
|_    Domain Name Server: 8.8.8.8, 8.8.4.4
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 1.43 seconds

Alive: shell script for alive monitoring using PING

Reading time: < 1 minute

Simple shell script based on bash which monitor a host with command line ping. Just bash and ping are the unique dependencies. Only state change are going to be printed:

#!/bin/bash

IP="THE_IP_TO_MONITOR"
STATE="offline"

show_state()
{
  echo "$(date '+%Y-%m-%dT%H:%M:%S') - " + $STATE;
}

while true;
do
  ping -c 4 $IP > /dev/null 2>&1
  if [ "$?" = "0" ]; then
    if [ "$STATE" = "offline" ];
    then
      STATE="online"
      show_state
    fi
  else
    if [ "$STATE" = "online" ];
    then
      STATE="offline"
      show_state
    fi
  fi
  sleep 10
done

RDP vs Team Viewer vs Anydesk

Reading time: 4 – 6 minutes

Lately I bought a Surface Go for working specially as an agenda and for working outside home when I don’t have to work on technical stuff. At some point I considered the idea of working on that device remotely when I’m working with my desktop environment because it could be more comfortable specially because I have a bigger screen and keyboard for interacting with the content that I have on the tablet.

The first thing that I tried to do was enabling Remote Desktop Protocol on my Surface Go. But it was officially impossible because it has Windows 10 Home and the “Home” version doesn’t have this feature. BTW when you are not comfortable with this the best is googling little for finding any hack which allow me to enable the service. And yes, it exists and works really well.

You can find the project which hacks that in Windows 10 Home GitHub it’s called “rdpwrap” and if you want to know more about that go to next links:

After so much effort for getting RDP working on Windows 10 I discovered that RDP doesn’t work like Team Viewer, so you’re not going to control remote desktop while you can view what is happening in that remote session. This is not mandatory for me but in some cases it’s really useful. After some weeks I had to install Team Viewer for getting that feature working and I rediscovered that tool after some years without using it, and I was pleased to discover how good it works and how it improved after some years.

Then something inside me triggered the idea to look it up for an alternative to Team Viewer without so many restrictions and with a better free version. After trying some alternatives to Team Viewer I have to recommend Anydesk as an excellent and simple to use tool. And the most important thing, you don’t have to install anything in your Linux, Mac or Windows computer for using it. The only thing that you have to do is run the executable and use the auto-generated code for connecting to the remote system. I felt very good for those features and currently this is the option which I use for giving some support to friends remotely and for connecting to my Surface Go desktop remotely from my desktop computer.

As you can see this is not an exahustive revision, or comparsion of feautrues of all those three tools. But at the end of the day most of them allow you to do the same things but with slightly different procedures. BTW, the killer feature for me is something that I’ve got from “join.me” in the past, I mean use a tool for remote desktop control without having to install anything in the server and neither in the client part. I didn’t talk about “join.me” because it eats all my resources when I run it, and they focused the tool as a meeting tool and this is not anything that I want. Those extra features killed IMHO the best things that tool had in the past.

TL;DR

The best option IMHO and for my use is Anydesk.

Enjoy it.