and tc use linux netem analog network anomaly (a) the

To get started just this time, looked online, on several commands, that is very simple, I did not expect twists and turns behind is now recording from memory a little bit.

Netem with a brief description of TC

Netem is a network simulator module Linux 2.6 kernel version and more to offer. This function module can be used in the good performance of the LAN, Internet simulate complex transmission performance. For example: low bandwidth, transmission delay, packet loss and so the situation. Use Linux 2.6 (or above) versions of many Linux kernel distributions are enabled by default the kernel module, such as: Fedora, Ubuntu, Redhat, OpenSuse, CentOS, Debian, and so on.

TC is a tool user mode Linux system, full name Traffic Control (flow control). TC can be used to control the operating mode Netem module, that is to say if you want to use Netem at least two conditions, one Netem kernel module is enabled, the other is to have a user mode corresponding to the tool TC.

First we looked at the linux version of the virtual machine currently in use, Fedora 9, Linux 2.6.

Direct Input terminal: tc qdisc show, show mistakes.

Viewing the kernel configuration, make menuconfig

Networking -->
   Networking Options -->
     QoS and/or fair queuing -->
        Network emulator
make install没有成功,后面还专门去官网下载了LINUX 3.2的版本尝试,总是各种问题。
后来决定下载最新的fedora 29,一切从头开始。(省略中间很多步......)
Fedora 29配置完成之后,试了一下tc qdisc show,显示正常。
输入延迟或者丢包的命令,就会报错误:RTNETLINK answers: No such file or directory (中间的各种尝试其实都报这个错误,只是一直没找到解决办法,换了最新版之后还是这个问题)
后来看到文章说:To properly use qdiscs, install the kernel-modules-extra package。就是说内核中没有集成kernel-modules-extra 包,需要手动安装。
输入:yum install kernel-modules-extra 进行安装,中间可能由于网络原因出现安装不成功,后来再次安装就好了。
安装完毕再次输入命令,RTNETLINK answers: No such file or directory的错误就没有了,以为后面就没问题了。
$:tc qdisc show (打印正常)
$tc qdisc add dev ens33 root netem delay 100ms 报错:Error:Exclusivity flag on, cannot modify
虽然看懂了大概意思,但是实在不知道是什么原因,网上也基本上找不到相关的解决办法。
偶然间输入命令
$:tc qdisc change dev ens33 root netem delay 100ms 成功
$:tc qdisc change dev ens33 root netem loss 50% 成功
ping主机网络确实有丢包,当时想想实在不行就用change命令吧,也好使,继续查资料看到:
add 表示为指定网卡添加 Netem 配置,change 表示修改已经存在的 Netem 配置到新的值,replace 表示替换已经存在的 Netem 配置的值。
如果要删除网卡上的 Netem 配置可以使用 del:$ tc qdisc del dev enp0s5 root
看到这里大概明白了,netem配置已经存在,所以使用add会报错,只能用change。
怀着忐忑的心情把netem配置删除(实在是小白,害怕删除配置又会出别的问题)
再次输入add命令:$tc qdisc add dev ens33 root netem delay 100ms 成功。

目前第一步算是完成了,描述可能比较混乱,只是希望自己做个记录或者给遇到同样问题的朋友一点点帮助。

Guess you like

Origin www.cnblogs.com/little-monica/p/11459772.html