因此,当我在主虚拟机中输入此命令时,只会出现此错误:
sudo tc qdisc add dev eth0 root netem delay 97ms
RTNETLINK answers: File exists
有什么办法可以解决这个问题吗?
我在 Ubuntu 中运行这个命令:
uname -a
Linux anmol-vm1-new 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@anmol-vm1-new:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
以下是文件的内容/etc/network/interfaces
:
auto lo
iface lo inet loopback
source /etc/network/interfaces.d/*.cfg
ls /etc/network/interfaces.d/
eth0.cfg
以下是我所拥有的/etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet dhcp
此外我还收到以下错误:
ubuntu@anmol-vm1-new:/home/hadoop/yarnpp/workloads/RESULTS$ tc qdisc change dev eth0 root netem delay 100ms
RTNETLINK answers: Operation not permitted
ubuntu@anmol-vm1-new:/home/hadoop/yarnpp/workloads/RESULTS$ sudo tc qdisc change dev eth0 root netem delay 100ms
RTNETLINK answers: Invalid argument
你可能还想看看这个StackOverflow 问题我曾要求限制带宽。
ifconfig -a
eth0 Link encap:Ethernet HWaddr fa:16:3e:b4:22:7c
inet addr:10.0.1.190 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:feb4:227c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1454 Metric:1
RX packets:603022138 errors:0 dropped:0 overruns:0 frame:0
TX packets:132788011 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:633486216278 (633.4 GB) TX bytes:798520828666 (798.5 GB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:367293839 errors:0 dropped:0 overruns:0 frame:0
TX packets:367293839 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:547056723183 (547.0 GB) TX bytes:547056723183 (547.0 GB)
答案1
解决方案如下:
sudo tc qdisc del dev eth0 root
sudo tc qdisc add dev eth0 root netem delay 100ms
答案2
更短的解决方案:
sudo tc qdisc replace dev eth0 root netem delay 100ms