I'm trying to turn a GL.iNet GL-MT300A running OpenWrt into a plain ol' WiFi-N to Ethernet bridge for a PS3 that has a failing WiFi adapter.
Main WiFi router and DHCP server (192.168.13.1) -> WiFi-N (gets 192.168.13.102 via DHCP) | GL-MT300A | eth0.2 Ethernet port -> PS3 Ethernet Port (should get 192.168.13.103 to .150 but fails)
I use the GL-MT300A's eth0.1 Ethernet port (192.168.8.1) to configure it with LuCi.
The PS3 requests an IP via DHCP which should be served by the main WiFi router (DHCP pass-through and bi-directional communication at Layer 2), but no DHCP response is received.
The note at the top of this wiki page seems like it is written at me:
Using relayd as instructed in this article isn't guaranteed to work.
The most common problem is that the client router cannot pass the DHCP message between the main router and the client connected to the client router. Currently it seems to be the hardware/SOC limitation (related to MAC cloning?)
You may also consider to use WDS or mesh networking.
Instead of relayd it should be possible to use kmod-trelay, the only information about using it can be seen in its source code, if you used it successfully please add a section for it in this article.
relayd does work, but only very rarely, and randomly. Basically, I just have to reset the PS3's networking over and over until it eventually gets an IP via DHCP, and then it will work until the PS3 is turned off.
So, I'd like to try to get kmod-trelay working, but I was only able to find this short set of instructions from this ticket:
OK, then relayd doesn't work, but I already thought of this use case a while ago and wrote a kernel module that you can use as a bridge replacement.
That way you will not have to use ebtables at all.
The package is called trelay (trivial relay). It works like this:
You create a VLAN on your ethernet and configure trelay on that vlan and wlan0.
Then on the other side where you run batman-adv you also create a VLAN interface with the same ID and assign to it the MAC address of the outgoing wlan interface. That way packets should be forwarded in both directions with no MAC address rewriting at all.
I am NOT running batman-adv; my use case is much simpler.
Here's what I've done so far on the GL-MT300A:
Connected its wlan0 interface (called "wwan") via WiFi-N to the main WiFi router in WISP repeater mode so that it auto-connects correctly as 192.168.13.102 (IP received via DHCP on the main WiFi router). The GL-MT300A has internet access via this interface. It shows up as wlan-sta in ifconfig -a
Installed prepackaged kmod-trelay successfully from the default repository.
Edited the file /etc/config/trelay and changed it to:
config trelay option enabled 1 option dev1 eth0.2 option dev2 wlan0
Edited the factory default eth0.2 interface (called "wan") so that it has the same MAC address as the wlan0 interface.
Restarted the trelay service and turned off the firewall and firewall_gl services (no firewalls for easier testing).
I do not see any errors in the main syslog at this point.
- Started up the PS3, which sends a DHCP request.
Ten or so of these messages showed up in the main syslog:
daemon.warn dnsmasq-dhcp: DHCP packet received on eth0.2 which has no address
The PS3 gave up after getting no DHCP response.
- Now, I left eth0.2 set to the factory default protocol of DHCP client. After getting the above error, I also tried setting it to Unmanaged, but this does not let me override the MAC address (via LuCi--maybe it can be done via command line).
Based on what I could glean from this other thread, it looks like eth0.2 ("wan") should be Unmanaged:
I also tried setting eth0.2 to a Static IP address, 192.168.168.1/24, which does allow for the MAC address override, but the error the PS3 generates becomes:
daemon.warn dnsmasq-dhcp: no address range available for DHCP request via eth0.2
If I change eth0.2 to a static IP address in the same subnet as the wlan0, it will cut off access to both eth0.2 and wlan0, which now both have the same MAC address but different IP addresses in the same subnet.
So, I'm kinda stuck. I think I've followed nbd's instructions correctly, but it's not working.
I have also tried using the interface names that show up in
ifconfig -a in
/etc/config/trelay like so:
config trelay option enabled 1 option dev1 wlan-sta option dev2 eth0.2
No difference; the PS3 still fails to get a DHCP response. HOWEVER, with this config file, I can no longer SSH in via the wlan-sta IP address of 192.168.13.102, because wlan-sta will no longer connect. Looking at the syslog, the corresponding line is:
daemon.notice netifd: wwan (####): Received SIGTERM
So it looks like trelay crashes the interface wlan-sta (called "wwan" in LuCi) if wwan is still set to DHCP client. If it is set to Unmanaged, then it will no longer crash when trelay is restarted, but it gets no IP. The PS3 still fails to receive a DHCP response, but the syslog no longer records any error when it tries.
Any help figuring this out would be appreciated--thanks! It'll probably become the wiki article on how to use kmod-trelay to do simple bridging.