Difference between revisions of "Setup IPv6 subnets on Linux"

From ivc wiki
Jump to navigationJump to search
(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...")
 
Line 59: Line 59:
  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/64 dev eth0
  ip -6 addr del 2001:450:bb44::1/64 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

Revision as of 21:59, 14 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
Subnet #2: 2001:450:bb44::800/117

Router for subnet #1

External router IP: 2001:470:17:1e5::2/64
Default gateway: 2001:470:17:1e5::1/128
Internal router IP: 2001:450:bb44::1/117

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

Hosts behind subnet #1

Host IP: pick one between 2001:470:27:2d5::2 to 2001:470:27:2d5::7ff
Default gateway: 2001:450:bb44::1/117

Router for subnet #2

External router IP: 2001:450:bb44::29/117
Default gateway: 2001:450:bb44::1/117
Internal router IP: 2001:450:bb44::801/117

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
Default gateway: 2001:450:bb44::801/117

Delete/remove subnets and host addresses

ip -6 route del 2001:450:bb44::/64 dev eth0
ip -6 addr del 2001:450:bb44::1/64 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