
Esta recetilla incluye algunos comandos sencillos para comprender y empezar a manejar el famoso pero desconocido comando
ip.
ip dispone de ayuda “contextual”, es decir, dispone de ayuda específica para el comando que utilices. La forma más básica es simplemente ejecutarlo sin argumentos.
$ ip Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] [-batch filename where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | maddr | mroute | monitor | xfrm } OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] | -t[imestamp] }
Cada OBJECT tiene su formato y también su propia “ayuda” escribiendo help al final. Por ejemplo, para el objeto addr:
$ ip addr help Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ] [ CONFFLAG-LIST] ip addr del IFADDR dev STRING ip addr {show|flush} [ dev STRING ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ scope SCOPE-ID ] SCOPE-ID := [ host | link | global | NUMBER ] FLAG-LIST := [ FLAG-LIST ] FLAG FLAG := [ permanent | dynamic | secondary | primary | tentative | deprecated | CONFFLAG-LIST ] CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG CONFFLAG := [ home | nodad ] LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ] LFT := forever | SECONDS
Con este comando consigues (entre otras cosas) las direcciones lógicas y físicas de todos los interfaces conectados:
$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:50:40:d6:09:af brd ff:ff:ff:ff:ff:ff 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:e0:4c:9a:60:00 brd ff:ff:ff:ff:ff:ff inet 161.67.38.135/24 brd 161.67.38.255 scope global eth0 inet6 fe80::2e0:4cff:fe00:4567/64 scope link valid_lft forever preferred_lft forever
Para una interfaz concreta:
$ ip addr show dev eth0 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:e0:4c:9a:60:00 brd ff:ff:ff:ff:ff:ff inet 161.67.38.135/24 brd 161.67.38.255 scope global eth0 inet6 fe80::2e0:4cff:fe00:4567/64 scope link valid_lft forever preferred_lft forever
$ ip addr add 192.168.0.1 dev eht0
$ ip addr del 192.168.0.1 dev eht0
$ ip route
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.23
default via 192.168.0.1 dev eth0
Iré añadiendo más cosillas con el tiempo…
Comentarios recientes
hace 3 horas 1 min
hace 3 horas 6 mins
hace 3 horas 6 mins
hace 4 horas 48 mins
hace 5 horas 22 mins
hace 6 horas 36 mins
hace 16 horas 34 mins
hace 1 día 4 horas
hace 1 día 8 horas
hace 2 días 6 horas