OpenWRT: IPv6
Sumber: http://wiki.openwrt.org/doc/uci/network6
Barrier Breaker dan versi selanjutnya
- Native IPv6-support dengan DHCPv6, RA & DHCPv6-Server dan IPv6-firewall dapat di instalasi dan di konfigurasi secara default.
- Teknologi transisi seperti 6in4, 6rd, 6to4 atau ds-lite dapat di instalasi menggunakan package dengan nama yang sama.
- Dukungan WebUI dilakukan dengan instalasi package luci-proto-ipv6.
Implementasi
Fitur
- Penanganan Prefix
- Manajemen prefix, address dan route dari sambungan upstream dan local ULA-prefix
- Manajemen prefix dari unreachable-routes, prefix deprecation (RFC 7084) dan prefix class
- Distribusi prefix ke downstream interface (termasuk size, ID dan class hints)
- Kebijakan routing yang berbasis Source agar secara benar menangani interface multiple uplink, ingress policy filtering (RFC 7084)
- Konfigurasi Native IPv6
- Automatic bootstrap dari SLAAC, stateless DHCPv6, stateful DHCPv6, DHCPv6-PD dan kombinasi lainnya
- Penanganan preferred dan valid address dan prefix lifetimes
- Duplicate address dan pendeteksian Link-MTU
- DHCPv6 Extension: Reconfigure, Information-Refresh, SOL_MAX_RT=3600
- DHCPv6 Extension: RDNSS, DNS Search Domain, NTP, SIP, ds-lite, prefix exclusion (experimental)
- IPv6 teknologi transisi
- Setup dan manajemen dari IPv6-in-IPv4 tunnel (6rd, 6to4, 6in4)
- Setup dan manajemen dari IPv4-in-IPv6 tunnel (ds-lite, lw4o6, map-e)
- Setup dan manajemen dari IPv4-to-IPv6 translation (map-t, 464xlat CLAT) [sejak Chaos Calmer]
- Automatic setup dari tunnel dari DHCP dan DHCPv6 [sejak Chaos Calmer]
- Konfigurasi Downstream IPv6
- Dukungan Server untuk Router Advertisement, DHCPv6 (stateless dan stateful) dan DHCPv6-PD
- Deteksi Automatis untuk announced prefixes, delegated prefixes, default routes dan MTU
- Ubah deteksi untuk prefix dan route untuk men-trigger pengiriman ulang dari RA dan DHCPv6-Reconfigure
- Deteksi dari client hostname dan export sebagai augmented hosts-file
- Dukungan untuk RA & DHCPv6-relaying dan NDP-proxying untuk, misalnya, dukungan uplink tanpa prefix delegation
Compliance
OpenWRT berusaha untuk mengikuti RFC 7084 jika dimungkinkan. Walaupun complience belum di verifikasi secara penuh.
Persyaratan dari RFC 7084 saat ini di ketahui belum terpenuhi.RFC 7084 WAA-5 (SHOULD-requirement): NTP-Server yang di-request dan di-received saat ini tidak di process atau digunakan.
Konfigurasi Upstream WAN-Interface
Pada bagian ini akan di terangkan cara konfigurasi sambungan IPv6 ke ISP atau ke upstream router. Perlu di catat bahwa sebagian besar mekanisme tunneling seperti 6in4, 6rd dan 6to4 tidak dapat beroperasi dibelakang NAT-router.
Sambungan Native IPv6
Untuk sebuah uplink dengan sambungan native IPv6 kita dapat menggunakan contoh konfigurasi berikut. Konfigurasi ini dapat bekerja untuk uplink yang mendukung DHCPv6 dengan Prefix Delegation dan juga yang tidak mendukung DHCPv6-PD maupun DHCPv6 sama sekali (hanya SLAAC).
/etc/config/network config interface wan option ipv6 1 # hanya dibutuhkan untuk protocol yang berbasis PPP ... config interface wan6 option ifname eth1 # gunakan nama ifname yang sama dengan di wan-section atau "@wan" option proto dhcpv6 config interface lan option proto static option ip6assign 60 ...
package odhcp6c harus di instalasi untuk bisa menggunakan dhcpv6.
Sambungan IPv6 Statik
Konfigurasi statik untuk IPv6 uplink juga di dukung. Berikut adalah contoh caranya,
vi /etc/config/network config interface wan option ifname eth1 option proto static option ip6addr 2001:db80::2/64 # Address kita option ip6gw 2001:db80::1 # Address Gateway option ip6prefix 2001:db80:1::/48 # Prefix address untuk di distribusikan ke downstream interface option dns 2001:db80::1 # DNS server config interface lan option proto static option ip6assign 60 ...
6in4 tunnel (HEnet tunnelbroker, sixxs static tunnel, ...)
6in4 tunnel biasanya diberikan oleh external tunnel provider seperti HE.net atau Sixxs. Kita dapat menggunakan contoh konfigurasi berikut sebagai dasar:
/etc/config/network: config 'interface' 'wan6' option 'proto' '6in4' option 'mtu' '1424' # IPv6 tunnel MTU (optional) option 'peeraddr' '62.12.34.56' # IPv4 tunnel endpoint option 'ip6addr' '2001:DB8:2222:EFGH::2/64' # IPv6 tunnel option 'ip6prefix' '2001:DB8:1234:ABCD::/64' # Prefix yang di routed # opsi konfigurasi di bawah hanya untuk HEnet tunnel. abaikan untuk tunnel yang lain. option tunnelid '123456' # HE.net tunnel id option username 'username' # HE.net username, bukan User ID. option password 'password' # HE.net password jika tidak menggunakan updatekey untuk tunnel option updatekey 'updatekey' # HE.net updatekey pengganti password config 'interface' 'lan' option 'proto' 'static' option ip6assign 60 ...
Jika kita memilih nama tunnel-interface bukan 'wan6' maka pastikan untuk menambahkan nama interface ke network-option dari firewall-zone 'wan' di /etc/config/firewall.
Package 6in4 harus di install untuk menggunakan 6in4-tunnel.
Catatan: HE.net mengalokasikan sebuah "updatekey" secara default untuk tunnel baru sejak Februari 2014.Jika kita menggunakan updatekey, kita perlu menggunakannya bukan password. Dukungan untuk opsi ini mulai di lakukan dalam OpenWRT trunk dari revisi r39646. Tunnel lama tanpa updatekey akan tetap dapat berjalan menggunakan password.
6rd tunnel (Dukungan untuk Transisi ISP IPv6)
6rd adalah sebuah mekanisme tunnel berbasis pada 6to4. Tidak seperti mekanisme tunneling lain, 6rd biasanya di berikan oleh ISP itu sendiri. Nilai dari tunnel biasanya di peroleh dengan DHCPv4 request untuk WAN interface.
Sejak OpenWRT Chaos Calmer dan selanjutnya, konfigurasi ini biasanya auto-detecte sehingga konfigurasi manual biasanya tidak dibutuhkan. Cukup instalasi package 6rd dan rebooting biasanya sudah cukup.
/etc/config/network: config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' # The following two lines are only needed in Barrier Breaker option iface6rd wan_6rd option zone6rd wan
Untuk 6rd via DHCP, pertama kali kita perlu men-cek jika parameter memang dikirim. Buat /etc/udhcpc.user dengan content berikut:
#!/bin/sh env >> /tmp/udhcpc.log
Reboot router dan cek log file, apakah ada kalimat kira-kira seperti berikut:
ip6rd=16 40 2001:0838:ad00:0000:0000:0000:0000:0000 77.174.0.2
Jika kalimat tersebut tidak ada, kita perlu memperoleh nilai yang benar untuk peeraddr, ip6prefix, ip6prefixlen dan ip4prefixlen dari ISP kita. Nilai ip6rd di atas atau nilai yang kita peroleh dari ISP, dapat di tulis (hardcode) ke 6RD tunnel. Buang atau di-comment kalimat iface6rd dari wan section.
/etc/config/network
config interface 'wan6' option proto '6rd' option peeraddr '77.174.0.2' option ip6prefix '2001:838:ad00::' option ip6prefixlen '40' option ip4prefixlen '16'
Di Chaos Calmer dan Barrier Breaker default /etc/config/network akan bekerja setelah kita menginstalasi package 6rd. dhcpv6 akan di abaikan jika tidak berhasil.
Jika kita memilih nama tunnel-interface bukan 'wan6' maka pastikan bahwa nama interface tersebut masuk ke network-option di firewall-zone 'wan' di /etc/config/firewall.
Package 6rd harus di instalasi untuk menggunakan 6rd-tunnel.
6to4 tunnel
6to4 adalah mekanisme IPv6 tunneling yang paling sederhana, yang menggantungkan diri pada gateway yang tersedia secara publik.
/etc/config/network: config 'interface' 'wan6' option 'proto' '6to4' config 'interface' 'lan' option 'proto' 'static' option ip6assign 60 ...
Jika kita memilih nama tunnel-interface bukan 'wan6' pastikan bahwa nama interface tersebut masuk ke network-option di firewall-zone 'wan' di /etc/config/firewall.
Package 6to4 harus di instalasi untuk menggunakan 6to4-tunnel.
Dual-Stack Lite tunnel (ds-lite IPv4 in IPv6)
ds-lite adalah sebuah mekanisme transisi yang digunakan oleh ISP untuk mendukung IPv4-connectivity di atas sambungan native IPv6.
Di Chaos Calmer dan versi selanjutnya, konfigurasi ds-lite biasanya auto-detect sehingga konfigurasi manual tidak diperlukan. Cukup dengan menginstalasi package ds-lite dan reboot biasanya sudah cukup.
/etc/config/network: config 'interface' 'wan6' option 'ifname' 'eth1' option 'proto' 'dhcpv6' config 'interface' 'wan' option 'proto' 'dslite' option 'peeraddr' '2001:db80::1' # ISP DS-Lite AFTR
Jika kita memilih nama tunnel-interface bukan 'wan6' pastikan bahwa nama interface tersebut masuk ke network-option di firewall-zone 'wan' di /etc/config/firewall.
Package ds-lite harus di instalasi untuk menggunakan ds-lite-tunnel.
Konfigurasi Downstream LAN-Interface
OpenWrt includes a flexible local prefix delegation mechanism. It can be tuned for each downstream-interface individually with 3 parameters which are all optional:
ip6assign: Prefix size used for assigned prefix to the interface (e.g. 64 will assign /64-prefixes) ip6hint: Subprefix ID to be used if available (e.g. 1234 with an ip6assign of 64 will assign prefixes of the form …:1234::/64) ip6class: Filter for prefix classes to accept on this interface (e.g. wan6 will only assign prefixes with class "wan6" but not e.g. "local")
ip6assign and / or ip6hint-settings might be ignored if the desired subprefix cannot be assigned. In this case OpenWrt will first try to assign a prefix with the same length but different subprefix-ID. If this fails as well the prefix length is reduced until the assignment can be satisfied. If ip6hint is not set an arbitrary ID will be chosen. Setting the ip6assign-parameter to a value < 64 will allow the DHCPv6-server to hand out all but the first /64 via DHCPv6-Prefix Delegation to downstream routers on the interface. If the ip6hint is not suitable for the given ip6assign it will be rounded down to the nearest possible value.
If ip6class is not set then all prefix classes are accepted on this interface. The default class for a prefix is the interface-name (e.g. "wan6") or "local" for the ULA-prefix. This can be used to select upstream interfaces from which subprefixes are assigned. For prefixes received from dynamic-configuration methods like DHCPv6 it is possible that the prefix-class is not equal to the source-interface but e.g. augmented with an ISP-provided numeric prefix class-value.
Example (/etc/config/network):
config globals globals option ula_prefix fd00:db80::/48 config interface wan6 option proto static option ip6prefix 2001:db80::/56 ... config interface lan option proto static option ip6assign 60 option ip6hint 10 ... config interface guest option proto static option ip6assign 64 option ip6hint abcd list ip6class wan6 ...
The results of that configuration would be:
The lan interface will be assigned the prefixes 2001:db80:0:10::/60 and fd00:db80:0:10::/60. The DHCPv6-server can offer both prefixes except 2001:db80:0:10::/64 and fd00:db80:0:10::/64 to downstream routers on lan via DHCPv6-PD. The guest interface will only get assinged the prefix 2001:db80:0:abcd::/64 due to the class filter.
Router Advertisement & DHCPv6
OpenWrt features a versatile RA & DHCPv6 server and relay. Per default SLAAC, stateless and stateful DHCPv6 are enabled on an interface. If there are prefix of size /64 or greater present then addresses will be handed out from each prefix. If all prefixes on an interface have a size greater /64 then DHCPv6-Prefix Delegation is enabled for downstream-routers. If a default route is present the router advertises itself as default router on the interface.
OpenWrt is also able to detect when there is no prefix available from an upstream interface and can switch into relaying mode automatically to extend the upstream interface configuration onto its downstream interfaces. This is useful for putting an OpenWrt behind another IPv6-router which doesn't offer prefixes via DHCPv6-PD.
Example configuration section for SLAAC + DHCPv6 server mode (/etc/config/dhcp)
config dhcp lan option dhcpv6 server option ra server
Example configuration section for SLAAC alone (/etc/config/dhcp)
config dhcp lan option dhcpv6 disabled option ra server
Example configuration section for relaying (/etc/config/dhcp)
config dhcp wan6 option dhcpv6 relay option ra relay option ndp relay option master 1 config dhcp lan option dhcpv6 relay option ra relay option ndp relay
- !: The package odhcpd must be installed to provide these services.
Routing Mangement
OpenWrt uses a source-address and source-interface based policy-routing system. This is required to correctly handle different uplink interfaces. Each delegated prefix is added with an unreachable route to avoid IPv6-routing loops.
To determine the current status of routes you can consult the information provided by ifstatus.
Example (ifstatus wan6):
... "ipv6-address": [ { "address": "2001:db80::a00:27ff:fe67:cd9c", "mask": 64, "preferred": 1681, "valid": 7081 } ], "ipv6-prefix": [ { "address": "2001:db80:0:100::", "mask": 56, "preferred": 86282, "valid": 86282, "class": "wan6", "assigned": { "lan": { "address": "2001:db80:0:110::", "mask": 60 } } } ], "route": [ { "target": "2001:db80::", "mask": 48, "nexthop": "fe80::800:27ff:fe00:0", "metric": 1024, "valid": 7081 }, { "target": "::", "mask": 0, "nexthop": "fe80::800:27ff:fe00:0", "metric": 1024, "valid": 7081 } ], ...
Interpretation:
On the interface 2 routes are provided: 2001:db80::/48 and a default-route via the router fe80::800:27ff:fe00:0. These routes can only be used by locally generated traffic and traffic with a suitable source-address, that is either one of the local addresses or an address out of the delegated prefix.
- !: OpenWrt adds IPv6-routes (like default routes) to specific routing-tables and not the main-table thus they may not be seen by default. You can use the command ip -6 rule to list all current routing policies.
Migration from Attitude Adjustment 12.09 and earlier
IPv6 Forwarding
To ensure that IPv6 forwarding is working correctly, please check that your /etc/sysctl.conf contains the following entries:
net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1
Downstream configuration for LAN-Interfaces
It is discouraged to use ip6addr to set addresses / prefixes on downstream interfaces (e.g. lan) because it can easily lead to conflicts with the local address delegation. Also it might lead to unexpected result or brokenness due to the source-based policy-routing used in the IPv6-stack.
Please use the new options ip6assign and ip6hint instead.
Example: If your delegated prefix is 2001:db80:1234::/48 and you want your lan interface to have the subprefix 2001:db80:1234:5678::/64 you could use the following configuration:
config 'interface' 'lan' option 'proto' 'static' option 'ip6assign' '64' option 'ip6hint' '5678' ...
If the router can ping6 the internet, but lan machines get "Destination unreachable: Unknown code 5" or "Source address failed ingress/egress policy" then the ip6assign option is missing on your lan interface. Router Advertisement & DHCPv6
The use of radvd is now unnecessary. The service 6relayd is used for Router Advertisement and DHCPv6 and picks up addresses from interfaces automatically. To configure the 6relayd service see 6relayd. Upstream Configuration for WAN-Interfaces
Generic Changes
Router Advertisements are not accepted by default anymore and thus OpenWrt will not configure itself with default routes and / or addresses. Also the interface-options accept_ra and send_rs have been removed. You should add an interface with proto dhcpv6 - also for receiving RAs only - as described in Native IPv6 Connection. 6in4 tunnel and Static IPv6 connection
It is now necessary to add your routed-prefix (e.g. routed /48 of your tunnel) as option ip6prefix to the tunnel/static-interface in /etc/config/network. If you omit this option your lan-clients will not be able to reach the internet.
Example:
config 'interface' 'wan6' option 'proto' '6in4' option 'peeraddr' '62.12.34.56 option 'ip6addr' '2001:DB8:2222:EFGH::2/64' option 'ip6prefix' '2001:DB8:1234:ABCD::/64' # <- Your routed prefix ...
6rd and 6to4 tunnel
Your public address prefix is now automatically calculated and sent to the network subsystem (netifd). You should follow the advice for lan-interface configuration.