Table des matières

Configurer le réseau sous Linux

RedHat / Fedora

Pour configurer eth0, éditer le fichier Dans /etc/sysconfig/network-scripts/ifcfg-eth0 :

ONBOOT=yes
DEVICE=bond0
BOOTPROTO=static
IPADDR=192.168.0.4
NETMASK=255.255.255.0
BROADCAST=192.168.0.255

La passerelle par défaut se configure toujours dans le fichier /etc/sysconfig/network :

GATEWAY=192.168.0.254

Pour ajouter des routes statiques pour eth0, créer et éditer le fichier /etc/sysconfig/network-scripts/route-eth0 :

10.1.0.0/24 via 192.168.0.253
10.0.0.1 via 192.168.0.253

Ci-dessus, nous passons par la passerelle 192.168.0.253 pour atteindre le réseau 10.1.0.0/24 et l'hôte 10.0.0.1

Debian / Ubuntu

Sous Debian, tout est configuré dans le fichier /etc/network/interfaces :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.0.4
        netmask 255.255.255.0
        gateway 192.168.0.254
        post-up route add -net 10.1.0.0/24 gw 192.168.0.253
        post-up route add 10.0.0.1 gw 192.168.0.253

:!: Ce fichier de configuration est la même configuration que RedHat plus haut.