从今天早上开始,网络无法访问Ubuntu 18:04

用户名

今天早上,我的Ubuntu 18.04 Server Edition中的网络不再工作:

marco@pc01:$ sudo lshw -class network
  *-network DISABLED
      description: Ethernet interface
      product: RTL8111/8168/8411 PCI Express 
        Gigabit Ethernet Controller
  *-network DISABLED
      description: Wireles interface
      product: AR9227 Wireless Network Adapter
  *-network:0
       description: Ethernet interface
       physical id: 2
       logical name : docker0
  *-network:1
       description: Ethernet interface
       physical id: 3

须藤nano / etc / nework / interfaces:

iface eth0 inet static
    address 192.168.1.7
    netmask 255.255.255.0
    network 192.168.1.1 
    broadcast 192.168.0.255
    post-up iptables-restore <  
      /etc/iptables.up.rules
    gateway 192.168.1.1
    dns-nameservers 192.168.0.5 8.8.8.8

marco@pc01:$ sudo service network-manager restart
 Failed to restart network-manager.service: Unit network-manager.service 
  not found

即使使用sudo /etc/init.d/networking重新启动:

marco@pc01:$ sudo /etc/init.d/networking restart
[ok] Restarting networking (via systemctl):
 networking.service

marco@pc01:$ ping 192.168.1.4
 connect: Network is unreachable

为了使网络再次可用,我该怎么做?期待您的帮助Marco

1°更新:

marco@pc01:$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKOWN group
       default qlen 1000
   inet 27.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: enp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group 
       default qlen 1000
     link/ether 78:24:af:43:ef:5c brd ff:ff:ff:ff:ff:ff
3: wlp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group 
       default qlen 1000
     link/ether c0:4a:00:09:0e:80 brd ff:ff:ff:ff:ff:ff  
4: b3-4f9fe03b1a66: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc 
       noqueue state DOWN group default
     link/ether 02:42:64:29:65:73 brd ff:ff:ff:ff:ff:ff
     inet 172.22.0.1/16 brd 172.22.255.255 scope global br-4f9fe03b1a66
       valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
      state DOWN group default
    link/Ether 02:42:01:ea:90:66 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scoper global docker0
      valid_lft forever preferred_lft forever

2°已婚:

一种)

marco@pc01:$ ifconfig eth0 up eth0: ERROR while getting interface flags: 
  eth0: ERROR while getting interface flgs: No such device
  eth0: Host name lookup failure

