暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openEuler环境下修改网卡MTU值

原创 Nightingale 2023-02-04
2343

打算在openEuler上安装openGauss,在环境准备阶段遇到了修改MTU值的需求,特此记录。

什么是MTU?为什么MTU值普遍都是1500?-阿里云开发者社区 (aliyun.com)

方式1.

通过/sys/class/net/ens32/mtu 查询、修改MTU

[root@localhost ~]# echo "8192" > /sys/class/net/ens32/mtu [root@localhost ~]# [root@localhost ~]# cat /sys/class/net/ens32/mtu 8192 [root@localhost ~]#

方式2

安装ifconfig

ifconfig命令是设置或显示网络接口的程序,可以显示出我们机器的网卡信息,网络相关的命令都在net-tools下,只要安装net-tools即可 。
openEuler默认没有安装net-tools,不能使用ifconfig查看网络配置,需要单独安装。

[root@localhost ~]# yum search ifconfig Last metadata expiration check: 1:03:26 ago on Fri 03 Feb 2023 11:04:22 AM CST. =========================================================================== Summary Matched: ifconfig =========================================================================== python-ifcfg.src : Python Ifconfig Wrapper for Unix/Linux/MacOSX python3-ifcfg.noarch : Python Ifconfig Wrapper for Unix/Linux/MacOSX [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# yum -y install ifconfig Last metadata expiration check: 1:04:07 ago on Fri 03 Feb 2023 11:04:22 AM CST. No match for argument: ifconfig Error: Unable to find a match: ifconfig [root@localhost ~]# [root@localhost ~]# yum install net-tools.x86_64 Last metadata expiration check: 1:04:51 ago on Fri 03 Feb 2023 11:04:22 AM CST. Dependencies resolved. ================================================================================================================================================================================= Package Architecture Version Repository Size ================================================================================================================================================================================= Installing: net-tools x86_64 2.10-3.oe2203 update 200 k Transaction Summary ================================================================================================================================================================================= Install 1 Package Total download size: 200 k Installed size: 881 k Is this ok [y/N]: y Downloading Packages: net-tools-2.10-3.oe2203.x86_64.rpm 378 kB/s | 200 kB 00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 371 kB/s | 200 kB 00:00 retrieving repo key for update unencrypted from http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler update 12 kB/s | 2.1 kB 00:00 Importing GPG key 0xB25E7F66: Userid : "private OBS (key without passphrase) " Fingerprint: 12EA 74AC 9DF4 8D46 C69C A0BE D557 065E B25E 7F66 From : http://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : net-tools-2.10-3.oe2203.x86_64 1/1 Running scriptlet: net-tools-2.10-3.oe2203.x86_64 1/1 Verifying : net-tools-2.10-3.oe2203.x86_64 1/1 Installed: net-tools-2.10-3.oe2203.x86_64 Complete! [root@localhost ~]#

通过ifconfig查看mtu

[root@localhost ~]# ifconfig ens32: flags=4163 mtu 8192 inet 192.168.43.89 netmask 255.255.255.0 broadcast 192.168.43.255 inet6 2408:845c:a300:2b10:914c:f5c7:45b7:afea prefixlen 64 scopeid 0x0 inet6 fe80::7ae:a8ea:8499:8f19 prefixlen 64 scopeid 0x20 ether 00:0c:29:68:19:af txqueuelen 1000 (Ethernet) RX packets 56654 bytes 67010456 (63.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30647 bytes 2352315 (2.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) 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 [root@localhost ~]#

通过ifconfig修改mtu

[root@localhost ~]# ifconfig ens32 mtu 9000 up [root@localhost ~]# [root@localhost ~]# ifconfig ens32: flags=4163 mtu 9000 inet 192.168.43.89 netmask 255.255.255.0 broadcast 192.168.43.255 inet6 2408:845c:a300:2b10:914c:f5c7:45b7:afea prefixlen 64 scopeid 0x0 inet6 fe80::7ae:a8ea:8499:8f19 prefixlen 64 scopeid 0x20 ether 00:0c:29:68:19:af txqueuelen 1000 (Ethernet) RX packets 57814 bytes 67115923 (64.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 31560 bytes 2439367 (2.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) 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 [root@localhost ~]#

方式3.

通过/etc/sysconfig/network-scripts/ifconig-eth0 查询、修改MTU.

通过ifconfig-eth0修改MTU

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32 [root@localhost ~]# [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 | grep MTU MTU=8192 [root@localhost ~]#
重启网络服务

openEuler使用NetworkManager工具管理网络,没有network服务。

[root@localhost ~]# systemctl restart network Failed to restart network.service: Unit network.service not found. [root@localhost ~]#
[root@localhost ~]# systemctl restart NetworkManager [root@localhost ~]# [root@localhost ~]# ifconfig ens32: flags=4163 mtu 8192 inet 192.168.43.89 netmask 255.255.255.0 broadcast 192.168.43.255 inet6 2408:845c:a300:2b10:914c:f5c7:45b7:afea prefixlen 64 scopeid 0x0 inet6 fe80::7ae:a8ea:8499:8f19 prefixlen 64 scopeid 0x20 ether 00:0c:29:68:19:af txqueuelen 1000 (Ethernet) RX packets 58666 bytes 67195104 (64.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 32273 bytes 2517947 (2.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) 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 [root@localhost ~]#
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论