I have a Debian system working as a wireless router with eth0
and wlan0
. Now I added an additional network manually on eth1
with ifconfig
:
alix:~# ifconfig eth1 192.168.0.2 netmask 255.255.255.0 alix:~# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 alix:~# ping 192.168.0.254 PING 192.168.0.254 (192.168.0.254) 56(84) bytes of data. 64 bytes from 192.168.0.254: icmp_req=1 ttl=64 time=0.537 ms 64 bytes from 192.168.0.254: icmp_req=2 ttl=64 time=0.199 ms 64 bytes from 192.168.0.254: icmp_req=3 ttl=64 time=0.188 ms ^C --- 192.168.0.254 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2005ms rtt min/avg/max/mdev = 0.188/0.308/0.537/0.161 ms
Everything works fine as you can see.
Now I would like to make the configuration permanent. Therefor I added the following section to /etc/network/interfaces
:
alix:~# sed -n '/iface eth1/,/^$/p' /etc/network/interfaces iface eth1 inet static address 192.168.0.2 netmask 255.255.255.0
But when I try to start the network I get the following error:
alix:~# ifconfig eth1 down alix:~# ifup -v eth1 Configuring interface eth1=eth1 (inet) run-parts --verbose /etc/network/if-pre-up.d run-parts: executing /etc/network/if-pre-up.d/hostapd ip addr add 192.168.0.2/255.255.255.0 broadcast 192.168.0.255 dev eth1 label eth1 RTNETLINK answers: File exists Failed to bring up eth1.
When I run the ip
command manually I get the same error:
alix:~# ip addr add 192.168.0.2/255.255.255.0 broadcast 192.168.0.255 dev eth1 label eth1 RTNETLINK answers: File exists
What is wrong with the command? And how can I tell Debian to do the right thing?