S1
Virtual Machine 1: Ubuntu app server
Virtual Machine 2: MariaDB 1
S2
Virtual Machine 3: Ubuntu app server
Virtual Machine 4: MariaDB 2
from vm04 and 03 I can connect to DB1 with connection string with port 3306 but I can't connect DB2 from vm01 and 02
telnet can connect from 3306 to DB2
both of DB's MariaDB 10.6 and all of the VM's has got same configuration. VM03 can connect to DB2.
When I listening to DB2 traffic with tcpdump I can see that the requests are arriving to DB but what happens after that I do not know exactly.
Any idea:
netstat -tulpn | grep LISTEN | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5145/mariadbd
tcp6 0 0 :::3306 :::* LISTEN 5145/mariadbd
edit:
error message of DB1
2023-02-27 12:32:17 5771 [Warning] Aborted connection 5771 to db: 'testdev' user: 'testuser' host: 'vm02' (Got timeout reading communication packets)
route -n (db2)
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 PublicIP 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.1.151 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
s1 192.168.2.0/24
s2 192.168.1.0/24
iptables
iptables -A FORWARD -p tcp --source 192.168.2.1/24 --dport 3306 -j ACCEPT
iptables -A FORWARD -p tcp --source 192.168.2.1/24 --dport 3307 -j ACCEPT
iptables -A INPUT -p tcp --source 192.168.2.1/24 --dport 3306 -j ACCEPT
iptables -A INPUT -p tcp --source 192.168.2.1/24 --dport 3307 -j ACCEPT
same for 1.1./24 subnets