Mostrando entradas con la etiqueta redes. Mostrar todas las entradas
Mostrando entradas con la etiqueta redes. Mostrar todas las entradas

martes, junio 19, 2012

Curiosidades de IPv4 (a estas alturas)

El otro día, por error, tecleando una IP, me ocurrió ésto:
ping 192.168.1
PING 192.168.1 (192.168.0.1) 56(84) bytes of data.

Coincidió que estaba en una red 192.168.0.0/24, así que me quedé bocas 8-O
¿Cómo había averiguado que estaba en esa red? ¿Sería como en IPv6, que obvia los 0 intermedios? ¿Y cómo sabía que era el tercer octeto y no el segundo el que era 0? Bueno, no era 192.168..1, así que no funcionaba como IPv6.

Ayer, viendo un blog que me recomendó un colega (http://elladodelmal.com), me encontré con más curiosidades. He aquí mis pruebas:
root@sqa-test:~/virtual_files# ping 0
PING 0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.048 ms
^C
--- 0 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms

root@sqa-test:~/virtual_files# ping 10.230.770
PING 10.230.770 (10.230.3.2) 56(84) bytes of data.
64 bytes from 10.230.3.2: icmp_req=1 ttl=128 time=1.08 ms
^C
--- 10.230.770 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.083/1.083/1.083/0.000 ms

Dicen que ésto viene de inet_aton():
http://linux.die.net/man/3/inet_aton
a.b.c.d

Each of the four numeric parts specifies a byte of the address; the bytes are assigned in left-to-right order to produce the binary address.

a.b.c

Parts a and b specify the first two bytes of the binary address. Part c is interpreted as a 16-bit value that defines the rightmost two bytes of the binary address. This notation is suitable for specifying (outmoded) Class B network addresses.

a.b

Part a specifies the first byte of the binary address. Part b is interpreted as a 24-bit value that defines the rightmost three bytes of the binary address. This notation is suitable for specifying (outmoded) Class C network addresses.

a

The value a is interpreted as a 32-bit value that is stored directly into the binary address without any byte rearrangement.

El pequeño Pepito Grillo me dice que no pruebe, pero ¿servirá para saltarse filtros y firewalls? ;)