I am trying to dynamically add Hosts and Links after Mininet Startup. I am using the py net.addHost,addLink commands.
Using the standard linear,3 Topology
The code is:
py net.addHost('h4')
py net.addLink(h4,s3)
py h4.setMAC("00:30:00:00:30:10")
py h4.configDefault(defaultRoute = h4.defaultIntf())
The last statement ensures h4 has a valid IP address. On running ifconfig on h4:
mininet> h4 ifconfig
h4-eth0 Link encap:Ethernet HWaddr 00:30:00:00:30:10
inet addr:10.0.0.4 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::230:ff:fe00:3010/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4001 (4.0 KB) TX bytes:1296 (1.2 KB)
Pinging h4 from h1 (part of the static topology):
mininet> h1 ping h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
Pinging between static topology nodes (h1 and h3):
mininet> h1 ping h3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=2.14 ms
64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.141 ms
Any help will be appreciated!
You were almost there! All you needed to do was:
mininet> py s1.attach('s3-eth3')
then:
mininet> h1 ping h4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_req=1 ttl=64 time=2.99 ms
64 bytes from 10.0.0.4: icmp_req=2 ttl=64 time=0.113 ms
Found the answer here .
Try adding this flag to your 'mn' command to make it use openflow v1.3. It could be using v1.0 by default.
--switch ovsk,protocols=OpenFlow13
ie Append the above line while running the mininet:
sudo mn --switch ovsk,protocols=OpenFlow13
for custom topologies:
sudo mn --custom ~/<filename>.py --topo mytopo --link tc --switch ovsk,protocols=OpenFlow13
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.