我想用 Python 对 Linux 内核进行流量控制,以模拟丢失、损坏和重复的包。我已经能够使用 Linux 终端进行配置,但我必须使用 python。
bash cmd 的工作原理:
tc filter show dev eth1
蟒蛇不起作用:
>>> subprocess.call(["tc", "filter", "show", "dev", "eth1"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
谢谢。