如何在 ubuntu 18.04 中不使用 ifconfig 更改 MTU?

如何在 ubuntu 18.04 中不使用 ifconfig 更改 MTU?

我需要MTU在新安装的 ubuntu 18.04 中更改大小。这可以通过 来完成ifconfig。但我无法安装ifconfig。每当我运行命令时sudo apt install net-tools,我都会收到以下错误。

Err:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 net-tools amd64 1.60+git20161116.90da8a0-1ubuntu1
  Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/n/net-tools/net-tools_1.60+git20161116.90da8a0-1ubuntu1_amd64.deb  Could not resolve 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

然后我尝试sudo apt-get update并得到以下结果

asif@asif-HP:~$ sudo apt-get update
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease                                                                        
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease                                               
  Could not resolve 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease            
  Could not resolve 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease
  Could not resolve 'archive.ubuntu.com'
Err:6 http://archive.canonical.com/ubuntu bionic InRelease
  Could not resolve 'archive.canonical.com'
Reading package lists... Done           
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/bionic/InRelease  Could not resolve 'archive.canonical.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

实际上,我正在尝试更改 MTU 大小来解决问题Could not resolve 'archive.canonical.com',所以我有点陷入僵局。我现在该怎么办?

注意:我更改了 ubuntu 存档服务器但总是出现同样的错误。

答案1

您可以使用ip,它应该已经安装。例如,

ip link set mtu 1200 eth0

相关内容