Networking
無法在 debian wheezy 上啟動 eth1 和 dhcp
我想要的是:
- eth0 連接到網際網路並具有靜態 IP 地址。
- eth1 連接到內部網路,作為子網的 dhcp 伺服器。
但我無法讓 eth1 工作。錯誤:
$ 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)
配置文件:
/etc/網路/介面
# 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; }
iface eth1 inet static adress 192.168.7.2 ^^^ typo here, should be "address".
另請注意,自 1999 年以來不推薦使用 ifconfig,請
ip addr
改用(不推薦使用 ifupdown)。ifupdown 有一個小問題,它無法檢測到“無效”選項,因為這些選項是作為環境變數傳遞的,並且無法判斷 ifupdown 幫助程序腳本是否使用某個環境變數。理論上,可能有一個 ifupdown 幫助腳本,它使用一個名為“地址”的選項,並且它是完全有效的。一項改進需要現有的助手列出他們接受的選項,因此會破壞許多現有的腳本。