Difference between revisions of "Setup IPv6 subnets on Linux"
(Created page with "This is a guide on how to delegate a he.net IPv5 /48 subnet into multiple smaller networks that you can route and manage on your own network. This uses Linux as the base. Thi...") |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
The two networks I'm setting up now are: | The two networks I'm setting up now are: | ||
Subnet #1: 2001:450:bb44::/117 | Subnet #1: 2001:450:bb44::/117 - main subnet, router #1 needs to route subnet #2 to router #2 | ||
Subnet #2: 2001:450:bb44::800/117 | Subnet #2: 2001:450:bb44::800/117 - subnet connected to a router #2 which is behind subnet #1 | ||
== Router for subnet #1 == | == Router for subnet #1 == | ||
External router IP: 2001:470:17:1e5::2/64 | External (eth0) router IP: 2001:470:17:1e5::2/64 | ||
Default gateway: 2001:470:17:1e5::1/128 | Default gateway: 2001:470:17:1e5::1/128 | ||
Internal (eth1) router IP: 2001:450:bb44::1/117 | |||
ip -6 route add 2001:470:17:1e5::2/64 via 2001:470:17:1e5::1 dev eth0 | |||
Add route 2001:450:bb44::801/117 via 2001:450:bb44::29 (this is another internal router) | Add route 2001:450:bb44::801/117 via 2001:450:bb44::29 (this is another internal router) | ||
ip -6 route add 2001:450:bb44::801/117 via 2001:450:bb44::29 eth1 | ip -6 route add 2001:450:bb44::801/117 via 2001:450:bb44::29 dev eth1 | ||
== Hosts behind subnet #1 == | == Hosts behind subnet #1 == | ||
Calculate or use https://www.ultratools.com/tools/ipv6CIDRToRange to convert the CIDR to the actual range. | |||
Host IP: pick one between 2001:470:27:2d5::2 to 2001:470:27:2d5::7ff | Host IP: pick one between 2001:470:27:2d5::2 to 2001:470:27:2d5::7ff | ||
Default gateway: 2001:450:bb44::1/ | Netmask/block size: 117 | ||
Default gateway: 2001:450:bb44::1 | |||
Manually assign addresses to the hosts or use ''DHCPv6'' to automate the process - ''radvd'' won't work since it requires /64 subnets. | |||
== Router for subnet #2 == | == Router for subnet #2 == | ||
External router IP: 2001:450:bb44::29/117 | External (eth0) router IP: 2001:450:bb44::29/117 | ||
Default gateway: 2001:450:bb44::1/117 | Default gateway: 2001:450:bb44::1/117 | ||
Internal (eth1) router IP: 2001:450:bb44::801/117 | |||
ip -6 route add 2001:450:bb44::29/117 via 2001:450:bb44::1 dev eth0 | |||
Enable IPv6 forwarding: | Enable IPv6 forwarding: | ||
Line 53: | Line 61: | ||
Host IP: pick one between 2001:470:27:2d5::802 to 2001:470:27:2d5::fff | Host IP: pick one between 2001:470:27:2d5::802 to 2001:470:27:2d5::fff | ||
Default gateway: 2001:450:bb44::801/ | Netmask/block size: 117 | ||
Default gateway: 2001:450:bb44::801 | |||
Manually assign addresses to the hosts or use ''DHCPv6'' to automate the process - ''radvd'' won't work since it requires /64 subnets. | |||
== Delete/remove subnets and host addresses == | == Delete/remove subnets and host addresses == | ||
Find addresses/subnets: | |||
route -n -6 | |||
ifconfig | |||
Remove them: | |||
ip -6 route del 2001:450:bb44::/64 dev eth0 | ip -6 route del 2001:450:bb44::/64 dev eth0 | ||
ip -6 addr del 2001:450:bb44::1 | ip -6 addr del 2001:450:bb44::1 dev eth0 | ||
== Test connectivity == | |||
From subnet #2 ping router #1: | |||
ping9 2001:450:bb44::1 | |||
Find IPv6 aaaa record from DNS: | |||
dig google.com aaaa | |||
== References == | |||
* [http://computer-outlines.over-blog.com/article-static-ipv6-networking-part-3-2-routers-setup-118288208.html Static IPv6 Networking Part 3 : 2 Routers setup] | |||
* [https://www.jumpingbean.co.za/blogs/mark/set-up-ipv6-lan-with-linux Set up IPv6 LAN with Linux] | |||
* [http://teamarin.net/2014/12/15/set-ipv6-home/ Set IPv6 home] |
Latest revision as of 10:32, 24 May 2017
This is a guide on how to delegate a he.net IPv5 /48 subnet into multiple smaller networks that you can route and manage on your own network. This uses Linux as the base.
This is a necessary if you want to run IPv4 on another router that can't handle IPv6 for some reason, this adds a dedicated IPv6 router in parallel to the IPv4 router - dual stack.
Topology
/ ---- Router #2 ---- Hosts subnet #2 ---- he.net ---- Router #1 ---- \ ---- Hosts subnet #1
Net info
(obfuscated to hide my ip range)
IP block: 2001:450:bb44::/48
Split into subnets
I decided to split the IP block into blocks of /117, 2048 addresses each, using http://www.gestioip.net/cgi-bin/subnet_calculator.cgi
The two networks I'm setting up now are:
Subnet #1: 2001:450:bb44::/117 - main subnet, router #1 needs to route subnet #2 to router #2 Subnet #2: 2001:450:bb44::800/117 - subnet connected to a router #2 which is behind subnet #1
Router for subnet #1
External (eth0) router IP: 2001:470:17:1e5::2/64 Default gateway: 2001:470:17:1e5::1/128 Internal (eth1) router IP: 2001:450:bb44::1/117
ip -6 route add 2001:470:17:1e5::2/64 via 2001:470:17:1e5::1 dev eth0
Add route 2001:450:bb44::801/117 via 2001:450:bb44::29 (this is another internal router)
ip -6 route add 2001:450:bb44::801/117 via 2001:450:bb44::29 dev eth1
Hosts behind subnet #1
Calculate or use https://www.ultratools.com/tools/ipv6CIDRToRange to convert the CIDR to the actual range.
Host IP: pick one between 2001:470:27:2d5::2 to 2001:470:27:2d5::7ff Netmask/block size: 117 Default gateway: 2001:450:bb44::1
Manually assign addresses to the hosts or use DHCPv6 to automate the process - radvd won't work since it requires /64 subnets.
Router for subnet #2
External (eth0) router IP: 2001:450:bb44::29/117 Default gateway: 2001:450:bb44::1/117 Internal (eth1) router IP: 2001:450:bb44::801/117
ip -6 route add 2001:450:bb44::29/117 via 2001:450:bb44::1 dev eth0
Enable IPv6 forwarding:
sysctl -w net.ipv6.conf.all.forwarding=1 and store it in /etc/sysctrl.conf
Hosts behind subnet #2
Host IP: pick one between 2001:470:27:2d5::802 to 2001:470:27:2d5::fff Netmask/block size: 117 Default gateway: 2001:450:bb44::801
Manually assign addresses to the hosts or use DHCPv6 to automate the process - radvd won't work since it requires /64 subnets.
Delete/remove subnets and host addresses
Find addresses/subnets:
route -n -6 ifconfig
Remove them:
ip -6 route del 2001:450:bb44::/64 dev eth0 ip -6 addr del 2001:450:bb44::1 dev eth0
Test connectivity
From subnet #2 ping router #1:
ping9 2001:450:bb44::1
Find IPv6 aaaa record from DNS:
dig google.com aaaa