我使用的是 Debian 9,想要设置静态 IP 地址。下列的本指南我应该找到一行以auto eth0
in开头的行/etc/network/interfaces
,但这里没有这样的东西。 Debian 9 中这些东西有改变吗?来自ip a
我的网络接口wlo1
- 或者这只是一个环回设备?
root@emerald:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
root@emerald:~# ls /etc/network/interfaces.d/
root@emerald:~#
输出ip a
:
root@emerald:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether ec:9a:74:f3:72:a9 brd ff:ff:ff:ff:ff:ff
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 74:de:2b:9f:23:90 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic wlo1
valid_lft 86377sec preferred_lft 86377sec
inet6 fe80::76de:2bff:fe9f:2390/64 scope link
valid_lft forever preferred_lft forever
答案1
自 2009 年以来,Consistent Network Device Naming
采用了命名惯例Ethernet adapters
,Linux
这就是为什么有eno1
,没有eth0
。并且由于缺少主网卡的配置/etc/networks/interfaces
- 这很可能是因为您已经network-manager
安装了。你可以看到一些相关的信息这里。
如果您想使用/etc/network/intefaces
,只需禁用或删除Network-Manager
并eno1
根据您的要求进行配置即可/etc/network/interfaces
。