定義修復乙太網路 IP 位址後網路存取不良

定義修復乙太網路 IP 位址後網路存取不良

我已經為某些項目的乙太網路連接分配了一個固定的 IP 位址。從那以後,我的Wifi速度非常慢,有時甚至無法存取網頁。由於我不是這方面的專家,所​​以我可能改變了一些錯誤的地方,但我不知道是什麼。我有以下設定ubuntu@master:~$ ifconfig::

wlp65s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.160  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2001:171b:2269:80:31b7:25ec:c36e:6823  prefixlen 128  scopeid 0x0<global>
        inet6 fdaa:bbcc:ddee:0:1da1:a7e1:5729:1050  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::d6c7:1b3d:1e0b:5c2e  prefixlen 64  scopeid 0x20<link>
        inet6 fdaa:bbcc:ddee:0:c847:d06f:b111:5c5  prefixlen 64  scopeid 0x0<global>
        inet6 2001:171b:2269:80:1da1:a7e1:5729:1050  prefixlen 64  scopeid 0x0<global>
        inet6 2001:171b:2269:80:7863:65c7:2f72:50e5  prefixlen 64  scopeid 0x0<global>
        ether 84:1b:77:a6:de:16  txqueuelen 1000  (Ethernet)
        RX packets 246113  bytes 216699304 (216.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 134602  bytes 32519445 (32.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp4s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::b62e:99ff:fe31:55a0  prefixlen 64  scopeid 0x20<link>
        ether b4:2e:99:31:55:a0  txqueuelen 1000  (Ethernet)
        RX packets 419407  bytes 369641096 (369.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1018506  bytes 1287911312 (1.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xd9500000-d951ffff 

在我進行一些更改之前,我的無線區域網路連接在哪裡wlp65s0,該連接工作正常。enp4s0是我的乙太網路連線。sudo nano /etc/network/interfaces

auto lo
iface lo inet loopback

#this has been added:
    allow-hotplug enp4s0
    iface enp4s0 inet static
    address 192.168.1.1
    netmask 255.255.255.0
    network 192.168.1.1
    broadcast 192.168.1.255

然後:sudo nano /etc/netplan/01-network-manager-all.yaml

network:
  version: 2
  renderer: networkd #before, this was NetworkManager
  ethernets:
    enp4s0:
      addresses: [192.168.1.1/24]
      gateway4: 192.168.1.1
      nameservers:
          search: [255.255.255.0]
          addresses: [1.1.1.1, 1.0.0.1, 192.168.1.1]

LS -al /etc/netplan

total 20
drwxr-xr-x   2 root root  4096 Apr 28 18:14 .
drwxr-xr-x 146 root root 12288 Apr 28 18:16 ..
-rw-r--r--   1 root root   506 Apr 28 17:53 01-network-manager-all.yaml

dkms狀態

nvidia, 460.73.01, 5.4.0-72-generic, x86_64: installed

您能指出您認為哪裡不一致嗎?如果有任何遺漏或不清楚的地方,請告訴我。任何提示或幫助將不勝感激。我有 Wifi 卡 Aorus GC-WBAX200,並且在 Ubuntu 18.04 桌面上運行。預先非常感謝

答案1

對於 Ubuntu 桌面...

您的 /etc/network/interfaces 應該是:

auto lo
iface lo inet loopback

您的 /etc/netplan/01-cloud-init.yaml 應該是:

network:
  version: 2
  renderer: NetworkManager

sudo netplan generate

sudo netplan apply

reboot

然後使用 NetworkManager GUI 設定靜態位址(如果需要):

注意:靜態位址不能是路由器的位址(192.168.1.1)。

在此輸入影像描述

相關內容