tech:notes_diag_reseau
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_diag_reseau [2025/11/11 22:56] – Jean-Baptiste | tech:notes_diag_reseau [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes diag réseau | ||
| + | |||
| + | Commande **ip** https:// | ||
| + | |||
| + | Diag | ||
| + | |||
| + | ~~~bash | ||
| + | ifstat | ||
| + | ss -s | ||
| + | ss -peaonmi | ||
| + | # sar -n DEV | ||
| + | sar -n ALL | ||
| + | networkctl | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | networkctl list | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | ip -4 -o addr | ||
| + | ~~~ | ||
| + | |||
| + | Only up | ||
| + | ~~~ | ||
| + | $ ip link ls up | ||
| + | |||
| + | 1: lo: < | ||
| + | inet 127.0.0.1/8 scope host lo | ||
| + | | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | $ ip -0 addr | ||
| + | 1: lo: < | ||
| + | link/ | ||
| + | 2: eth0: < | ||
| + | link/ether 14: | ||
| + | 3: wlan0: < | ||
| + | link/ether 74: | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # cat / | ||
| + | 1000 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | # cat / | ||
| + | full | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Lister toutes les interfaces branchées | ||
| + | ~~~ | ||
| + | # grep 1 / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | ethtool eth0 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | Settings for eth0: | ||
| + | Supported ports: [ TP MII ] | ||
| + | Supported link modes: | ||
| + | 100baseT/ | ||
| + | 1000baseT/ | ||
| + | Supported pause frame use: No | ||
| + | Supports auto-negotiation: | ||
| + | Advertised link modes: | ||
| + | 100baseT/ | ||
| + | 1000baseT/ | ||
| + | Advertised pause frame use: Symmetric Receive-only | ||
| + | Advertised auto-negotiation: | ||
| + | Speed: 10Mb/s | ||
| + | Duplex: Half | ||
| + | Port: MII | ||
| + | PHYAD: 0 | ||
| + | Transceiver: | ||
| + | Auto-negotiation: | ||
| + | Supports Wake-on: pumbg | ||
| + | Wake-on: d | ||
| + | Current message level: 0x00000033 (51) | ||
| + | drv probe ifdown ifup | ||
| + | Link detected: no | ||
| + | ~~~ | ||
| + | |||
| + | Si pas de `ethtool`, essayer `mii-tool` | ||
| + | |||
| + | ~~~bash | ||
| + | # mii-tool eth0 | ||
| + | eth0: no link | ||
| + | ~~~ | ||
| + | |||
| + | On arrête le " | ||
| + | ~~~bash | ||
| + | service network-manager stop | ||
| + | ~~~ | ||
| + | |||
| + | Demande d'un bail DHCP (DHCP OFFER) | ||
| + | ~~~bash | ||
| + | dhclient eth0 | ||
| + | ~~~ | ||
| + | |||
| + | Parfois il faut faire un `dhclient -r` avant pour que ça fonctionne. | ||
| + | ~~~bash | ||
| + | dhclient -r eth0 | ||
| + | dhclient eth0 | ||
| + | ~~~ | ||
| + | |||
| + | Si rien ne se passe `Ctrl + c`. C'est qu'on ne parviens pas à avoir une réponse du serveur DHCP. | ||
| + | |||
| + | Statistic | ||
| + | ~~~bash | ||
| + | ip -s link show eth0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Changer l' | ||
| + | |||
| + | |||
| + | |||
| + | Effacement de l’ancienne adresse ipv4 | ||
| + | ~~~bash | ||
| + | ip -4 a del dev eth0 | ||
| + | ~~~ | ||
| + | |||
| + | Nous pouvons définir manuellement l' | ||
| + | ~~~bash | ||
| + | #ifconfig eth0 192.168.1.12 netmask 255.255.255.0 up | ||
| + | ip addr add 192.168.1.12/ | ||
| + | ip link set eth0 up | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Définir la route / passerelle par défaut | ||
| + | |||
| + | Voir la table de routage | ||
| + | ~~~bash | ||
| + | ip r | ||
| + | ip route show table all | ||
| + | #ip r show table all | egrep -v " | ||
| + | ~~~ | ||
| + | |||
| + | Ajouter une route | ||
| + | ~~~bash | ||
| + | ip route add default via 192.168.1.1 | ||
| + | ~~~ | ||
| + | |||
| + | Supprimer une passerelle par défaut | ||
| + | |||
| + | ~~~bash | ||
| + | ip route del 0.0.0.0/0 via 192.168.1.1 | ||
| + | ~~~ | ||
| + | |||
| + | Test / diag / debug du routage | ||
| + | ~~~bash | ||
| + | ip route get 8.8.8.8 | ||
| + | ~~~ | ||
| + | |||
| + | ### Traceroute | ||
| + | |||
| + | Voir : | ||
| + | * tracepath | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Voir aussi : https:// | ||
| + | |||
| + | Traceroute avec MTR | ||
| + | ~~~ | ||
| + | $ mtr -c 10 --udp 10.33.133.246 -P 88 -rn | ||
| + | Start: 2023-07-11T16: | ||
| + | HOST: websrv1 | ||
| + | 1.|-- 10.230.223.1 | ||
| + | 2.|-- 10.255.183.12 | ||
| + | 3.|-- 10.255.29.2 | ||
| + | 4.|-- 10.154.254.1 | ||
| + | 5.|-- 10.133.4.178 | ||
| + | 6.|-- 10.133.4.38 | ||
| + | 7.|-- ??? | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ### Connaître l' | ||
| + | |||
| + | Certains types d’agrégation de liens (bonding) utilise le changement d' | ||
| + | Il peut être utile de retrouver l'@MAC original de la carte. | ||
| + | |||
| + | ~~~ | ||
| + | # cat / | ||
| + | Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) | ||
| + | |||
| + | Bonding Mode: fault-tolerance (active-backup) | ||
| + | Primary Slave: None | ||
| + | Currently Active Slave: eno50 | ||
| + | MII Status: up | ||
| + | MII Polling Interval (ms): 100 | ||
| + | Up Delay (ms): 0 | ||
| + | Down Delay (ms): 0 | ||
| + | |||
| + | Slave Interface: eno49 | ||
| + | MII Status: down | ||
| + | Speed: Unknown | ||
| + | Duplex: Unknown | ||
| + | Link Failure Count: 0 | ||
| + | Permanent HW addr: 5c: | ||
| + | Slave queue ID: 0 | ||
| + | |||
| + | Slave Interface: eno50 | ||
| + | MII Status: up | ||
| + | Speed: 10000 Mbps | ||
| + | Duplex: full | ||
| + | Link Failure Count: 0 | ||
| + | Permanent HW addr: 5c: | ||
| + | Slave queue ID: 0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | # ethtool -P eno50 | ||
| + | Permanent address: 5c: | ||
| + | ~~~ | ||
| + | |||
| + | ou (si supporté) | ||
| + | |||
| + | ~~~ | ||
| + | # cat / | ||
| + | 5cb901d006d8 | ||
| + | ~~~ | ||
| + | |||
| + | Alors que l' | ||
| + | ~~~ | ||
| + | # cat / | ||
| + | 5c: | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # ip a show dev eno50 | ||
| + | 3: eno50: < | ||
| + | link/ether 5c: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Exemple conf Debian | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | source / | ||
| + | |||
| + | # The loopback network interface | ||
| + | auto lo | ||
| + | iface lo inet loopback | ||
| + | |||
| + | # The primary network interface | ||
| + | allow-hotplug eth0 | ||
| + | iface eth0 inet dhcp | ||
| + | |||
| + | auto eth1 | ||
| + | iface eth1 inet static | ||
| + | address 192.168.56.12 | ||
| + | netmask 255.255.255.0 | ||
| + | gateway 192.168.56.1 | ||
| + | | ||
| + | allow-hotplug eth2 | ||
| + | iface eth2 inet static | ||
| + | address 10.240.100.101 | ||
| + | netmask 255.255.255.0 | ||
| + | network 10.240.100.0 | ||
| + | broadcast 10.240.100.255 | ||
| + | gateway 10.240.100.250 | ||
| + | # dns-* options are implemented by the resolvconf package, if installed | ||
| + | dns-search localdomain | ||
| + | dns-nameservers 8.8.8.8 8.8.4.4 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | #systemctl restart networking | ||
| + | ifdown eth0 | ||
| + | ifup eth0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Exemple conf RedHat | ||
| + | |||
| + | Notes : | ||
| + | * A partir de RHEL9 **keyfile** remplace **ifcfg** | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | TYPE=Ethernet | ||
| + | BOOTPROTO=dhcp | ||
| + | # | ||
| + | #PEERDNS=no | ||
| + | IPV6INIT=no | ||
| + | IPV4_FAILURE_FATAL=no | ||
| + | NAME=eth0 | ||
| + | DEVICE=eth0 | ||
| + | ONBOOT=yes | ||
| + | NM_CONTROLLED=no | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | DEVICE=eth1 | ||
| + | BOOTPROTO=none | ||
| + | ONBOOT=yes | ||
| + | TYPE=Ethernet | ||
| + | IPV6INIT=no | ||
| + | HWADDR=00: | ||
| + | NETMASK=255.255.255.0 | ||
| + | IPADDR=192.168.10.101 | ||
| + | GATEWAY=192.168.10.1 | ||
| + | #MTU=1450 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | #systemctl restart network | ||
| + | ifdown eth0 | ||
| + | ifup eth0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Bonding | ||
| + | |||
| + | ~~~bash | ||
| + | ip a | grep bond0 | ||
| + | cat / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Suppression agrégation de liens | ||
| + | |||
| + | ~~~bash | ||
| + | ip link set dev bond0 down | ||
| + | ip link del dev bond0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Netplan | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # ifupdown has been replaced by netplan(5) on this system. | ||
| + | # / | ||
| + | # To re-enable ifupdown on this system, you can run: | ||
| + | # sudo apt install ifupdown | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~yaml | ||
| + | # This file describes the network interfaces available on your system | ||
| + | # For more information, | ||
| + | network: | ||
| + | version: 2 | ||
| + | renderer: networkd | ||
| + | ethernets: | ||
| + | ens192: | ||
| + | dhcp4: no | ||
| + | dhcp6: no | ||
| + | addresses: | ||
| + | - 10.15.65.5/ | ||
| + | gateway4: 10.15.65.254 | ||
| + | nameservers: | ||
| + | addresses: [192.168.130.11, | ||
| + | ens160: | ||
| + | dhcp4: no | ||
| + | dhcp6: no | ||
| + | addresses: | ||
| + | - 192.168.1.105/ | ||
| + | - 2a01: | ||
| + | gateway4: 192.168.1.1 | ||
| + | gateway6: 2a01: | ||
| + | nameservers: | ||
| + | addresses: | ||
| + | - 46.18.130.11 | ||
| + | - 46.18.131.75 | ||
| + | routes: | ||
| + | - to: 192.168.255.0/ | ||
| + | via: 192.168.1.1 | ||
| + | ~~~ | ||
| + | |||
| + | Pour vérifier la config | ||
| + | ~~~bash | ||
| + | netplan try | ||
| + | |||
| + | # Rien de sera appliqué si --debug | ||
| + | netplan --debug apply | ||
| + | ~~~ | ||
| + | |||
| + | Si OK pour appliquer | ||
| + | ~~~bash | ||
| + | netplan apply | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | | ||
| + | configuration for the renderers. | ||
| + | | ||
| + | restarting them as necessary. | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | # pour vérifier que la syntaxe était bonne, puis | ||
| + | netplan --debug generate | ||
| + | |||
| + | netplan generate | ||
| + | netplan apply | ||
| + | |||
| + | man 5 netplan | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Network-Manager UI | ||
| + | |||
| + | Liste : | ||
| + | * connman / cmst | ||
| + | * wicd | ||
| + | * nm-tray / network-manager | ||
| + | |||
| + | |||
| + | ## Promiscuous mode | ||
| + | |||
| + | ~~~bash | ||
| + | ip link set eth0 promisc on | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | Voir : | ||
| + | * `/ | ||
| + | |||
| + | |||
| + | ## Perte de paquets ? | ||
| + | |||
| + | |||
| + | ~~~ | ||
| + | netstat -s | grep retransmitted | ||
| + | | ||
| + | |||
| + | netstat -s | grep segments | ||
| + | | ||
| + | | ||
| + | 161 segments retransmitted | ||
| + | 13 bad segments received | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Err | ||
| + | |||
| + | ~~~ | ||
| + | # systemctl restart network | ||
| + | RTNETLINK answers: File exists | ||
| + | ~~~ | ||
| + | |||
| + | Solution | ||
| + | ~~~bash | ||
| + | systemctl stop NetworkManager | ||
| + | #ip addr flush dev eth1 | ||
| + | #ps -ef | grep -i net | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Autres | ||
| + | ~~~bash | ||
| + | ethtool -K ens33 tx-checksum-ip-generic off | ||
| + | ~~~ | ||
| + | |||