marco@pc01:$ ifconfig
br-4f9feo3b1a66: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
    inet 192.22.0.1 netmask 255.255.0.0 broadcast 172.22.255.255
    ether 02:42:4d:c4:bd:62 txqueuelen 0 (Ethernet) 
    RX packets 0 bytes 0 (0.0B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

docker0: flags=4099<,UP,BROADCAST,MULTICAST> mtue 1500
    inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
    ether 02:42:24:b9:3b:59 txqueuelen 0 (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

l0: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefoxlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 258 bytes 32343 (32.3 KB) 
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 258 bytes 32343 (32.3 KB)  
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

B)

/ etc / network / interfaces:

  auto lo
  iface lo inet loopback

3°更新:

我修改了/ etc / network / interfaces文件,如下所示:

iface enp3s0 inet static
    address 192.168.1.7
    netmask 255.255.255.0
    network 192.168.1.1 
    broadcast 192.168.0.255
    post-up iptables-restore <  
      /etc/iptables.up.rules
    gateway 192.168.1.1
    dns-nameservers 192.168.0.5 8.8.8.8

但是仍然没有网络。

4°更新:

  marco@pc01:$ uname -r
  4.15.0-55-generic

  marco@pc01:$ ls -al /etc/netplan
  total 20
  drwxr-xr-x 2 root root 4096 Jul 25 18:37
  drwxr-xr-x 128 root root 12288 Jul 25 12:51
  -rw-r--r-- 1 root root 616 Jul 25 18:37 30-cloun-init.yaml

   etc/netplan/50-cloud-init.yaml    :

     network:
         renderer: NetworkManager/ networkd
         ethernets:
           enp3s0:
               addresses: [192.168.1.7/24]
               gateway4: 192.168.1.1
               nameservers:
                   addresses: [8.8.8.8,8.8.4.4]
               dhcp4: no
         version: 2

 marco@pc01:$ sudo netplan apply
 sudo: netplan: command not found

对于sudo llshw -c网络:请参见上文

5°更新:dpkg -l netplan的结果

marco@pc01:$ dpkg -l *netplan*
Desired=Unknown/Install/Remove/Purge/Hold
  Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-
       pend
    Err?=(none)/Reinst-required (Status,Err: uppercase=bad)

    Name              Version       Architecture  Description
    in netplan.io      <none>          amd64      (no description 
                                                   available)

6°更新:sudo lshw -c网络

marco@pc01:$ sudo lshw -c network
  *-network DISABLED
      description : Ethernet interface
      product: RTL811178168/8411 PCI Express Gigabit Ethernet Controller
      vendor: Realtek Semiconductor CO., Ltd.
      physical id: 0
      bus info: pci@000:03:00.0
      logical name: enp3s0
      version: 11
      serial: 78:24:af:43:ef:5c
      size: 100 Mbit/s
      capacity: 1Gbit/s
      width: 64 bits
      clock: 33 Mhz
      capabilities: pm msi pciexpress msix vpd bus_master cap_list 
                    ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 
                    1000bt 1000bt-fd autonegotiation
      configuration: autonegotiaion=on broadcast=yes driver=r8169 
                     driverversion=2.3LK-NAPI duplex=full latency=0 
                     link=no multcast=yes port=MII speed=100Mbit/s 
      resources: irq:18 ioport:d000(size=256) memory:f7200000-f7200fff 
                 memory:f2100000-f2103fff
   *-network DISABLED
      description: Wireless interface
      product: AR9227 Wireless NEtwork Adapter
      vendor: Qualcomm Atheros
      physical id: 0
      bus info: pci@0000:05:00.0
      logical name: wlp5s0
      version: 01
      serial: c0:4a:00:09:0e:80
      width: 32 bits
      clock: 66MHz
      capabilities: pm bus_master cap_list ethernet physical wireless
      configuration: broadcast=yes driver=ath9k driverversion=3.15.0-55-
                     generic firmware=N/A latency=168 link=no 
                     multicast=yes wireless=IEEE 802.11
      resources: irq:19 memory:f7100000-f10ffff
   *-network:0
      description: Ethernet interface
      physical id: 2
      logical name: docker0
      serial: 02:42:62:12:98:6e
      capabilities: ethernet physical
      configuration: broadcast=yes driver=bridge driverversion=2.3 
                     firmware=N/A ip=172.17.0.1 link=no multicast=yes
   *-network:1
       description: Ethernet interface
       physical id:3
       logical name: br-4f9fe03b1a66
       serial: 01:42:fc:9e:92:1c
       capabilities: ethernet physical
       consiguration: broadcast=yes driver=bridge driverversion=2.3 
                      firmware=N/A ip=172.22.0.1 link=no multicast=yes

7°更新:

Two disks: 
  1° disk: 
    /dev/sda1 1M BIOS boot 
    /dev/sda2 1G Linux filesystem /dev/sda3 232G Linux filesystem 
     with sudo fsck -f : everything ok ;
  2° disk: 
    /dev/sdb1 1M BIOS boot 
    /dev/sdb2 232G Linux filesystem

    sudo fsck -f /dev/sdb1
    fsck from util-linux 2.31.1
    e2fsck 1.44.1 (24-Mar-2018)
    ext2fs_open2: Bad magic number in super-block
    fsck.ext2: Supeblock invalid, trying backup blocks...
    fsck.ext2: Bad magic number in super-block whule trying to open 
               /dev/sdb1
      The superblock could not be read or does not describe a valid 
ext2/ext3/ext4 filesystem (and not swap or ufs or something else), then 
the superblock is corrupt, and you might try running e2fsck with an
alternate superblock:
  e2fsck -b 8193 <device>
or
  e2fsck -b 32768 <device>

即使/ dev / sdb1可能包含损坏的超级块,我也可以安装netplan吗?

8°更新:

ubuntu@ubuntu:$ sudo fsck -f /dev/sda2
fsck fromutil-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2: 309/65536 files (2.9% non-contiguous), 48744/262144 blocks

ubuntu@ubuntu:$ sudo fsck -f /dev/sdb2
fsck from util-linux 2.31.1

9度更新:修改/etc/netplan/01-network-manager-all.yaml后:

ubuntu@ubuntu:/etc/netplan$ sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:4715): DEBUG: 15:57:43.284: Processing input file 
                    /etc/netplan/01-network-manager-all.yaml..
