(no commit message)
[wiki] / examples / ipv6-network.mdwn
1 [[!meta title="setting up an IPv6 network managed by tinc"]]
2
3 ## Example: IPv6 Networking
4
5 Michael Adams, 8-27-2007  
6 http://www.wolfsheep.com/
7
8 ### Purpose
9
10 This document is to highlight an example setup for using tinc to create an IPv6 network.
11
12 ### Example Layout
13
14 [[!img examples/fig-ipv6-network.png link=examples/fig-ipv6-network.dia]]
15 *Click on the image for the original [DIA](http://en.wikipedia.org/wiki/Dia_(software)) file.*
16
17 ### Scenario Parameters
18
19 1. IPv6 is provided via a native or tunnel-brokered service at a main site. If you need a tunnel, refer to Wikipedia's list of IPv6 tunnel brokers.
20 2. The IPv6 allocation given is 2001:db8:beef::/48, using a tunnel from 2001:db8:dead:beef::1 to 2001:db8:dead:beef::2.
21 3. All the tinc connections share a subnet of 2001:db8:beef:0::/64, and their addresses are tied to 2001:db8:beef:(subnet #)::/64 allocations. For example, "routerc" will listen on tinc at 2001:db8:beef::3, will have a LAN address of 2001:db8:beef:3::1, and a subnet of 2001:db8:beef:3::/64.
22 4. All the routers and servers using tinc connect over the IPv4 Internet, using WAN addresses based on 192.0.2.0/24. "routerc" uses 192.0.2.3.
23 5. "routera" is a Linux server that manages the #1 subnet, and makes the connection to the IPv6 Internet.
24 6. All other routers are assumed to be Linux based for their TUN/TAP support of bridged-Ethernet. 
25
26 ### Configuration Files
27
28 1. On Debian/Ubuntu systems, an entry in "/etc/network/interfaces" can be used to statically assign the ::1 address for the local LAN. Example:
29 >       iface eth1 inet6 static
30 >               address 2001:db8:beef::1::1
31 >               netmask 64
32 >               mtu 1280
33   On non Debian/Ubuntu systems, a line can be put in a boot script, such as "ip -6 addr add 2001:db8:beef:1::1/64 dev eth1".
34
35 2. IPv6 forwarding needs to be enabled: put "echo "1" >/proc/sys/net/ipv6/conf/all/forwarding" in a boot script, or "net.ipv6.conf.all.forwarding = 1" in "/etc/sysctl.conf".
36
37 3. This setup uses tinc's "switch" mode: subnets are not assigned in the host files; only Address (for ConnectTo targets only) and the key are required in host files.
38
39 4. It is assumed that the config files go into something like "/etc/tinc/link" and "/etc/tinc/nets.boot" has an entry for "link". The following table can be used to guide configuration of routers:
40   * "routera" configuration for tinc (the master router):
41 >      >cat tinc.conf
42 >      Name = routera
43 >      Device=/dev/net/tun
44 >      TCPOnly = on
45 >      PMTU = 1280
46 >      PMTUDiscovery = yes
47 >      Mode = switch
48 >      Interface = vpn6
49 >     
50 >      >cat tinc-up
51 >      #!/bin/sh
52 >      #Enable tinc
53 >      ip -6 link set vpn6 up mtu 1280 txqueuelen 1000
54 >      ip -6 addr add 2001:db8:beef::1/64 dev vpn6
55 >      ip -6 route add 2001:db8:beef::/48 dev vpn6
56 >      #Static routing table
57 >      ip -6 route add 2001:db8:beef:2::/64 via 2001:db8:beef::2
58 >      ip -6 route add 2001:db8:beef:3::/64 via 2001:db8:beef::3
59 >      ip -6 route add 2001:db8:beef:4::/64 via 2001:db8:beef::4
60 >     
61 >      >cat tinc-down
62 >      #!/bin/sh
63 >      #Static routing table
64 >      ip -6 route del 2001:db8:beef:2::/64 via 2001:db8:beef:::2
65 >      ip -6 route del 2001:db8:beef:3::/64 via 2001:db8:beef:::3
66 >      ip -6 route del 2001:db8:beef:4::/64 via 2001:db8:beef:::4
67 >      #Disable tinc
68 >      ip -6 route del 2001:db8:beef::/48 dev vpn6
69 >      ip -6 addr del 2001:db8:beef::1/64 dev vpn6
70 >      ip -6 link set vpn6 down
71 >     
72   * "routerb" configuration for tinc (the other non-master routers will be like this one):
73 >      >cat tinc.conf
74 >      Name=routerb
75 >      Device=/dev/net/tun
76 >      TCPOnly = yes
77 >      PMTU = 1280
78 >      PMTUDiscovery = yes
79 >      Mode = switch
80 >      Interface = vpn6
81 >      ConnectTo = routera
82 >     
83 >      >cat tinc-up
84 >      #!/bin/sh
85 >      ip -6 link set vpn6 up mtu 1280
86 >      ip -6 addr add 2001:db8:beef::2/64 dev vpn6
87 >      ip -6 route add default via 2001:db8:beef::1
88 >     
89 >      >cat tinc-down
90 >      #!/bin/sh
91 >      ip -6 route del default via 2001:db8:beef::1
92 >      ip -6 addr del 2001:db8:beef::2/64 dev vpn6
93 >      ip -6 link set vpn6 down
94
95 5. You can use [radvd](http://www.litech.org/radvd/) or [Quagga](http://www.quagga.net/) to perform [stateless address autoconfiguration](http://www.ietf.org/rfc/rfc2462.txt) on your LAN. This is an example zebra.conf for LAN autoconfiguration (don't forget to enable the zebra daemon):
96 >      ipv6 forwarding
97 >      !
98 >      interface eth1
99 >       no ipv6 nd suppress-ra
100 >       ipv6 address 2001:db8:beef:1::1/64
101 >       ipv6 nd prefix 2001:db8:beef:1::/64
102 >       ipv6 nd ra-interval 10
103 >      !
104 >      interface vpn6
105 >      !
106 >      interface lo
107