Example #1
0
cn_i1 = EthernetInterface(cn, 'cn_i1')


ar_i1.ipv6.icmpv6.set_prefix_list([('2000::',64)])
ar_i2.ipv6.icmpv6.set_prefix_list([('2001::',64)])



ha_i1.ipv6.manual_addresses=['2001::100']
ha_i1.ipv6.icmpv6.set_prefix_list([('2001::',64)])
ha_i2.ipv6.manual_addresses=['2002::100']
ha_i2.ipv6.icmpv6.set_prefix_list([('2002::',64)])

cn_i1.ipv6.manual_addresses=['2002::1']

ha_i1_addr = mac2linklocal(ha_i1.mac)
ar_i2.ipv6.manual_route_add('::', ar_i2, 0, next_hop = ha_i1_addr)
ar_i2_addr = mac2linklocal(ar_i2.mac)
ha_i1.ipv6.manual_route_add('::', ha_i1, 0, next_hop = ar_i2_addr)


cable1 = EthernetCable(world)
cable2 = EthernetCable(world)
cable3 = EthernetCable(world)

ap1.ethernet_iface.connect(cable1)
ar_i1.connect(cable1)

ar_i2.connect(cable2)
ha_i1.connect(cable2)
Example #2
0
ha_i1 = EthernetInterface(ha, 'ha_i1', channel = cable3)
ha_i2 = EthernetInterface(ha, 'ha_i2', channel = cable4)
cn_i1 = EthernetInterface(cn, 'cn_i1', channel = cable4)

ar_i1.ipv6.icmpv6.set_prefix_list([('2000:1::',64)])
ar_i2.ipv6.icmpv6.set_prefix_list([('2000:2::',64)])
ar_i3.ipv6.icmpv6.set_prefix_list([('2001::',64)])

ha_i1.ipv6.manual_addresses=['2001::100']
ha_i1.ipv6.icmpv6.set_prefix_list([('2001::',64)])
ha_i2.ipv6.manual_addresses=['2002::100']
ha_i2.ipv6.icmpv6.set_prefix_list([('2002::',64)])

cn_i1.ipv6.manual_addresses=['2002::1']

ha_i1_addr = mac2linklocal(ha_i1.mac)
ar_i3.ipv6.manual_route_add('::', ar_i3, 0, next_hop = ha_i1_addr)
ar_i3_addr = mac2linklocal(ar_i3.mac)
ha_i1.ipv6.manual_route_add('::', ha_i1, 0, next_hop = ar_i3_addr)

mn.start()
ap1.start()
ar.start()
ha.start()
cn.start()


wf = WhiteFountain(mn, '2002::1', None, 'wf')
am = AnsweringMachine(cn, 'am')

# world.monitor.watch(lambda: wf.i, "wf sent", 'red')