Networking.service 启动失败 - RTNETLINK 回答:文件存在

Networking.service 启动失败 - RTNETLINK 回答:文件存在

重启服务器后,我遇到了问题。以前网络很好,我很少碰它,因为它是备用服务器。自从重启后,它就一直有问题。服务器运行的是 ubuntu 18.04

systemctl status networking.service

显示状态为失败:

RTNETLINK answers: File exists
Failed to bring up enp5s0f1
Failed to start Raise network interfaces

重新启动服务器,进一步重新启动并没有改变这一点。运行时ifdown enp5s0f1显示为设备未配置。

再次ifup en5s0f1显示:

RTNETLINK answers: File exists
Failed to bring up enp5s0f1

我从这个帖子中尝试了几种解决方案:https://raspberrypi.stackexchange.com/questions/13895/solving-rtnetlink-answers-file-exists-when-running-ifup

我不想添加忽略错误选项,以防以后出现问题。

这是接口文件:

# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto bond0
#iface bond0 inet static
#        pre-up modprobe bonding miimon=100 mode=4 lacp_rate=1
#        pre-up ip link set bond0 up
#        pre-up ifenslave bond0 eno1
#        pre-up ifenslave bond0 eno2
#        pre-up ifenslave bond0 eno3
#        pre-up ifenslave bond0 eno4
#        post-down ip link set bond0 up
#        post-down ifenslave -d bond0 eno1
#        post-down ifenslave -d bond0 eno2
#        post-down ifenslave -d bond0 eno3
#        post-down ifenslave -d bond0 eno4
#        post-down rmmod bonding
#        address 192.168.128.23
#        netmask 255.255.240.0
#    gateway 192.168.128.1
#    mtu 9000
#       slaves      eno1 eno2 eno3 eno4
#       bond_mode   4
#       bond-miimon 100
#       bond_downdelay  200
#       bond_updelay    200

auto enp5s0f1
iface enp5s0f1 inet static
        address 192.168.128.23
        netmask 255.255.240.0
    gateway 192.168.128.1
    mtu 9000

auto enp5s0f1.0100
iface enp5s0f1.0100 inet static
    address 192.168.100.23
    netmask 255.255.255.0
    vlan-raw-device enp5s0f1

auto enp5s0f1.0201
iface enp5s0f1.0201 inet static
    address 192.168.201.23
    netmask 255.255.255.0
    vlan-raw-device enp5s0f1

#auto bond0.0100
#iface bond0.0100 inet static
#   address 192.168.100.23
#   netmask 255.255.255.0

#auto bond0.0201
#iface bond0.0201 inet static
#       address 192.168.201.23
#       netmask 255.255.255.0

查看 ifstate,我添加了第一行,但没有帮助:

lo=lo
enp5s0f1=enp5s0f1
enp5s0f1.0100=enp5s0f1.0100
enp5s0f1.0201=enp5s0f1.0201

ifconfig -a输出这个

bond0: flags=5123<UP,BROADCAST,MASTER,MULTICAST>  mtu 1500
        inet 192.168.128.23  netmask 255.255.240.0  broadcast 192.168.143.255
        ether 1a:e3:d6:8c:b5:ff  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

bond0.0100: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.100.23  netmask 255.255.255.0  broadcast 192.168.100.255
        ether 1a:e3:d6:8c:b5:ff  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

bond0.0201: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.201.23  netmask 255.255.255.0  broadcast 192.168.201.255
        ether 1a:e3:d6:8c:b5:ff  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

eno1: flags=6147<UP,BROADCAST,SLAVE,MULTICAST>  mtu 1500
        ether 1a:e3:d6:8c:b5:ff  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

eno2: flags=6147<UP,BROADCAST,SLAVE,MULTICAST>  mtu 1500
        ether 1a:e3:d6:8c:b5:ff  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

eno3: flags=6147<UP,BROADCAST,SLAVE,MULTICAST>  mtu 1500
        ether 1a:e3:d6:8c:b5:ff  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

