Debian – 静态IP,/ etc / network / interfaces

我试图设置一个静态IP在我的Debian 8.1(在VirtualBox),所以我编辑了/ etc / network / interface文件:

# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1 broadcast 192.168.1.255 

这个configuration看起来是正确的(我也试过没有'auto eth0'),这个ip还没有在networking中使用。
但是,当我检查与ifconfig,eth0不会出现,显然是在我的configuration错误。

ifconfig无界面编辑(正常):

 eth0 Link encap:Ethernet HWaddr 08:00:27:4a:58:ae inet addr:192.168.1.43 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe4a:58ae/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:26 errors:0 dropped:0 overruns:0 frame:0 TX packets:77 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2201 (2.1 KiB) TX bytes:10924 (10.6 KiB) 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:65536 Metric:1 RX packets:39 errors:0 dropped:0 overruns:0 frame:0 TX packets:39 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4573 (4.4 KiB) TX bytes:4573 (4.4 KiB) 

接口的ifconfig编辑(exception):

 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:65536 Metric:1 RX packets:39 errors:0 dropped:0 overruns:0 frame:0 TX packets:39 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4573 (4.4 KiB) TX bytes:4573 (4.4 KiB) 

我想知道如何configuration这个eth0接口来获得一个静态IP。

您的文件中可能会有更多(如上面的注意事项),您可能没有包括这些内容,这可能是错误的。 有没有一个标题可能是你不小心拉到两个不正确格式的行?