Xarxa. Exemple de interfaces (Debian)
== interfaces, Debian ==
*Xarxa. Exemple de interfaces (Debian)*
Última actualització: agost de 2022
Exemple senzill de /etc/network/interfaces:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# automatically added when upgrading
auto lo eth0 eth0:0
# The loopback interface
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
# The primary network interface
allow-hotplug eth0
#Si fem servir NetworkManager, comentar o esborrar tot el que hi ha a partir d'aquí:
#Interfície eth0. dhcp o estàtica. En aquest cas, adreça estàtica
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.50
netmask 255.255.254.0
gateway 10.0.0.2
#Interfície eth0:0 Adreça secundària sobre la mateixa targeta
iface eth0:0 inet static
address 192.168.0.101
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
# Rutes estàtiques
# up ip route add 192.1.0.0/16 via 10.0.0.33 dev eth0 || true
# up ip route del 192.1.0.0/16 via 10.0.0.33 dev eth0 || true
#
# També podem afegir rutes al fitxer /etc/network/if-up.d/rutes (li aplicarem un chmod 751) amb aquest contingut, p.e.
# #!/bin/sh
# if [ "$IFACE" = "eth0" ]; then
# ip route add 192.1.0.0/16 via 10.0.0.33
# fi
# DNS-* options are implemented by the resolvconf package, if installed
# dns-nameservers 8.8.8.8
# dns-search tux.local
# Si no tenim resolconf instal·lat afegir a /etc/resolv.conf en aquest format:
# nameserver 8.8.8.8
# domain tux.home
# search tux.home
* * * * * * * * * * * * * * * * * *