未配置接口 eth0

Interface eth0 not configured

我正在尝试设置静态 IP 地址。这是我的 /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

# primary network interfaces
auto eth0
iface eth0 inet static
        address 192.168.1.88
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameservers 127.0.1.1

显然,我的机器根本没有 eth0。我环顾四周,每个人都说用 eth0 配置上面的文件。还有其他方法可以使用这些设备设置静态 IP 地址吗?

$ ifconfig -a
eno1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1c:1b:0d:0a:86:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xdf400000-df420000  

enp82s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.7  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::9b71:b459:c8d8:4bc5  prefixlen 64  scopeid 0x20<link>
        ether 1c:1b:0d:0a:85:fe  txqueuelen 1000  (Ethernet)
        RX packets 3712  bytes 2691239 (2.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1501  bytes 157372 (157.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xdf200000-df21ffff  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 25268  bytes 1537593 (1.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25268  bytes 1537593 (1.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp83s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether e4:b3:18:8c:05:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

是的。只需将 eth0 替换为其他接口之一即可。

例如:

auto eno1
iface eno1 inet static
        address 192.168.1.88
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameservers 127.0.1.1