1

I hope someone can help me. This server issue I have is driving me crazy!

So I have the following configuration:

                                                      INTERNET
                                                         |
                                               +----------------------+
                                               | MODEM/ROUTER         |
                             +-----------------+----------------------+
                             |                 | IP: 192.168.2.254/24 |
                 +----------------------+      +----------------------+
                 | WIFI HOME-NETWORK    |                |
                 +----------------------+                |
                 | WLAN: 192.168.2.*/24 |                |
                 +----------------------+                |
                                                         |
+-----------------------+                    +------------------------+
| HUAWEI SOLAR INVERTER |                    | HOME AUTOMATION SERVER |
+-----------------------+                    +------------------------+
| MODEL: 6KTL-M0        |                    |           UBUNTU 16.04 |
| IP: 192.168.8.1/24    |                    |                 ENP1S0 |
| WLAN: 192.168.8.*/24  |                    |    IP: 192.168.2.49/24 |
|          +--------------------------------------------+             |
+----------| SOLAR SERVER                               |-------------+
           +----------------------+---------------------+
           | WLAN0                |                ETH0 |
           | IP: 192.168.8.100/24 | IP: 192.168.2.35/24 |
           |                      |        SSH listener |
           +----------------------+---------------------+

And I'm having this problem that whatever I try to change in my route, I can't get a result pinging from 192.168.2.49 (HOME AUTOMATION SERVER) to the IP of the HUWAEI SOLAR INVERTER. However in this same secondary subnet I can reach the WLAN0 IP of the SOLAR SERVER (RPI).

I've added NAT on SOLAR SERVER with the following commands.

solar-server:~ $sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
solar-server:~ $sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j  ACCEPT
solar-server:~ $sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT

I've added these iptables changes into my /etc/network/interfaces so it will be sustainable also on reboot.

Since I'm not a netwerk-guru I so stuck with this. I tried all similar cases which I found, but none seems to work in my situation. Is there anyone who can give me some clue or help?

Below mentioned I summarized the ping-results in this matter.

+---------------------------------------+
| PING RESULTS                          |
+--------------+---------------+--------+
| FROM         | TO            | RESULT |
+--------------+---------------+--------+
| 192.168.2.49 | 192.168.2.35  | SUCCES |
| 192.168.2.49 | 192.168.8.1   | FAIL   | <--MAIN ISSUE!
| 192.168.2.49 | 192.168.8.100 | SUCCES |
| 192.168.2.35 | 192.168.2.49  | SUCCES |
| 192.168.2.35 | 192.168.2.254 | SUCCES |
| 192.168.2.35 | 192.168.8.1   | SUCCES |
| 192.168.2.35 | 192.168.8.100 | SUCCES |
+--------------+---------------+--------+

And I copied in the ip route of both servers.

home-automation-server:~ $ ip route
default via 192.168.2.254 dev enp1s0
192.168.2.0/24 dev enp1s0  proto kernel  scope link  src 192.168.2.49
192.168.8.0/24 via 192.168.2.35 dev enp1s0  proto static  src 192.168.2.49
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 linkdown

solar-server:~ $ ip route
default via 192.168.2.254 dev eth0 proto dhcp src 192.168.2.35 metric 202
192.168.2.0/24 dev eth0 proto dhcp scope link src 192.168.2.35 metric 202
192.168.8.0/24 dev wlan0 proto dhcp scope link src 192.168.8.100 metric 303 mtu 1500
Jeroen
  • 11
  • 3
  • What up with `SOLAR SERVER` frame overlapping HAS and HSI? This is other link or connection via router / modem? – DevilaN Nov 12 '20 at 07:57
  • 1. remove the `default via 192.168.8.1` on solar server. It's not a default route as it knows nothing about unknown networks. 2. does solar server do NAT when traffic passes from 192.168.2 to 192.168.8? If not, does your inverter either have a default route via solar server or an explicit route to 192.168.2 via that solar server? 3. if solar server is a Linux machine have you enabled IP forwarding? 4. Does Ubuntu 49 have a static route to solar server for the 192.168.8 subnet? If not it won't know how to get there and will send the traffic via its default route instead – roaima Nov 12 '20 at 08:17
  • Please [edit] your question to respond. Do not reply in comments unless you need clarification from my response. Your question should remain as readable as possible, so don't just add your response at the bottom of the text; fit it in where it makes most readable sense - as if you'd included the information originally – roaima Nov 12 '20 at 08:19
  • @DevilaN solar server is connected on wlan0 to the solar invert en by eth0 to my home network – Jeroen Nov 12 '20 at 10:27
  • @roaima mentioning question 2 I don’t know exactly how to add a default route or a explicit route from solar server to 192.168.2. Regarding question 4 how do I do that? – Jeroen Nov 12 '20 at 10:29
  • @Jeroen If I'm not mistaken, `ip route add 192.168.8.0/24 via 192.168.2.35` should work for 4. (But you already seem to have that). Do you you have ip forwarding enabled on the `SOLAR SERVER`? `sysctl -a | grep net.ipv4.ip_forward` If not, it won't act as a gateway. – rudib Nov 13 '20 at 19:52

1 Answers1

0

Fixed the issue by adding ‘ up route add -net 192.168.8.0/24 gw 192.168.2.35 dev enp1s0’ to /etc/network/interfaces’ thanks for the time, understand and giving me the directions of learning to add a static route. That did the tric!

Jeroen
  • 11
  • 3
  • Hey @Jeroen, what was the resulting content in your /etc/network/interfaces? I am trying the same thing here and I need a nudge. – Zooking May 31 '21 at 09:00