Skip to content

Instantly share code, notes, and snippets.

@skorotkiewicz
Forked from matasarei/openwrt_relayd_repeater.md
Last active October 3, 2025 03:48
Show Gist options
  • Save skorotkiewicz/0673a82c392d3506039725b4ca485d9b to your computer and use it in GitHub Desktop.
Save skorotkiewicz/0673a82c392d3506039725b4ca485d9b to your computer and use it in GitHub Desktop.
HOWTO: Setup OpenWRT (LEDE) WiFi repeater (the right way)

HOWTO: Setup OpenWRT (LEDE) WiFi repeater with IPv6 Support

1. Installation (Beginning of the guide)

Add after the relayd installation:

opkg install relayd odhcp6c
/etc/init.d/relayd enable
/etc/init.d/odhcp6c enable

What was added: odhcp6c package for DHCPv6 client support


2. DHCP Configuration (/etc/config/dhcp)

Replace the entire DHCP section with:

config dhcp 'lan'
        option interface 'lan'
        option ignore '1'
        option dhcpv6 'relay'      # NEW: DHCPv6 relay
        option ra 'relay'          # NEW: Router Advertisement relay
        option ndp 'relay'         # NEW: NDP relay

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

# NEW: DHCPv6 relay configuration
config dhcp 'wwan'
        option interface 'wwan'
        option ignore '1'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'

What was added:

  • Changed dhcpv6 'server' to dhcpv6 'relay'
  • Changed ra 'server' to ra 'relay'
  • Added option ndp 'relay' for Neighbor Discovery Protocol
  • Added entire config dhcp 'wwan' section for wireless WAN relay

3. Firewall Configuration (/etc/config/firewall)

Add at the end of the firewall configuration:

# NEW: IPv6 firewall rules
config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

What was added:

  • DHCPv6 rule to allow DHCPv6 client communication
  • ICMPv6 input rules for essential IPv6 protocols (ping, path MTU discovery, neighbor discovery)
  • ICMPv6 forwarding rules for packet forwarding between networks

4. Network Configuration (/etc/config/network)

Modify the lan interface and add new sections:

# Local network config
config interface 'lan'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option gateway '192.168.1.1'
        option dns '192.168.1.1'
        option ip6assign '64'        # CHANGED: from '60' to '64' (standard)
        option _orig_ifname 'eth0 wlan0-1'
        option _orig_bridge 'true'
        option ifname 'eth0 eth1'

# WWAN (Wireless WAN) config
config interface 'wwan'
        option proto 'static'
        option ipaddr '192.168.1.2'
        option netmask '255.255.255.0'
        option gateway '192.168.1.1'
        option dns '192.168.1.1'

# NEW: IPv6 for WWAN
config interface 'wwan6'
        option ifname '@wwan'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'

# STA Bridge (relayd) config
config interface 'stabrige'
        option proto 'relay'
        option network 'lan wwan'
        option ipaddr '192.168.1.2'

# NEW: Global IPv6 settings
config globals 'globals'
        option ula_prefix 'fd00::/48'

What was added:

  • Changed ip6assign from '60' to '64' (standard IPv6 prefix length)
  • Added entire config interface 'wwan6' section for DHCPv6 client on WWAN
  • Added config globals 'globals' section with Unique Local Address prefix

5. Verification Commands

## Verify IPv6 Configuration

After restarting services, verify IPv6 is working:

```bash
# Check IPv6 interfaces
ip -6 addr show

# Check IPv6 routing
ip -6 route show

# Test IPv6 connectivity
ping6 google.com
ping6 2001:4860:4860::8888

# Check DHCPv6 leases
cat /var/dhcp6.leases

Restart Services

/etc/init.d/network restart
/etc/init.d/firewall restart
/etc/init.d/odhcp6c restart
/etc/init.d/relayd restart
wifi reload

Summary of Changes

  1. Installation: Added odhcp6c package
  2. DHCP: Changed from server to relay mode, added WWAN relay config
  3. Firewall: Added 3 new rules for DHCPv6 and ICMPv6
  4. Network: Added wwan6 interface, changed ip6assign to 64, added global IPv6 settings
  5. Verification: Added new section with IPv6 testing commands

All changes maintain backward compatibility with IPv4 while adding full IPv6 support through relay mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment