Can’t start eth1 and dhcp on debian wheezy

dhcpethernetnetworkingsubnet

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:

$ ifup eth1
Missing required variable: address
Missing required configuration variables for interface eth1/inet.
Failed to bring up eth1.

ifconfig -a

$ 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

# 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

INTERFACES="eth1"

/etc/dhcp/dhcpd.conf

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;
}

Best Answer

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.