IP adresa
Nastavení IP se nachází v souboru: /etc/networks/interface
Nastavení statické IP adresy:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
První řádek, který začíná klíčovým slovem auto, nám říká, že rozhraní eth0 může být ovládáno pomocí služby /etc/init.d/networking. Nastavení DNS serverů je uvedeno v souboru: /etc/resolv.conf
nameserver 8.8.8.8 nameserver 8.8.4.4 domain firma.local
Restartování rozhraní:
sudo /etc/init.d/networking restart
Druhou možností ovládání jsou následující příkazy:
ifdown interface ifup interface
Nastavení IP z DHCP a MAC na hodnotu 01:02:03:04:05:06:
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp hwaddress ether 01:02:03:04:05:06
Nastavení IPv6 adresy:
iface eth0 inet6 static
address 2001:db8::c0ca:1eaf
netmask 64
gateway 2001:db8::1ead:ed:beef
Nastavení sekundární IP adresy na stejném rozhraní:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
auto eth0:1
iface eth0:1 inet static
address 192.168.1.101
network 192.168.1.0
netmask 255.255.255.0
ip addr add 10.0.0.1/24 brd 10.0.0.255 dev eth0 ip addr add 192.168.1.1/24 brd 192.168.1.255 dev eth0 ip addr show dev eth0