Setup IPv6 subnets on Linux

From ivc wiki
Revision as of 21:58, 14 May 2017 by Ivc (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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