当我在 Ubuntu Server 20.04 中使用 Netplan 设置静态 IP 时,我遇到了互联网速度问题。
我使用的是戴尔 PowerEdge R710,没有 wifi 卡,所以我在论坛中找到的所有涉及 wifi 的解决方案都不起作用。我还尝试了 Netplan 中的一些其他配置以及我在论坛中找到的其他建议,但它确实没有用。
如果我禁用静态 IP 并让它动态,互联网速度就可以了。有谁知道如何解决这个问题?
这是我的50-cloud-init.yaml
aiec@camera02:/etc/netplan$ sudo nano 50-cloud-init.yaml
network:
renderer: networkd
ethernets:
eno1:
dhcp4: no
addresses: [192.168.253.188/24]
gateway4: 192.168.253.1
optional: true
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2
速度测试结果(如果我使用动态 IP,速度会达到 40~45 Mbits/s)
aiec@camera02:/etc/netplan$ speedtest
Retrieving speedtest.net configuration...
Testing from Live Telecom (177.66.74.126)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by StarFibra Telecomunicações (Foz do Iguaçu) [4.05 km]: 58.244 ms
Testing download speed................................................................................
Download: 2.12 Mbit/s
Testing upload speed......................................................................................................
Upload: 1.37 Mbit/s
和ifconfig -a
aiec@camera02:/etc/netplan$ ifconfig -a
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.253.188 netmask 255.255.255.0 broadcast 192.168.253.255
inet6 fe80::be30:5bff:fefe:671 prefixlen 64 scopeid 0x20<link>
ether bc:30:5b:fe:06:71 txqueuelen 1000 (Ethernet)
RX packets 162999 bytes 174965858 (174.9 MB)
RX errors 0 dropped 6421 overruns 0 frame 0
TX packets 78785 bytes 42246324 (42.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno2: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether bc:30:5b:fe:06:73 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=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether bc:30:5b:fe:06:75 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=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether bc:30:5b:fe:06:77 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
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 1084 bytes 96330 (96.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1084 bytes 96330 (96.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
好的,所以,在与一些朋友交谈后,我们发现了问题。其实很简单。
问题出在网关上。当我使用命令netstat -rn时,它返回:
网关必须以.254结束,插入0.1。
因此,对我来说使用网络计划的正确方法是输入gateway4: 192.168.253.254。
现在,我的netstat -rn,返回:
就是这样。感谢那些试图帮助我的人。
您可能通过 DHCP 接收到的各种其他设置会影响吞吐量。如果 IP 地址和网关地址相同,接下来要看的是 MTU。如果您的默认 MTU 太大,您的吞吐量可能会因数据包碎片而降低。