Das Skript befindet sich im Paket ifupdown-scripts-wa, das jedoch nicht Teil der offiziellen Debian-Distribution ist; fügt man folgende Zeile zur APT-Konfiguration hinzu, reicht der Befehl apt-get install ifupdown-scripts-wa um das Skript korrekt zu installieren.
root:~# wget -P/etc/apt/sources.list.d/ http://wertarbyte.de/apt/wertarbyte-apt.list
root:~# wget -O - http://wertarbyte.de/apt/software-key.gpg | apt-key add -
root:~# apt-get update
root:~# apt-get install ifupdown-scripts-wa
Das Skript erweitert die Syntax der Konfigurationsdatei /etc/network/interfaces um eine neue Anweisung namens addresses, mit der zusätzliche zu bindende IP-Adressen (mit der Netzmaske in /-Notation) angegeben werden können.
root:~# vi /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
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255
addresses-0 192.168.0.11/24
create_alias_devices yes
label_addresses yes
# default route to access subnet
up route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1 eth0
Nach der Konfiguration restarten wir die Interfaces mit folgenden Befehl.
root:~# /etc/init.d/networking restart
Alternativ können wir den Befehl ip addr add 192.168.0.11/24 dev eth0 zum hinzufügen und ip addr del 192.168.0.11/24 dev eth0 zum entfernen des virtuellen Interface benutzen.
root:~# ip addr add 192.168.0.11/24 dev eth0
root:~# ip addr del 192.168.0.11/24 dev eth0
In der Ausgabe von ifconfig sehen wir nun das neue Virtuelle Interface eth0:0.
root:~# ifconfig
eth0 Link encap:Ethernet HWaddr 40:61:86:2b:83:2a
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::4261:86ff:fe2b:832a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22337764 errors:0 dropped:0 overruns:0 frame:0
TX packets:22843122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9211231694 (8.5 GiB) TX bytes:7633861066 (7.1 GiB)
Interrupt:249 Base address:0xc000
eth0:0 Link encap:Ethernet HWaddr 40:61:86:2b:83:2a
inet addr:192.168.0.11 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:249 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:190267653 errors:0 dropped:0 overruns:0 frame:0
TX packets:190267653 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:25179290572 (23.4 GiB) TX bytes:25179290572 (23.4 GiB)
Wir können auch den Befehl ip addr show eingeben, um die Intefaces anzeigen zu lassen.
root:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 40:61:86:2b:83:2a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.11/24 scope global secondary eth0:0
inet6 fe80::4261:86ff:fe2b:832a/64 scope link
valid_lft forever preferred_lft forever