eno4: flags=6147<UP,BROADCAST,SLAVE,MULTICAST>  mtu 1500
        ether 1a:e3:d6:8c:b5:ff  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

enp5s0f0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether a0:36:9f:5f:6a:78  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

enp5s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 192.168.128.23  netmask 255.255.240.0  broadcast 192.168.143.255
        inet6 fe80::a236:9fff:fe5f:6a7a  prefixlen 64  scopeid 0x20<link>
        ether a0:36:9f:5f:6a:7a  txqueuelen 1000  (Ethernet)
        RX packets 1816  bytes 182426 (182.4 KB)
        RX errors 0  dropped 211  overruns 0  frame 0
        TX packets 33  bytes 2598 (2.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp5s0f1.0100: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 192.168.100.23  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::a236:9fff:fe5f:6a7a  prefixlen 64  scopeid 0x20<link>
        ether a0:36:9f:5f:6a:7a  txqueuelen 1000  (Ethernet)
        RX packets 433  bytes 22045 (22.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp5s0f1.0201: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 192.168.201.23  netmask 255.255.255.0  broadcast 192.168.201.255
        inet6 fe80::a236:9fff:fe5f:6a7a  prefixlen 64  scopeid 0x20<link>
        ether a0:36:9f:5f:6a:7a  txqueuelen 1000  (Ethernet)
        RX packets 106  bytes 7861 (7.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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 1000  (Local Loopback)
        RX packets 134  bytes 13007 (13.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 134  bytes 13007 (13.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我不太确定债券选项。网络是由我的同事不久前建立的,他现在已经不在我们公司了。

编辑:找到了 netplan 配置!我只想使用 netplan,只要它能用就行。我删除了 ifupdown,并尝试了 netplan 配置,但仍然没有网络。我确认 networking.service 已被删除,systemd-networkd 已启动 - 仍然坏了!

关于这个 netplan 配置有什么建议吗?

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
#network:
#  version: 2
#  renderer: networkd
#  ethernets:
#    eno1:
#      addresses: [ 192.168.128.23/20 ]
#      gateway4: 192.168.128.1
#      nameservers:
#          addresses:
#              - "192.168.128.240"

network:
    version: 2
    renderer: networkd
    ethernets:
        switchports: #the physical interfaces
            match: {name: "eno[1-4]"}
            dhcp4: no
            optional: true           
    bonds:     
        bond0: #the bonded interface
            interfaces: [switchports]
            parameters:
                mode: 802.3ad
                lacp-rate: fast
                mii-monitor-interval: 100
            dhcp4: no
            addresses: [ "192.168.128.23/20" ]
            gateway4: 192.168.128.1
            nameservers:
                addresses:
                    - "192.168.128.240"
    vlans:
        bond0.0100:
            id: 100
            link: bond0
            dhcp4: no
            addresses: [ "192.168.100.23/24" ]
        bond0.0201:
            id: 201
            link: bond0
            dhcp4: no
            addresses: [ "192.168.201.23/24" ]

编辑2:添加了我发现的一些输出。

ipaddr输出

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
3: eno2: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
4: eno3: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
5: eno4: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
6: enp5s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether a0:36:9f:5f:6a:78 brd ff:ff:ff:ff:ff:ff
7: enp5s0f1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether a0:36:9f:5f:6a:7a brd ff:ff:ff:ff:ff:ff
8: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.128.23/20 brd 192.168.143.255 scope global bond0
       valid_lft forever preferred_lft forever
9: bond0.0201@bond0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.201.23/24 brd 192.168.201.255 scope global bond0.0201
       valid_lft forever preferred_lft forever
10: bond0.0100@bond0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 1a:e3:d6:8c:b5:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.23/24 brd 192.168.100.255 scope global bond0.0100
       valid_lft forever preferred_lft forever

networkd.service 状态。显示链接已启动,但我仍然无法 ping 任何内部或外部内容。

systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled-runtime; vendor preset: enabled)
   Active: active (running) since Tue 2021-12-21 12:14:54 GMT; 17s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 11381 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─11381 /lib/systemd/systemd-networkd

Dec 21 12:14:54 dougal systemd-networkd[11381]: bond0: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: enp5s0f1: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: bond0: IPv6 successfully enabled
Dec 21 12:14:54 dougal systemd-networkd[11381]: eno2: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: eno1: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: lo: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: eno4: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: enp5s0f0: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: eno3: Link is not managed by us
Dec 21 12:14:54 dougal systemd-networkd[11381]: enp5s0f1: Link is not managed by us

端口输出networkctl似乎卡在配置中。

1: lo
       Link File: /lib/systemd/network/99-default.link
    Network File: n/a
            Type: loopback
           State: carrier (unmanaged)
         Address: 127.0.0.1
                  ::1

● 2: eno1
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-switchports.network
            Type: ether
           State: no-carrier (configuring)
            Path: pci-0000:01:00.0
          Driver: bnx2
          Vendor: Broadcom Limited
           Model: NetXtreme II BCM5709 Gigabit Ethernet (PowerEdge R610 BCM5709 Gigabit Ethernet)
      HW Address: 1a:e3:d6:8c:b5:ff

● 3: eno2
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-switchports.network
            Type: ether
           State: no-carrier (configuring)
            Path: pci-0000:01:00.1
          Driver: bnx2
          Vendor: Broadcom Limited
           Model: NetXtreme II BCM5709 Gigabit Ethernet (PowerEdge R610 BCM5709 Gigabit Ethernet)
      HW Address: 1a:e3:d6:8c:b5:ff

● 4: eno3
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-switchports.network
            Type: ether
           State: no-carrier (configuring)
            Path: pci-0000:02:00.0
          Driver: bnx2
          Vendor: Broadcom Limited
           Model: NetXtreme II BCM5709 Gigabit Ethernet (PowerEdge R610 BCM5709 Gigabit Ethernet)
      HW Address: 1a:e3:d6:8c:b5:ff

● 5: eno4
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-switchports.network
            Type: ether
           State: no-carrier (configuring)
            Path: pci-0000:02:00.1
          Driver: bnx2
          Vendor: Broadcom Limited
           Model: NetXtreme II BCM5709 Gigabit Ethernet (PowerEdge R610 BCM5709 Gigabit Ethernet)
      HW Address: 1a:e3:d6:8c:b5:ff

● 6: enp5s0f0
       Link File: /lib/systemd/network/99-default.link
    Network File: n/a
            Type: ether
           State: off (unmanaged)
            Path: pci-0000:05:00.0
          Driver: ixgbe
          Vendor: Intel Corporation
           Model: Ethernet 10G 2P X520 Adapter (10GbE 2P X520 Adapter)
      HW Address: a0:36:9f:5f:6a:78 (Intel Corporate)

● 7: enp5s0f1
       Link File: /lib/systemd/network/99-default.link
    Network File: n/a
            Type: ether
           State: off (unmanaged)
            Path: pci-0000:05:00.1
          Driver: ixgbe
          Vendor: Intel Corporation
           Model: Ethernet 10G 2P X520 Adapter (10GbE 2P X520 Adapter)
      HW Address: a0:36:9f:5f:6a:7a (Intel Corporate)

● 8: bond0
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-bond0.network
            Type: ether
           State: no-carrier (configuring)
          Driver: bonding
      HW Address: 1a:e3:d6:8c:b5:ff
         Address: 192.168.128.23
         Gateway: 192.168.128.1
             DNS: 192.168.128.240
  Search Domains: imaginariumuk.local

● 9: bond0.0201
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-bond0.0201.network
            Type: ether
           State: no-carrier (configuring)
          Driver: 802.1Q VLAN Support
      HW Address: 1a:e3:d6:8c:b5:ff
         Address: 192.168.201.23

● 10: bond0.0100
       Link File: /lib/systemd/network/99-default.link
    Network File: /run/systemd/network/10-netplan-bond0.0100.network
            Type: ether
           State: no-carrier (configuring)
          Driver: 802.1Q VLAN Support
      HW Address: 1a:e3:d6:8c:b5:ff
         Address: 192.168.100.23

相关内容