I am trying to specify packet loss by tc command on interface (port) 1 of switch part of network I have created using mininet :
sudo tc qdisc change dev s1-eth1 root netem loss 0.1%
but gettring error:
RTNETLINK answers: Invalid argument
Any help would be appreciated.
Network Details:
It is a tree topology based mininet network on Ubuntu 14.04 with depth = 2 and fanout = 5. On first level, a switch is connected to 5 switches which are connected to 5 hosts each. All switches are OpenvSwitch.
Mininet network:
#!/usr/bin/python
from functools import partial
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import setLogLevel
from mininet.net import Mininet
from mininet.node import OVSKernelSwitch
from mininet.node import RemoteController
from mininet.topo import Topo
from mininet.util import dumpNodeConnections
class MyNet( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts
h1 = self.addHost( 'h1' )
h2 = self.addHost( 'h2' )
h3 = self.addHost( 'h3' )
h4 = self.addHost( 'h4' )
h5 = self.addHost( 'h5' )
h6 = self.addHost( 'h6' )
h7 = self.addHost( 'h7' )
h8 = self.addHost( 'h8' )
h9 = self.addHost( 'h9' )
h10 = self.addHost( 'h10' )
h11 = self.addHost( 'h11' )
h12 = self.addHost( 'h12' )
h13 = self.addHost( 'h13' )
h14 = self.addHost( 'h14' )
h15 = self.addHost( 'h15' )
h16 = self.addHost( 'h16' )
h17 = self.addHost( 'h17' )
h18 = self.addHost( 'h18' )
h19 = self.addHost( 'h19' )
h20 = self.addHost( 'h20' )
h21 = self.addHost( 'h21' )
h22 = self.addHost( 'h22' )
h23 = self.addHost( 'h23' )
h24 = self.addHost( 'h24' )
h25 = self.addHost( 'h25' )
# Add switches
s1 = self.addSwitch( 's1' )
s2 = self.addSwitch( 's2' )
s3 = self.addSwitch( 's3' )
s4 = self.addSwitch( 's4' )
s5 = self.addSwitch( 's5' )
s6 = self.addSwitch( 's6' )
# Add links
self.addLink( s2, s1 ,bw=0.1)
self.addLink( s3, s1 ,bw=10)
self.addLink( s4, s1 ,bw=10)
self.addLink( s5, s1 ,bw=10)
self.addLink( s6, s1 ,bw=100)
self.addLink( h1, s2 ,bw=0.1)
self.addLink( h2, s2 ,bw=10)
self.addLink( h3, s2 ,bw=10)
self.addLink( h4, s2 ,bw=10)
self.addLink( h5, s2 ,bw=10)
self.addLink( h6, s3 ,bw=10)
self.addLink( h7, s3 ,bw=10)
self.addLink( h8, s3 ,bw=10)
self.addLink( h9, s3 ,bw=10)
self.addLink( h10, s3 ,bw=10)
self.addLink( h11, s4 ,bw=10)
self.addLink( h12, s4 ,bw=10)
self.addLink( h13, s4 ,bw=10)
self.addLink( h14, s4 ,bw=10)
self.addLink( h15, s4 ,bw=10)
self.addLink( h16, s4 ,bw=10)
self.addLink( h17, s4 ,bw=10)
self.addLink( h18, s4 ,bw=10)
self.addLink( h19, s4 ,bw=10)
self.addLink( h20, s4 ,bw=10)
self.addLink( h21, s6 ,bw=10)
self.addLink( h22, s6 ,bw=10)
self.addLink( h23, s6 ,bw=10)
self.addLink( h24, s6 ,bw=10)
self.addLink( h25, s6 ,bw=100)
topos = { 'MyNet': ( lambda: MyNet() ) }
#sudo mn --custom MyNet.py --topo MyNet --controller=remote,ip=10.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13 --link tc
As per this link, it seems that mininet uses tc
commands to set packet loss
, delay
etc. internally.
It tries to overwrite the qdisc file, therefore, it errors RTNETLINK answers: Invalid argument
.
To set packet loss set it in mininet
script itself by using loss
parameter while creaqting a link. For an example see this.