Différences entre versions de « Iproute2 »
Aller à la navigation
Aller à la recherche
(Page créée avec « = Introduction = Iproute2 est un ensemble d'utilitaires utilisés pour contrôler le trafic TCP, UDP et IP dans Linux et a été conçu pour remplacer la suite entière de... ») |
|||
| Ligne 33 : | Ligne 33 : | ||
||ip maddr | ||ip maddr | ||
|} | |} | ||
| − | = Configuration d'adresse | + | = Configuration d'adresses = |
| + | {|class="wikitable" width="85%" | ||
| + | ! Description !! Commande ''iproute2'' (full) !! Commande ''iproute2'' (short) | ||
| + | |- | ||
| + | ||Listing des interfaces | ||
| + | || | ||
| + | <pre> | ||
| + | # ip address | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip a | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Listing d'une interfaces | ||
| + | || | ||
| + | <pre> | ||
| + | # ip address show dev eth0 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip a s eth0 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Ajout / Suppression d'une adresse IP | ||
| + | || | ||
| + | <pre> | ||
| + | # ip address [ add | del ] dev eth0 192.168.1.20/24 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip a [ a | d ] dev eth0 192.168.1.20/24 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Suppression de toutes les configurations | ||
| + | || | ||
| + | <pre> | ||
| + | # ip address flush dev eth0 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip a f dev eth0 | ||
| + | </pre> | ||
| + | |} | ||
| + | =Configuration de lien= | ||
| + | == Les basiques == | ||
| + | {|class="wikitable" width="85%" | ||
| + | ! Description !! Commande ''iproute2'' (full) !! Commande ''iproute2'' (short) | ||
| + | |- | ||
| + | ||Affichage des liens | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link show | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l sh | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Activation / Désactivation d'une interface | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set eth0 [ up | down ] | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s eth0 [ up | down ] | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Mettre un alias | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 alias "LAN" | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 al "LAN" | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Renommer une interface (l'interface doit être ''down'') | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 name lan | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 name lan | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Changer l'adresse MAC d'une interface | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 address 00:01:02:03:04:05 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 a 00:01:02:03:04:05 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Changer le MTU (Maximum Transmission Unit) pour des trames Jumbo | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 mtu 7000 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 mtu 7000 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Activer / Désactiver le multicast sur une interface | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set eth0 multicast [ on | off ] | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s eth0 multicast [ on | off ] | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Activer / Désactiver ARP sur une interface | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set eth0 arp [ on | off ] | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s eth0 arp [ on | off ] | ||
| + | </pre> | ||
| + | |} | ||
| + | == Les VLANs == | ||
| + | {|class="wikitable" width="85%" | ||
| + | ! Description !! Commande ''iproute2'' (full) !! Commande ''iproute2'' (short) | ||
| + | |- | ||
| + | ||Ajout d'un VLAN | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link add link eth0 name eth0.1 type vlan id 1 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l a l eth0 name eth0.1 t vlan id 1 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Suppression d'un VLAN | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link del eth0.1 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l d eth0.1 | ||
| + | </pre> | ||
| + | |} | ||
| + | == Les Bridges == | ||
| + | {|class="wikitable" width="85%" | ||
| + | ! Description !! Commande ''iproute2'' (full) !! Commande ''iproute2'' (short) | ||
| + | |- | ||
| + | ||Création d'un bridge | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link add name br0 type bridge | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l a n br0 type bridge | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Suppression d'un bridge | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link del br0 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l d br0 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Ajout d'une interface au bridge | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 master br0 | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 master br0 | ||
| + | </pre> | ||
| + | |- | ||
| + | ||Suppression d'une interface du bridge | ||
| + | || | ||
| + | <pre> | ||
| + | # ip link set dev eth0 nomaster | ||
| + | </pre> | ||
| + | || | ||
| + | <pre> | ||
| + | # ip l s dev eth0 nomaster | ||
| + | </pre> | ||
| + | |} | ||
= Tables de routage= | = Tables de routage= | ||
Version du 28 décembre 2017 à 20:07
Introduction
Iproute2 est un ensemble d'utilitaires utilisés pour contrôler le trafic TCP, UDP et IP dans Linux et a été conçu pour remplacer la suite entière des outils Unix appelé net-tools.
Correspondance
| Description | Outil net-tool | Commande iproute2 |
|---|---|---|
| Configuration d'adresse et lien | ifconfig | ip address, ip link |
| Tables de routage | route | ip route |
| Statistique | netstat | ss |
| Voisinage | arp | ip neighbour |
| Vlan | vconfig | ip link |
| Tunnels | iptunnel | ip tunnem |
| Multicast | ipmaddr | ip maddr |
Configuration d'adresses
| Description | Commande iproute2 (full) | Commande iproute2 (short) |
|---|---|---|
| Listing des interfaces |
# ip address |
# ip a |
| Listing d'une interfaces |
# ip address show dev eth0 |
# ip a s eth0 |
| Ajout / Suppression d'une adresse IP |
# ip address [ add | del ] dev eth0 192.168.1.20/24 |
# ip a [ a | d ] dev eth0 192.168.1.20/24 |
| Suppression de toutes les configurations |
# ip address flush dev eth0 |
# ip a f dev eth0 |
Configuration de lien
Les basiques
| Description | Commande iproute2 (full) | Commande iproute2 (short) |
|---|---|---|
| Affichage des liens |
# ip link show |
# ip l sh |
| Activation / Désactivation d'une interface |
# ip link set eth0 [ up | down ] |
# ip l s eth0 [ up | down ] |
| Mettre un alias |
# ip link set dev eth0 alias "LAN" |
# ip l s dev eth0 al "LAN" |
| Renommer une interface (l'interface doit être down) |
# ip link set dev eth0 name lan |
# ip l s dev eth0 name lan |
| Changer l'adresse MAC d'une interface |
# ip link set dev eth0 address 00:01:02:03:04:05 |
# ip l s dev eth0 a 00:01:02:03:04:05 |
| Changer le MTU (Maximum Transmission Unit) pour des trames Jumbo |
# ip link set dev eth0 mtu 7000 |
# ip l s dev eth0 mtu 7000 |
| Activer / Désactiver le multicast sur une interface |
# ip link set eth0 multicast [ on | off ] |
# ip l s eth0 multicast [ on | off ] |
| Activer / Désactiver ARP sur une interface |
# ip link set eth0 arp [ on | off ] |
# ip l s eth0 arp [ on | off ] |
Les VLANs
| Description | Commande iproute2 (full) | Commande iproute2 (short) |
|---|---|---|
| Ajout d'un VLAN |
# ip link add link eth0 name eth0.1 type vlan id 1 |
# ip l a l eth0 name eth0.1 t vlan id 1 |
| Suppression d'un VLAN |
# ip link del eth0.1 |
# ip l d eth0.1 |
Les Bridges
| Description | Commande iproute2 (full) | Commande iproute2 (short) |
|---|---|---|
| Création d'un bridge |
# ip link add name br0 type bridge |
# ip l a n br0 type bridge |
| Suppression d'un bridge |
# ip link del br0 |
# ip l d br0 |
| Ajout d'une interface au bridge |
# ip link set dev eth0 master br0 |
# ip l s dev eth0 master br0 |
| Suppression d'une interface du bridge |
# ip link set dev eth0 nomaster |
# ip l s dev eth0 nomaster |