** (generate:4715): DEBUG: 15:57:43.285: starting new processing pass
                    to 1
** (generate:4715): DEBUG: 15:57:43.285: Configuration is valid
** (generate:4715): DEBUG: 15:57:43.285: Generating output files..
** (generate:4715): DEBUG: 15:57:43.285: NetworkManager: definition 
                    enp3s0 is not for us (backend 1) 
血淋巴瘤

您的/etc/network/interfaces文件应为:

auto lo
iface lo inet loopback

您的/etc/netplan/*.yaml文件应为:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses: [192.168.1.7/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

然后您应该执行:

sudo netplan generate #生成配置文件

sudo netplan apply #套用设定

reboot #重新启动计算机

更新#1:

您的计算机确实有些奇怪...

  • sudo lshw -C network命令没有给出完整的答案

  • 除非是手动输入错误,否则/etc/netplan目录和文件内容很奇怪

  • 似乎未安装netplan

在我们重新安装netplan之前,最好检查一下文件系统。

  • 启动到Ubuntu Live DVD / USB
  • terminal按下Ctrl+ Alt+打开一个窗口T
  • 类型 sudo fdisk -l
  • 识别“ Linux文件系统”的/ dev / sdXX设备名称
  • 输入sudo fsck -f /dev/sdXX,替换sdXX为您先前找到的数字
  • fsck如果有错误,请重复该命令
  • 类型 reboot

现在,编辑您的.yaml文件,然后继续执行我的原始答案。

更新#2:

建议不要在此时重新安装服务器,而不是尝试将已损坏的服务器修补在一起。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

从今天早上开始,Gmail阻止像素跟踪/ 1x1像素

来自分类Dev

Android中的日期格式从2016年4月18日10:41 AM到04/18/2016 10:41进行解析

来自分类Dev

从今天开始:Google 500错误

来自分类Dev

ubuntu 18的openprinting密钥

来自分类Dev

如何在Ubuntu 12; 04中安装nmap

来自分类Dev

Netbeans的在Ubuntu 18不开放

来自分类Dev

ValueError:字段“ id”应为数字,但为“ super”。[04 / Apr / 2020 18:15:11]“ GET / super_user HTTP / 1.1” 500 132224

来自分类Dev

从今天开始打印日历

来自分类Dev

ubuntu 18的openprinting密钥

来自分类Dev

获取从今天开始的天数

来自分类Dev

为什么Ubuntu的次要版本号仅为04或10?

来自分类Dev

双启动Ubuntu 14 .04LTS

来自分类Dev

无法访问QML应用的JS文件中的i18n

来自分类Dev

从今天开始遍历星期几

来自分类Dev

ubuntu-minimal 18:04如何通过ssh登录?

来自分类Dev

Ubuntu 18,无法安装xelatex

来自分类Dev

安装ubuntu服务器时出错14:04 / 15:04

来自分类Dev

在Excel中从今天的日期开始更新表

来自分类Dev

从今天开始获取未来的x个月

来自分类Dev

Windows 7和Ubuntu 18?

来自分类Dev

Ubuntu 18 NFS更改

来自分类Dev

无法在 Ubuntu 18 上安装 Chrome

来自分类Dev

Kerberos 和 Ubuntu 18

来自分类Dev

IBus 1.5 似乎无法支持 Ubuntu 18?

来自分类Dev

在 Ubuntu 16-04 上安装 opencv

来自分类Dev

ubuntu 18,04 卡在只读模式,fsck 无法修复

来自分类Dev

如何在 Lubuntu 18:04 中用 dolphin 替换 pcmanfm?

来自分类Dev

无法在 ubuntu 18 中安装 Laravel Telescope

来自分类Dev

如何使用 SimpleDateFormatter 将 2019-09-18T01:44:35GMT-04:00 转换为 2019-09-18T01:44:35-04:00