Greetings, Dear cyber-readers.
After a long pause we continued with the fourth (4th) post full series of 10 dedicated to Study of GNU / Linux Distros Packages, based on the DISTRO DEBIAN. Let us remember that thoroughly handling (knowing) the packages and their commands are of utmost importance for any user / technician of Free Operating Systems usually. And as in the previous one we will continue with those packages and commands related to Network Interface Management.
Additionally use for any questions or information in this regard the following links:
- DEBIAN Official Website
- Official DEBIAN packages
- System package tracking Debian
- DEBIAN Official Wiki
- DEBIAN official documentation
- Among other unofficial ones such as: Linux man pages online
And if you want to read the previous entries in this series, they are:
- DEBIAN Package Study - Part I (Packages, Repositories and Package Managers.)
- DEBIAN Package Study - Part II (Network Interface Management)
- DEBIAN Package Study - Part III (Network Interface Management)
In this post we will study more in depth about the package iproute2 and using the command ip
Package:
Note: Currently its dependencies are libc6 (> = 2.14) [not arm64, ppc64el] - libc6 (> = 2.17) [arm64, ppc64el], libdb5.3, and libselinux1. And in its version for DEBIAN Testing it is currently in the number 4.3.0-1. For more information consult Package: iproute 2
Note: Some of the main functionalities that iproute2 provides are: Implement QoS (Quality of service), to prioritize the different types of traffic; Keep multiple routing tables by different gateways connected to different devices; establish the Load balancing, assigning weights to each of the existing network interfaces within a device and the Definition of tunnels IP to provide a means to transport data packets between domains when the protocol in those domains is not supported by intermediary networks, that is, for example to transport IPv6 packets in IPv4 networks and to allow IPv6 communication between 2 two distant IPv6 networks. For more information consult Linux Foundation: iproute2
Commands:
-
IP: And expanding the information of the previous publication we have about the command IP the following usage examples:
-
Mostrar todas las Interfaces
-
ip address show
-
Mostrar una sola Interfase
-
ip address show [nombre_interfaz]
-
Mostrar solo las Interfaces levantadas
-
ip address show up
-
Mostrar las interfaces dinámicas o estáticas
-
ip address show dev [nombre_interfaz]
-
ip address show dev [nombre_interfaz]
-
Añadir una dirección IP a una Interfaz
-
ip address add 192.168.1.100/24 dev [nombre_interfaz]
-
ip address add 2001:db8:1::/48 dev [nombre_interfaz]
-
Borrar una dirección IP a una Interfaz
-
ip address delete 192.168.1.100/24 dev [nombre_interfaz]
-
ip address delete 2001:db8:1::/48 dev [nombre_interfaz]
-
Añadir una descripción legible a una Interfaz / Dirección IP
-
ip address add 192.168.1.100/24 dev [nombre_interfaz] label [nombre_interface]:Mi_Red_Interna
-
Remover (Liberar) las direcciones ip de una Interfaz de red
-
ip address flush dev [nombre_interfaz]
-
Mostrar todas las rutas de red disponible
-
ip route
-
ip route show
-
ip -4 route show
-
ip -6 route show
-
Mostrar las rutas de una red y sus sub-redes incluidas
-
ip route show to root direccion_red/prefijo_mascara_red
-
Mostrar las rutas hacia una red especifica
-
ip route show to exact direccion_red/prefijo_mascara_red
-
Mostrar la ruta actual usada por el kernel
-
ip route get direccion_red/prefijo_mascara_red
-
Añadir una ruta via gateway
-
ip route add direccion_red/prefijo_mascara_red via direccion_ip_gateway
-
Añadir una ruta via interfaz
-
ip route add direccion_red/prefijo_mascara_red dev nombre_interfaz
-
Cambiar o reemplazar una ruta
-
ip route change direccion_red/prefijo_mascara_red via direccion_ip_gateway
-
ip route replace direccion_red/prefijo_mascara_red dev nombre_interfaz
-
Borrar una ruta
-
ip route delete direccion_red/prefijo_mascara_red via direccion_ip_gateway
-
ip route delete direccion_red/prefijo_mascara_red dev nombre_interfaz
-
Establecer una ruta por defecto
-
ip route add default via direccion_red/prefijo_mascara_red
-
ip route add default via dev nombre_interfaz
-
ip route add 0.0.0.0/0 via direccion_red/prefijo_mascara_red
-
ip route add 0.0.0.0/0 via dev nombre_interfaz
-
Establecer rutas de propósitos especificos
-
ip route add blackhole direccion_red/prefijo_mascara_red
-
ip route add unreacheable direccion_red/prefijo_mascara_red
-
ip route add prohibit direccion_red/prefijo_mascara_red
-
ip route add throw direccion_red/prefijo_mascara_red
-
Establecer una ruta con una métrica especifica
-
ip route add direccion_red/prefijo_mascara_red via direccion_ip_gateway metric numero_metrica
-
ip route add direccion_red/prefijo_mascara_red dev nombre_interfaz metric numero_metrica
-
Establecer una ruta multivia
-
ip route add default nexthop via direccion_ip_gateway_1 weight numero_weight nexthop via direccion_ip_gateway_2 weight numero_weightip
-
ip route add default nexthop via direccion_ip_gateway_1 weight numero_weight nexthop dev nombre_interfaz metric numero_metrica
-
Mostrar/Listar interfaces
ip link show
-
ip link show dev nombre_interfaz
-
ip link list
-
ip link list dev nombre_interfaz
-
Configurando el estado de una interfaz
-
ip link set dev nombre_interfaz up
-
ip link set dev nombre_interfaz down
-
ip link list
-
ip link list dev nombre_interfaz
-
Configurando una descripción para una interfaz
-
ip link set dev nombre_interfaz alias "descripcion"
-
Configurando un nuevo nombre a una interfaz
-
ip link set dev actual_nombre_interfaz name nuevo_nombre_interfaz
-
Configurando una Dirección MAC a una interfaz
-
ip link set dev nombre_interfaz address aa:bb:cc:dd:ee:ff
-
Cambiando el valor de MTU de una interfaz
-
ip link set dev nombre_interfaz mtu valor_mtu
-
Eliminando una interfaz
-
ip link delete dev nombre_interfaz
-
Habilitar / Deshabilitar el Multicast / ARP en una interfaz
-
ip link set nombre_interfaz multicast on
-
ip link set nombre_interfaz multicast off
-
ip link set nombre_interfaz arp on
-
ip link set nombre_interfaz arp off
-
Creando una interfaz del tipo VLAN
-
ip link add name nombre_interfaz_vlan link nombre_interfaz type vlan id valor_id
-
Creando una interfaz del tipo VLAN Stacking (QinQ) en Interfaz de Servidor y de Cliente
-
ip link add name nombre_interfaz_vlan link nombre_interfaz type vlan proto 802.1ad id valor_id
-
ip link add name nombre_interfaz_vlan link nombre_interfaz type vlan proto 802.1q id valor_id
-
Gestionando tipos de interfaces
-
ip link add name nombre_tipo_interfaz link nombre_interfaz type macvlan
-
ip link add name nombre_tipo_interfaz type dummy
-
ip link add name nombre_tipo_interfaz type bond
-
ip link add name nombre_tipo_interfaz type ifb
-
ip link add name nombre1 type veth peer nombre2
-
Gestionando puentes sobre una interfaz
-
ip link add name nombre_puente type brigde
-
ip link set dev nombre_interfaz master nombre_puente
-
ip link set dev nombre_interfaz no master
-
ip link set nombre_interfaz arp off
-
Gestionando grupos de interfaces
-
ip link set dev nombre_interface group id_group
-
ip link set dev nombre_interfaz group 0
-
ip link set dev nombre_interfaz group default
-
ip link set dev nombre_interface group nombre_group
-
ip link set group id_group up/down
-
ip link list group id_group
-
ip address show group nombre_grupo
For more information about this command read here
In the next post we will study about the use of the commands ct, iw y ethtool.