无法启动提升网络接口

无法启动提升网络接口

Ubuntu 16 (vm) 添加了一个虚拟网卡 ens160,运行正常,但添加了第二个物理网卡 ens192 却出现错误。

systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
  Drop-In: /run/systemd/generator/networking.service.d
           └─50-insserv.conf-$network.conf
   Active: failed (Result: exit-code) since Wed 2016-07-06 11:19:04 EDT; 8s ago
     Docs: man:interfaces(5)
  Process: 14290 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 14284 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS)
 Main PID: 14290 (code=exited, status=1/FAILURE)

Jul 06 11:19:03 gbsnort systemd[1]: Starting Raise network interfaces...
Jul 06 11:19:04 gbsnort ifup[14290]: RTNETLINK answers: File exists
Jul 06 11:19:04 gbsnort ifup[14290]: Failed to bring up ens192.
Jul 06 11:19:04 gbsnort systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Jul 06 11:19:04 gbsnort systemd[1]: Failed to start Raise network interfaces.
Jul 06 11:19:04 gbsnort systemd[1]: networking.service: Unit entered failed state.
Jul 06 11:19:04 gbsnort systemd[1]: networking.service: Failed with result 'exit-code'.


  6 # The loopback network interface
  7 auto lo
  8 iface lo inet loopback
  9 
 10 # The primary network interface
 11 auto ens160
 12 iface ens160 inet static
 13         address 192.168.2.17
 14         netmask 255.255.255.0
 15         network 192.168.2.0
 16         broadcast 192.168.2.255
 17         gateway 192.168.2.40
 18         # dns-* options are implemented by the resolvconf package, if installed
 19         dns-nameservers 192.168.2.13
 20         dns-search mydomain.com
 21 
 22 # The monitoring interface
 23 auto ens192
 24 iface ens192 inet static
 25         address 192.168.2.12
 26         netmask 255.255.255.0
 27 #       network 192.168.2.0
 28 #       broadcast 192.168.2.255
 29         gateway 192.168.2.40
 30 #       dns-nameservers 192.168.2.13
 31 #       dns-search mydomain.com
 32 
 33 post-up ethtool -K ens192 gro off
 34 post-up ethtool -K ens192 lro off

答案1

  1. 执行dmesg | grep eth看看是否是ens192

  2. 编辑/etc/network/interfaces并添加几行如下:

    iface ensxxx inet static
    address 192.168.1.138
    netmask 255.255.255.0
    gateway 192.168.1.1
    

相关内容