【问题标题】:Interface eth0 not configured [closed]未配置接口 eth0 [关闭]
【发布时间】:2017-05-04 02:40:56
【问题描述】:

我正在尝试设置静态 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.config 配置上面的文件。还有其他方法可以使用这些设备设置静态 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

【问题讨论】:

    标签: ubuntu networking router static-ip-address


    【解决方案1】:

    是的。只需将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
    

    【讨论】:

    • 我可以使用 lo 吗?根据netstat -i,lo的MTU更高。
    • 不,你不能。 lo 是你的环回接口。
    • 好的。我选择哪一个重要吗?我不知道这些接口之间的区别。
    • 刚刚尝试切换到 eno1 而不是关闭 eth0。当我尝试 sudo ifdown eno1 时,我得到: ifdown: interface eno1 not configured.
    • 所有这些接口都代表您机器上单独的物理网络接口。您是否正在尝试将当前 IP 地址为 192.168.1.7enp82s0 的 IP 地址更改为 192.168.1.88?如果是,请选择enp82s0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-06
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 2013-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多