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