Can’t start eth1 and dhcp on debian
What I want:
- eth0 is connected to internet and has a static IP-address.
- eth1 connected to internal network and be a dhcp server for subnet.
But I can’t get eth1 to work. Error:
1 2 3 4 |
$ ifup eth1 Missing required variable: address Missing required configuration variables for interface eth1/inet. Failed to bring up eth1. |
ifconfig -a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$ ifconfig -a eth0 Link encap:Ethernet HWaddr 00:50:56:00:29:4a inet addr:5.9.125.5 Bcast:5.9.125.7 Mask:255.255.255.248 inet6 addr: fe80::250:56ff:fe00:294a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1011 errors:0 dropped:0 overruns:0 frame:0 TX packets:573 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:87665 (85.6 KiB) TX bytes:74517 (72.7 KiB) eth1 Link encap:Ethernet HWaddr 00:0c:29:63:c5:c9 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 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:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) |
Configuration file:
/etc/network/interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Loopback auto lo iface lo inet loopback # External allow-hotplug eth0 iface eth0 inet static address 5.9.125.5 netmask 255.255.255.248 network 5.9.125.0 broadcast 5.9.125.7 gateway 5.9.125.1 dns-nameservers 213.133.98.98 213.133.99.99 dns-search 5.125.9.5.clients.your-server.de # Internal auto eth1 allow-hotplug eth1 iface eth1 inet static adress 192.168.7.2 netmask 255.255.255.128 network 192.168.7.0 broadcast 192.168.7.127 dns-nameservers 213.133.98.98 213.133.99.99 dns-search 5.125.9.5.clients.your-server.de |
/etc/default/isc-dhcp-server
1 |
INTERFACES="eth1" |
/etc/dhcp/dhcpd.conf
1 2 3 4 5 6 7 8 9 |
subnet 192.168.7.0 netmask 255.255.255.128 { range 192.168.7.2 192.168.7.126; option domain-name-servers 213.133.98.98, 213.133.99.99; option routers 192.168.7.1; option subnet-mask 255.255.255.128; option broadcast-address 192.168.7.127; default-lease-time 86400; max-lease-time 676800; } |
Solution #1:
1 2 3 |
iface eth1 inet static adress 192.168.7.2 ^^^ typo here, should be "address". |
Also note that ifconfig is deprecated since 1999, use ip addr instead (ifupdown is not deprected through).
ifupdown has this little problem that it cannot detect “invalid” options because these options are passed as environment variables and there is no way to tell if a ifupdown helper script uses a certain environment variable. In theory, there could be a ifupdown helper script that uses an option called “adress”, and it would be perfectly valid. An improvement would require that existing helpers list the options they accept, so would break many existing scripts.
Solution #2:
I had the same error message, no exactly typos, but I copied the interfaces format from some website. It was like this:
1 2 3 4 5 6 |
auto eth1 iface eth1 inet static address 192.168.7.2 netmask 255.255.255.128 dns-nameservers 213.133.98.98 213.133.99.99 dns-search 5.125.9.5.clients.your-server.de |
Removing the “double spaces” in iface line changed the original error from ‘unknown device eth1’ to ‘Missing required variable: address’, but notice there was no typo in the word ‘address’, only an initial space on each line from that one on. Removing the leading spaces in from of each line solved my issue. Just to be sure, I inserted the extra spaces again and all goes ok, so it was indeed some unknown invisible character I’ve copied form the web and couldn’t tell it.