我正在尝试运行containernet_example.py文件(在这里,我用我的停靠映像修改了2个对接者映像主机),使用ONOS作为我的拓扑控制器。
当我通过localhost:8181/onos/ui/login.html访问ONOS页面时,我无法访问主机,即UI页面中的docker映像。我的意思是,拓扑并不显示在onos页面中,而是显示在容器网络CLI中,ping对主机起作用。我使用的命令是:
sudo mn --controller remote,ip=MYIPADDRESS --switch=ovsk,protocols=OpenFlow13 --custom containernet_example.py然而,如果我尝试像树这样的标准拓扑,我就能够访问这些拓扑。我想在onos中使用那些码头映像作为主机,以及在容器中使用cli。
我读了这么多帖子,但我解决不了这个问题。任何洞察力都会有帮助。提前谢谢。
发布于 2022-05-11 14:15:24
用于此操作的代码是从另一个StackOverflow链接中获取的,我无法标记该链接,因为我无法准确地对页面进行书签。下面是为我工作的代码,在作为容器网络主机的2个码头映像的情况下。
from mininet.net import Containernet
from mininet.node import Controller, OVSKernelSwitch, RemoteController
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import info, setLogLevel
setLogLevel('info')
net = Containernet(controller=RemoteController, switch=OVSKernelSwitch) #remote controller
info('*** Adding controller\n')
net.addController('c0', controller=RemoteController, ip= 'MYIPADDRESS', port= 6653)
info('*** Adding docker containers\n')
d1 = net.addDocker('d1', ip='10.0.0.251', dimage="myimage1:myimagetag")
d2 = net.addDocker('d2', ip='10.0.0.252', dimage="myimage2:myimagetag")
info('*** Adding switches\n')
s1 = net.addSwitch('s1', protocols= "OpenFlow13") #mentioning protocol
info('*** Creating links\n')
net.addLink(d1, s1)
net.addLink(d2, s1)
info('*** Starting network\n')
net.start()
info('*** Testing connectivity\n')
net.ping([d1, d2,])
info('*** Running CLI\n')
CLI(net)
info('*** Stopping network')
net.stop()我使用的命令是简单的sudo python3 myfilename.py。
https://stackoverflow.com/questions/72198682
复制相似问题