Jeśli chodzi o OpenWrt i Serwer NC to wygląda, że tam wszystko przechodzi. Tak jakby problem był na serwerze VPS, a dokładnie miedzy publicznym interfejsem ens3, a VPNowym tun0. Poniżej testy śledzenia pakietów na ens3. Przy włączonym SNAT łączę się do 443. Zrobiłem nawet taki test, że wyłączyłem port forwarding w OpenWRT aby zobaczyć czy ze świata mogę dostać się na router w domu przez VPS i tunel. Objawy są te same. Gdy na firewallu ustawię MASQUERADE dostępu do openwrt na port 80 nie ma. Przełączając na SNAT dostaję się ze świata na OpenWrt na port 80.
Poniżej testy śledzenia pakietów na ens3 na VPS.
test telnet na port 443 z komórki :
VPS - MASQUERADE=off SNAT=on,
OpenWrt - Masq=off
94.254.236.12 - adres publiczny mojej kom
root@vps-xxxxxxxx ~ # tcpdump -i ens3 dst 94.254.236.12 or src 94.254.236.12
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:48:49.959254 IP user-94-254-236-12.play-internet.pl.24497 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 1518689419, win 65535, options [mss 1408,sackOK,TS val 4036882909 ecr 0,nop,wscale 9], length 0
15:48:50.015433 IP vps-xxxxxxxx.vps.ovh.net.https > user-94-254-236-12.play-internet.pl.24497: Flags [S.], seq 3549081893, ack 1518689420, win 65160, options [mss 1289,sackOK,TS val 3282925844 ecr 4036882909,nop,wscale 7], length 0
15:48:50.037273 IP user-94-254-236-12.play-internet.pl.24497 > vps-xxxxxxxx.vps.ovh.net.https: Flags [.], ack 1, win 172, options [nop,nop,TS val 4036882998 ecr 3282925844], length 0
15:49:08.759223 IP user-94-254-236-12.play-internet.pl.24497 > vps-xxxxxxxx.vps.ovh.net.https: Flags [P.], seq 1:6, ack 1, win 172, options [nop,nop,TS val 4036901713 ecr 3282925844], length 5
15:49:09.014350 IP vps-xxxxxxxx.vps.ovh.net.https > user-94-254-236-12.play-internet.pl.24497: Flags [.], ack 6, win 510, options [nop,nop,TS val 3282944839 ecr 4036901713], length 0
15:49:09.014457 IP vps-xxxxxxxx.vps.ovh.net.https > user-94-254-236-12.play-internet.pl.24497: Flags [F.], seq 1, ack 6, win 510, options [nop,nop,TS val 3282944839 ecr 4036901713], length 0
15:49:09.049177 IP user-94-254-236-12.play-internet.pl.24497 > vps-xxxxxxxx.vps.ovh.net.https: Flags [F.], seq 6, ack 2, win 172, options [nop,nop,TS val 4036902010 ecr 3282944839], length 0
15:49:09.066322 IP vps-xxxxxxxx.vps.ovh.net.https > user-94-254-236-12.play-internet.pl.24497: Flags [.], ack 7, win 510, options [nop,nop,TS val 3282944896 ecr 4036902010], length 0
test telnet na port 443 z komórki :
VPS - MASQUERADE=on SNAT=off,
OpenWrt - nadal Masq=off
94.254.236.12 - adres publiczny mojej kom
root@vps-xxxxxxxx ~ # tcpdump -i ens3 dst 94.254.236.12 or src 94.254.236.12
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on ens3, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:57:56.993234 IP user-94-254-236-12.play-internet.pl.24498 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 2574686285, win 65535, options [mss 1408,sackOK,TS val 4037429858 ecr 0,nop,wscale 9], length 0
15:57:57.949123 IP user-94-254-236-12.play-internet.pl.24498 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 2574686285, win 65535, options [mss 1408,sackOK,TS val 4037430889 ecr 0,nop,wscale 9], length 0
15:57:59.949103 IP user-94-254-236-12.play-internet.pl.24498 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 2574686285, win 65535, options [mss 1408,sackOK,TS val 4037432889 ecr 0,nop,wscale 9], length 0
15:58:03.940161 IP user-94-254-236-12.play-internet.pl.24498 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 2574686285, win 65535, options [mss 1408,sackOK,TS val 4037436889 ecr 0,nop,wscale 9], length 0
15:58:12.260061 IP user-94-254-236-12.play-internet.pl.24498 > vps-xxxxxxxx.vps.ovh.net.https: Flags [S], seq 2574686285, win 65535, options [mss 1408,sackOK,TS val 4037445209 ecr 0,nop,wscale 9], length 0
^C
5 packets captured
5 packets received by filter
0 packets dropped by kernel
root@vps-xxxxxxxx ~ #Edit
Ruszyło na MASQUERADE
Zmieniłem:
iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
na:
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
do serwera NC dalej docierają pakiety z 10.8.88.1, a nie z public IP.