# Afficher toutes les interfaces
ip link show
# Afficher les adresses IP
ip addr show
# Information détaillée interface spécifique
ip addr show dev eth0
# Afficher configuration
ifconfig
# État des interfaces
netstat -i
# Statistiques interfaces
netstat -s
# Activer interface
ip link set eth0 up
# Désactiver interface
ip link set eth0 down
# Ajouter adresse IP
ip addr add 192.168.1.100/24 dev eth0
# Supprimer adresse IP
ip addr del 192.168.1.100/24 dev eth0
# Configuration temporaire (ancienne méthode)
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
# Interface avec IP statique
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
# Interface DHCP
auto eth0
iface eth0 inet dhcp
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
ONBOOT=yes
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.1.100/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
# Méthode moderne
ip route show
# Méthode traditionnelle
route -n
# Afficher routes IPv6
ip -6 route show
# Ajouter route
ip route add 10.0.0.0/24 via 192.168.1.1
# Supprimer route
ip route del 10.0.0.0/24
# Route par défaut
ip route add default via 192.168.1.1
# Ajouter à la configuration interface
up route add -net 10.0.0.0/24 gw 192.168.1.1
10.0.0.0/24 via 192.168.1.1
# Ajouter table
echo "100 custom" >> /etc/iproute2/rt_tables
# Ajouter route dans table spécifique
ip route add 10.0.0.0/24 via 192.168.1.1 table custom
# Règle de routage
ip rule add from 192.168.1.0/24 table custom
# Activer IPv6
sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Désactiver IPv6
sysctl -w net.ipv6.conf.all.disable_ipv6=1
# Ajouter adresse IPv6
ip -6 addr add 2001:db8::1/64 dev eth0
# Configuration automatique
sysctl -w net.ipv6.conf.eth0.autoconf=1
modprobe bonding
# /etc/modprobe.d/bonding.conf
options bonding mode=1 miimon=100
# Créer bond
ip link add bond0 type bond
# Ajouter interfaces
ip link set eth0 master bond0
ip link set eth1 master bond0
# Créer VLAN
ip link add link eth0 name eth0.100 type vlan id 100
# Activer VLAN
ip link set eth0.100 up
# Configurer IP
ip addr add 192.168.100.1/24 dev eth0.100
# Ping classique
ping -c 4 8.8.8.8
# Ping IPv6
ping6 -c 4 2001:4860:4860::8888
# Test MTU
ping -M do -s 1472 192.168.1.1
# Traceroute
traceroute 8.8.8.8
mtr 8.8.8.8
# Scan ports
netstat -tuln
ss -tuln
# Analyse trafic
tcpdump -i eth0 -n
# /etc/sysctl.conf
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.core.wmem_max = 12582912
net.core.rmem_max = 12582912
net.ipv4.tcp_rmem = 10240 87380 12582912
net.ipv4.tcp_wmem = 10240 87380 12582912
# Taille buffer
ethtool -G eth0 rx 4096 tx 4096
# Paramètres offload
ethtool -K eth0 tso on gso on gro on
Sécurité
Documentation
Maintenance
Haute Disponibilité
#!/bin/bash
# Monitoring interfaces
for iface in $(ip -br link | awk '{print $1}'); do
status=$(ip -br link show $iface | awk '{print $2}')
if [ "$status" != "UP" ]; then
echo "ALERTE: Interface $iface DOWN"
fi
done
# Statistiques interface
ip -s link show eth0
# Connexions actives
ss -s
# Charge réseau
iftop -i eth0