Hallo beisammen,
ich würde gerne von A nach B den SMTP Port weiterleiten - als Port Forwarding. Ich habe folgendes auf A versucht:
1 2 3 4 | iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to xxx.xxx.xxx.xxx iptables -t nat -A POSTROUTING -p tcp -d xxx.xxx.xxx.xxx -j MASQUERADE iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -m state --state NEW -p tcp --dport 25 -d xxx.xxx.xxx.xxx -j ACCEPT |
allerdings funktioniert das leider noch nicht. xxx.xxx.xxx.xxx ist hierbei die Ziel-IP, wo die Anfragen von Port 25 auf A bei B ebenfalls auf Port 25 ankommen sollten. Die Übersicht auf A gibt folgendes aus:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | root@j336441:~# iptables -vL Chain INPUT (policy ACCEPT 205 packets, 16233 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED 0 0 ACCEPT tcp -- any any anywhere xxx.xxx.xxx.xxx state NEW tcp dpt:smtp Chain OUTPUT (policy ACCEPT 175 packets, 18776 bytes) pkts bytes target prot opt in out source destination root@j336441:~# iptables -t nat -vL Chain PREROUTING (policy ACCEPT 50 packets, 2549 bytes) pkts bytes target prot opt in out source destination 8 440 DNAT tcp -- any any anywhere anywhere tcp dpt:smtp to:xxx.xxx.xxx.xxx Chain INPUT (policy ACCEPT 50 packets, 2549 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 2 packets, 148 bytes) pkts bytes target prot opt in out source destination Chain POSTROUTING (policy ACCEPT 2 packets, 148 bytes) pkts bytes target prot opt in out source destination 0 0 MASQUERADE tcp -- any any anywhere xxx.xxx.xxx.xxx |
Daraus schließe ich, dass es wohl bereits beim Prerouting zu haken/ das Paket zu hängen scheint. Allerdings konnte ich bisher nicht finden was genau der Fehler ist. Vielleicht steh ich nur grad etwas auf dem Schlauch oder übersehe ich da einfach nur was?
Vielen Dank schon mal für eure Hilfe ☺
Grüße