8000 When i run the program. Error: network is unreachable · Issue #1223 · mininet/mininet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
When i run the program. Error: network is unreachable #1223
Open
@KMS07

Description

@KMS07
from mininet.net import Mininet
from mininet.node import Host, Node
from mininet.cli import CLI
from mininet.link import TCLink

def ipv6_to_ipv4_tunnel():
    net = Mininet()

    # IPv6 hosts
    h1 = net.addHost('h1', ip6='2001:db8:1::1/64', ipv6_default=True)
    h2 = net.addHost('h2', ip6='2001:db8:1::2/64', ipv6_default=True)

    # IPv4 host
    h3 = net.addHost('h3', ip='192.168.1.10/24', defaultRoute='via 10.0.0.1')

    # Router for 6to4 tunnel
    r0 = net.addHost('r0', cls=Node, ip='172.16.0.1/30')

    # Links (h1, h2 connect to router with IPv6)
    net.addLink(h1, r0, intfName1='h1-eth0', intfName2='r0-eth0', params1={'ip': '2001:db8:1::1/64'}, params2={'ip': '2001:db8:1::2/64'}, ipv6=True)
    net.addLink(h2, r0, intfName1='h2-eth0', intfName2='r0-eth1', params1={'ip': '2001:db8:1::2/64'}, params2={'ip': '2001:db8:1::1/64'}, ipv6=True)

    # Link between router and h3 (uses IPv4)
    net.addLink(r0, h3, intfName1='r0-eth2', params1={'ip': '172.16.0.1/30'}, params2={'ip': '192.168.1.1/24'}, ipv4=True, cls=TCLink, bw=10)

    # Configure 6to4 tunnel on router
    r0.cmd('ip tunnel add tun0 mode sit remote 192.0.2.1 local 192.0.2.2')
    r0.cmd('ip link set dev tun0 up')
    r0.cmd('ip addr add 2002:beef::1/64 dev tun0')
    r0.cmd('ip -6 route add ::/0 via 2002:c000:201::1 dev tun0')

    net.start()

    # Add default routes for h1 and h2
    h1.cmd('route add default gw 172.16.0.1')
    h2.cmd('route add default gw 172.16.0.1')

    # Test ping between IPv6 and IPv4 hosts
    print(h1.cmd('ping 192.168.1.10 -c 4'))
    print(h3.cmd('ping6 2001:db8:1::1 -c 4'))

    CLI(net)

    net.stop()

if __name__ == '__main__':
    ipv6_to_ipv4_tunnel()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0