Python:协议不支持的地址族

问题描述 投票:0回答:1

Python代码:

def main():
    setLogLevel('info')
    net = Mininet(switch=LinuxBridge, controller=None)
    h1 = net.addHost('h1', ip=None)
    h2 = net.addHost('h2', ip=None)
    s0 = net.addSwitch('s0')
    s1 = net.addSwitch('s1')
    s2 = net.addSwitch('s2')
    r1 = net.addHost('r1', ip=None)
    r1.cmd('sysctl -w net.ipv6.conf.all.forwarding=1')
    r2 = net.addHost('r2', ip=None)
    r2.cmd('sysctl -w net.ipv6.conf.all.forwarding=1')

    net.addLink(h1, s1)
    net.addLink(r1, s1)
    net.addLink(r1, s0)
    net.addLink(r2, s0)
    net.addLink(r2, s2)
    net.addLink(h2, s2)

    h1.cmd("ip -6 addr add 2001:638:709:a::1/64 dev h1-eth0")
    h2.cmd("ip -6 addr add 2001:638:709:b::1/64 dev h2-eth0")
    r1.cmd("ip -6 addr add 2001:638:709:a::f/64 dev r1-eth0")
    r1.cmd("ip -6 addr add 2001:638:709:f::1/64 dev r1-eth1")
    r2.cmd("ip -6 addr add 2001:638:709:f::2/64 dev r2-eth0")
    r2.cmd("ip -6 addr add 2001:638:709:b::f/64 dev r2-eth1")

    h1.cmd("ip -6 route add 2001:638:709::/48 via 2001:638:709:a::f dev h1-eth0")
    r1.cmd("ip -6 route add 2001:638:709:b::/64 via 2001:638:709:f::2 dev r1-eth1")
    r2.cmd("ip -6 route add 2001:638:709:a::/64 via 2001:638:709:f::1 dev r2-eth0")
    h2.cmd("ip -6 route add 2001:638:709::/48 via 2001:638:709:b::f dev h2-eth0")

    net.start()
    CLI(net)
    net.stop()

在mininet上运行此代码后,我需要执行

h1 ping6 2001:638:709:b::1

但是,如标题中所述,我不断收到不支持地址族的错误。

python networking network-programming ping mininet
1个回答
0
投票

您能具体指出何时出现此错误吗?在执行Mininet拓扑脚本或尝试ping时是否看到此错误?

© www.soinside.com 2019 - 2024. All rights reserved.