Skip to content

Instantly share code, notes, and snippets.

@braian87b
Last active October 22, 2023 12:32
Show Gist options
  • Save braian87b/821e9e4f399918510c55619192a31871 to your computer and use it in GitHub Desktop.
Save braian87b/821e9e4f399918510c55619192a31871 to your computer and use it in GitHub Desktop.
How to setup Client Bridged / Client Mode / RelayD and IGMPProxy for OpenWRT / LEDE
# Client Bridged / Client Mode / RelayD and IGMPProxy (It works)
# RelayD is to redirect packages and IGMP is for redirect IGMP packages
# Our network is 192.168.1.0/24
# Steps:
# Configure WAN as static
# We should edit our wan iface and put static IP
uci set network.wan='interface'
uci set network.wan.proto='static'
uci set network.wan.ipaddr='192.168.1.239' # Main Network IP
uci set network.wan.netmask='255.255.255.0'
uci set network.wan.gateway='192.168.1.1' # Main Network Gateway
uci set network.wan.dns='192.168.1.1' # Temporary, to have internet here
# Disable physical WAN
# If we want to avoid conflicts if we connect something by mistake on wan port (we could disable it)
uci del network.wan.ifname
# Put temporarely LAN on another network
uci set network.lan.ipaddr='192.168.11.1' # FAKE IP (recommended to be in another never to be used subnet)
uci set network.lan.netmask='255.255.255.0'
# Now we must change our computer IP to this range to be able to connect to it
# We will get internet using WAN (WiFi) now
uci del network.lan.gateway
uci del network.lan.dns
# 4) Setup Wireless connection Client
uci set wireless.@wifi-iface[-1].device='radio0'
uci set wireless.@wifi-iface[-1].network='wan'
uci set wireless.@wifi-iface[-1].mode='sta'
uci set wireless.@wifi-iface[-1].ssid='Wireless name SSID'
# use 'psk' if WPA, or 'psk2' if WPA2
uci set wireless.@wifi-iface[-1].encryption='psk2'
uci set wireless.@wifi-iface[-1].key='Wireless Password'
uci commit
wifi
# We disable Firewall
echo '' > /etc/config/firewall
/etc/init.d/firewall disable
/etc/init.d/firewall stop
# Apply Changes
uci commit
sync
/etc/init.d/network restart
# Now we must change our IP to 192.168.11.x and reconnect to 192.168.11.1
# We should have now network (with internet)
opkg update
# Verify free space
#root@OpenWrt:~# df | grep overlayfs
#overlayfs:/overlay 896 216 680 24% /
# Download relayd and igmpproxy (see used space)
opkg install relayd igmpproxy
#root@OpenWrt:~# df | grep overlayfs
#overlayfs:/overlay 896 248 648 28% /
#
#OK #uci set network.lan.ipaddr='192.168.11.1' # Already done
#OK #uci set network.lan.netmask='255.255.255.0' # Already done
uci set network.lan.gateway='192.168.1.1' # Main Network Gateway
uci set network.lan.dns='192.168.1.1' # Main Network DNS
#OK #uci set network.wan.ipaddr='192.168.1.239' # Already done
#OK #uci set network.wan.netmask='255.255.255.0' # Already done
#OK #uci set network.wan.gateway='192.168.1.1' # Already done
uci del network.wan.dns # DNS goes in 'lan' now
# We configure interface for relayd
uci set network.stabridge='interface'
uci set network.stabridge.proto='relay'
uci set network.stabridge.network="lan wan"
uci set network.stabridge.ipaddr="`uci get network.wan.ipaddr`" # Needed to be able to access this Router
/etc/init.d/relayd enable
/etc/init.d/relayd start
# We Configure igmpproxy
uci set igmpproxy.@phyint[0].network='wan'
uci set igmpproxy.@phyint[0].altnet='192.168.0.0/24'
uci set igmpproxy.@phyint[1].network='lan'
uci set igmpproxy.@phyint[1].altnet='192.168.0.0/24'
/etc/init.d/igmpproxy enable
/etc/init.d/igmpproxy start
# We Disable DNSMasq
echo '' > /etc/config/dhcp
/etc/init.d/dnsmasq disable # to avoid edits to /etc/resolv.conf
/etc/init.d/dnsmasq stop
# Commit Changes, Save and Reboot
uci commit
sync
reboot
# Optionally we could add new wifi-iface in AP mode with network='lan'
uci add wireless wifi-iface
uci set wireless.@wifi-iface[-1].device='radio0'
uci set wireless.@wifi-iface[-1].network='lan'
uci set wireless.@wifi-iface[-1].mode='ap'
uci set wireless.@wifi-iface[-1].ssid='WiFi Network'
uci set wireless.@wifi-iface[-1].encryption='psk2+aes'
uci set wireless.@wifi-iface[-1].key='Wireless Password'
uci commit wireless && wifi reload
# How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE
https://gist.github.com/braian87b/bba9da3a7ac23c35b7f1eecafecdd47d
# How to setup Wireless Links to avoid Wired backbone using WDS on Atheros for OpenWRT / LEDE
https://gist.github.com/braian87b/8a524a8ad74a36407a8f481e9d16a5c9
@rolreich
Copy link

It's confusing me, that you igmpproxy-config the up/downstream altnet as a C-Class local-subnet, and even one different from your main-subnet 192.168.1.0

We Configure igmpproxy

uci set igmpproxy.@phyint[0].network='wan'
uci set igmpproxy.@phyint[0].altnet='192.168.0.0/24'
uci set igmpproxy.@phyint[1].network='lan'
uci set igmpproxy.@phyint[1].altnet='192.168.0.0/24'

and don't you also have to add the role upstream/downstream?

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