在ubuntu中,如何在不使用ifconfig的情况下更改MTU?

分享于 

3分钟阅读

ubuntu

  繁體

问题:

我需要更改ubuntu中的MTU大小,这可以用ifconfig完成,但我无法安装ifconfigsudo 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.




Could not resolve 'archive.canonical.com'


答案1:


# ip link set dev eth0 mtu 1400




答案2:

在GUI中更改MTU:转到网络设置->单击首选网络接口>在那里可以更改MTU



network  Ubuntu  网络  ifc  MTU  Ifconfig