Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:network:ipv6:ipv6.nat6 [2022/10/26 05:28] – ** OpenWrt 22.03 **: generate fw4 compatible config vgaetera | docs:guide-user:network:ipv6:ipv6.nat6 [2023/09/17 23:39] – [Introduction] vgaetera | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | {{section> | + | {{section> |
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | This page describes | + | * This how-to describes the method for setting |
| - | Most users will not need or want to do this in IPv6, but there are some more specific | + | * Assuming a [[docs: |
| - | These might include: | + | * Avoid using NAT66 and better [[docs: |
| + | * It is also best to avoid using NAT66 unless you are facing the following problems: | ||
| + | * IPv6 multihoming without BGP. | ||
| + | * Performing stateless 1:1 NAT for migration purposes. | ||
| + | * Your ISP uses a dynamic prefix and you need stable addressing. | ||
| + | * Creating a subnet for when the network doesn' | ||
| + | * Being provided a smaller prefix than a /64 or worse, none at all or a ULA address. | ||
| + | * See also: [[docs: | ||
| - | * IPv6 multihoming without BGP | + | ===== Command-line instructions |
| - | * Performing stateless 1:1 NAT for migration purposes | + | ==== 1. Firewall |
| - | * Your ISP uses a dynamic prefix and you need stable addressing | + | Enable |
| - | * Creating a subnet for when the network doesn' | + | |
| - | * Being provided a smaller prefix than a /64 or worse, none at all or a ULA address | + | |
| - | + | ||
| - | Note: If you are provided a /64 prefix, you may not need to use NAT6 and instead [[docs: | + | |
| - | + | ||
| - | This guide relies on OpenWrt default settings and assumes you already have a working IPv6 connection on your OpenWrt router. | + | |
| - | + | ||
| - | ===== Instructions | + | |
| - | Enable the [[docs: | + | |
| <code bash> | <code bash> | ||
| # Configure firewall | # Configure firewall | ||
| - | uci set $(uci show firewall | + | uci set firewall.@zone[1].masq6="1" |
| - | uci commit firewall | + | |
| - | </ | + | |
| - | + | ||
| - | Since masquerading is enabled, disable the redundant firewall rule '' | + | |
| - | + | ||
| - | <code bash> | + | |
| - | # Configure firewall | + | |
| - | uci set $(uci show firewall | sed -n -e "/ | + | |
| uci commit firewall | uci commit firewall | ||
| / | / | ||
| </ | </ | ||
| - | Enable [[docs: | + | ==== 2. Network ==== |
| - | + | Disable IPv6 source filter | |
| - | ===== Extras ===== | + | |
| - | ==== References ==== | + | |
| - | * [[http:// | + | |
| - | * [[http:// | + | |
| - | + | ||
| - | ==== DHCPv6 | + | |
| - | Make sure DHCPv6 uses the following settings (on an unmodified OpenWrt installation these should by the default): | + | |
| - | * " | + | |
| - | * " | + | |
| - | * " | + | |
| - | + | ||
| - | You can check this by running the following command: | + | |
| <code bash> | <code bash> | ||
| - | # uci show dhcp.lan | + | # Configure network |
| - | ... | + | uci set network.wan6.sourcefilter=" |
| - | dhcp.lan.dhcpv6=' | + | uci commit network |
| - | dhcp.lan.ra=' | + | /etc/init.d/network restart |
| - | dhcp.lan.ra_management=' | + | |
| </ | </ | ||
| - | If the output is different, you are not using the defaults and you should set these options to the ones shown above. | + | Prefer [[docs: |
| - | If there is an additional line starting with '' | + | |
| - | Setups with " | + | |
| - | However, if " | + | |
| - | Therefore, enabling the " | + | |
| - | ==== ULA prefix | + | ===== Troubleshooting ===== |
| - | The default ULA (Unique local address) prefix represents an address that is not globally routed on the internet by design. | + | Collect |
| - | A lot of clients will prefer IPv4 over a ULA IPv6 address if there is no global IPv6 address assigned, so you may need to change your existing ULA prefix to indicate a global address to ensure traffic goes over IPv6 by default when possible. | + | |
| - | + | ||
| - | When changing the ULA prefix, it doesn' | + | |
| - | The letters are unassigned | + | |
| - | + | ||
| - | Setting '' | + | |
| - | + | ||
| - | Using your ISP assigned prefix as ULA should also work. | + | |
| - | However, unless you have a static IPv6 prefix assigned by your ISP, this is not recommended, | + | |
| - | If you have a static prefix that you can delegate across your LAN, then you won't need to change your ULA prefix. | + | |
| - | + | ||
| - | ==== NAT64 ==== | + | |
| - | NAT64 can be easily activated using [[https:// | + | |
| - | + | ||
| - | Don't forget to implement DNS64 such that your devices are able to discover the translated addresses. Two ideas for that: | + | |
| - | * Change your DNS to [[https:// | + | |
| - | * Set up your own [[https:// | + | |
| <code bash> | <code bash> | ||
| - | # Install packages | + | # Log and status |
| - | opkg update | + | / |
| - | opkg install kmod-jool jool-tools | + | |
| - | # Activate loading kernel module on boot | + | # Runtime configuration |
| - | cat << " | + | ip -6 address show; ip -6 route show table all |
| - | jool | + | ip -6 rule show; nft list ruleset |
| - | EOF | + | |
| - | # Prevent the file from being deleted during sysupgrade | + | |
| - | cat << " | + | |
| - | / | + | |
| - | EOF | + | |
| - | # Configure local startup | + | |
| - | cat << " | + | |
| - | jool instance add --iptables --pool6 64: | + | |
| - | EOF | + | |
| - | # Configure firewall rules | + | |
| - | cat << " | + | |
| - | iptables | + | |
| - | ip6tables -t mangle -A PREROUTING -j JOOL | + | |
| - | EOF | + | |
| - | # Confirm working NAT64 from a device inside your LAN | + | # Persistent configuration |
| - | ping 64: | + | uci show network; uci show firewall |
| </ | </ | ||