[Guide] OpenWRT Hotspot Relay

Topics addressing TTL settings for Throttling, Tethering and Hotspot Usage
Forum rules
Use the SEARCH function for related topics PRIOR to posting a new topic on the same subject.
Post Reply
ruraltx
Posts: 12
Joined: Fri Feb 25, 2022 12:02 pm
Has thanked: 0
Been thanked: 5 times

[Guide] OpenWRT Hotspot Relay

Post by ruraltx »

This is a guide to relay a hotspot via Relayd with TTL/HL modifications. This works well if it's the only option, but the use of relayd can introduce bottlenecks if the network is too fast for the router's cpu. Setting up a bridge with DD-WRT or Tomato does not have this issue, but ymmv depending on the hardware you have and what your needing to connect to. This pseudo bridge setup does not bypass Android's builtin client limit.

My router has two radios, wlan0 for 2.4GHz and wlan1 for 5GHz, and I'm using wlan1 to connect to the hotspot. I made these parts bold so you know to substitute for your device. This process largely mirrors the official documentation so you can turn to it if you get lost.
https://openwrt.org/docs/guide-user/net ... figuration

Go to System -> Software and install luci-proto-relay and iptables-mod-ipopt

Network -> Interfaces -> Interfaces tab -> LAN interface -> Edit
Set IPv4 address 10.0.0.1
DHCP Server tab -> General Setup sub-tab
Check 'Ignore interface'
IPv6 Settings tab
Set 'RA-Service' to 'relay mode'
Set 'DHCPv6-Service' to 'disabled'
Set 'NDP-Proxy' to 'relay mode'
Click Save

Network -> Wireless
Setup the wireless AP if you have two radios, this was wlan0 for me
On the other radio that connects to the phone, wlan1 for me, hit Scan
Choose Join Network on the desired network
Check 'Replace wireless configuration'
Set 'Create / Assign firewall-zone' to LAN
Enter your password and hit Submit
Click Save

Network -> Firewall -> Custom Rules tab
Append these rules to the bottom of the script

Code: Select all

iptables -t mangle -I POSTROUTING -o wlan1 -m ttl ! --ttl-eq 255 -j TTL --ttl-set 65
ip6tables -t mangle -I POSTROUTING -o wlan1 -m hl ! --hl-eq 255 -j HL --hl-set 65
NOTE: Set 'wlan1' to the correct radio for your setup
Click Save

Network -> Interfaces -> Interfaces tab -> Add new interface...
Set 'Name' to 'wwan6'
Set 'Protocol' to 'DHCPv6 client'
Set 'Device' to 'wlan1'
Select Create interface
Click the Firewall Settings tab
Set 'Create / Assign firewall-zone' to 'lan'
Click Save

Add new interface...
Set 'Name' to 'relay'
Set 'Protocol' to 'Relay bridge'
Select Create interface
Set 'Local IPv4' address to '10.0.0.1'
Set 'Relay between networks' to 'lan' and 'wwan'
Click the Firewall Settings tab
Set 'Create / Assign firewall-zone' to 'lan'
Click Save

Click the little arrow next to 'Save & Apply', select and click 'Apply unchecked'

For the last step, you connect to the router via ssh

Code: Select all

ssh -l root 10.0.0.1
You can use a client like Putty on Windows to do this

Code: Select all

uci set dhcp.wan.interface=wwan
uci set dhcp.wan.ra=relay
uci set dhcp.wan.ndp=relay
uci set dhcp.wan.master=1
uci commit
reboot
4zims
Posts: 2
Joined: Sat Dec 10, 2022 4:25 am
Has thanked: 1 time
Been thanked: 0

Re: [Guide] OpenWRT Hotspot Relay

Post by 4zims »

ruraltx wrote: Fri Aug 05, 2022 5:53 pm Network -> Firewall -> Custom Rules tab
Append these rules to the bottom of the script

Code: Select all

iptables -t mangle -I POSTROUTING -o wlan1 -m ttl ! --ttl-eq 255 -j TTL --ttl-set 65
ip6tables -t mangle -I POSTROUTING -o wlan1 -m hl ! --hl-eq 255 -j HL --hl-set 65
NOTE: Set 'wlan1' to the correct radio for your setup
Click Save
Apparenlty Custom Rules tab is missing in OpenWrt 22.03.
User avatar
Didneywhorl
Posts: 3635
Joined: Fri Mar 23, 2018 5:37 pm
Location: USA
Has thanked: 1369 times
Been thanked: 761 times
Contact:

Re: [Guide] OpenWRT Hotspot Relay

Post by Didneywhorl »

This is because openwrt moved to fw4, using nftables instead of iptables. It requires different rules for the latest openwrt. I don't have the latest rules for nftables on my phone, and they have to be comitted via command line/ssh.
4zims
Posts: 2
Joined: Sat Dec 10, 2022 4:25 am
Has thanked: 1 time
Been thanked: 0

Re: [Guide] OpenWRT Hotspot Relay

Post by 4zims »

@Didneywhorl I guess I'll stick with 21.02.5 for now.
Post Reply

Return to “TTL Settings - Throttling, Tethering and Hotspot Usage”