How to configure GL-AR300M16 as bridge from LAN to Wifi AP

I have a Huawei Solar Inverter in my Garage which acts as a Wifi AP and i can access the Modbus-TCP of the inverter. I would like to use my GL-AR300M16 to act as a bridge to the inverter from my local lan. How do i configure the router? I already tried to set it up as repeater but that did not work. I could not get a connection from my system on the LAN to the inverter. Any help or hint greatly appreciated.

Do you mean the Huawei solar inverter broadcasts WiFi signals? How do you connect to the inverter and access Modbus? (wifi / Ethernet port / serial port)

Need to confirm your topology.

If the Huawei solar inverter and AR300M are connected via WiFi, just set the router to Extender mode.

The Huawei inverter has an access point and i connect to it as wifi client. The client gets address 192.168.200.2 from the AP. The GL-AR300M is connected to the local LAN (static IP 192.168.8.5). The main router is a GL-XE300 with LTE connection to the internet. I need to have access to the inverter from the local lan. I already tried a setup as extender, but that did not work.
Currently i have configured the GL-AR300M with a relay bridge between the WAN and the WWAN interfaces. But i can't ping the inverter. I also have defined a route to the 192.168.200.0/24 network to the GL_AR300M on my main router.

Additional info: I can telnet to 192.168.200.1 on port 6607 (modbus) from the GL-AR300M, but not from any pc on the local network.

I'm trying to achieve as the section "Using OpenWRT" in this document describes.
https://github.com/wlcrs/huawei_solar/wiki/Connecting-to-the-inverter#connect-to-the-inverter-ap-sun2000-serial_no-wifi

Have you set the wrong routing data direction?

First, you need to connect AR300M as a client to the inverter, and connect the Ethernet cable to XE300.

"PC on the local network" means the PC connected to AR300M via Ethernet, or the PC connected to XE300 via Ethernet.

If the PC is a lower-level terminal device of AR300M, you need to set a route from 192.168.8.0/24 to the inverter 192.168.200.xx on AR300M.

If the PC is a lower-level terminal device of XE300, you need to set a route to the IP address of AR300 on XE300, and then set a route to the inverter on AR300

Just an example.
AR300M:

route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.1 dev wlan0

XE300:

ip route-static 192.168.200.0 255.255.255.0 192.168.8.5

Local network is 192.168.8.0/24.
Laptop(192.168.8.181)->(lan)->XE300(192.168.8.1)->(lan)->AR300M(192.168.8.5)->(wifi)->Inverter(192.168.200.1)
I have set a route on XE300 to 192.168.200.1 via 192.168.8.5.
I can ping 192.168.200.1 as i have set a firewall port forwarding for the ICMP protocol.
I have also set firewall port forwarding for port 6607 (inverter modbus).
A telnet session from 192.168.8.181 to 192.168.200.1 port 6607 is without response.
A telnet session from 192.168.8.5 is connected.

The routing seems to work now. When i try to telnet from 192.168.8.181 to 192.168.200.1 on port 6607 i now get
Trying 192.168.200.1...
telnet: Unable to connect to remote host: Connection refused
But i don't know yet what causes the refusal.
ping is working:

PING 192.168.200.1 (192.168.200.1) 56(84) bytes of data.
64 bytes from 192.168.200.1: icmp_seq=1 ttl=64 time=4.26 ms
From 192.168.8.1: icmp_seq=2 Redirect Host(New nexthop: 192.168.8.5)
64 bytes from 192.168.200.1: icmp_seq=2 ttl=64 time=4.54 ms

It seems to be a problem of the Huawei inverter. The routing and firewall rules seem to be ok. But the inverter does not accept connections outside it's own network, that is 192.168.200.0/24, even not with SNAT set to the wifi client ip. Is there anything else i could configure to convince the inverter that the connection comes from the AR300M?

It is working when i add two rules via iptables command:

iptables -I PREROUTING -t nat -p tcp -d 192.168.8.5 --dport 6607 -j DNAT --to-destination 192.168.200.1:6607
iptables -I POSTROUTING -t nat -d 192.168.200.1 -s 192.168.8.0/24 -p tcp --dport 6607 -j SNAT --to 192.168.200.2

But these additions seem not to be persisted across reboot and i have not found the equivalent configuration option via luci.

Found out about /etc/firewall.user to replay the iptables commands on reboot.
I regard my problem as solved.

The problem is not resolved yet. I can connect from a python modbus test script to the inverter via 192.168.8.5 now, but a read request is terminated with connection reset by peer.

Final comment.
I have reset the installer password of my Huawei inverter and connected the inverter via WLAN to my local network 198.168.8.0/24.
I have abandoned the route to use a LAN to WLAN bridge as all my efforts were unsuccessful to get it working.

1 Like