hello,
i am trying to add one hairpin rule to my running router without any success.... any idea why?
root@OpenWrt-main-router:~# iptables -t nat -A PREROUTING -i br-lan -s 10.0.1.0/24 -d {Public_IP_ADDR}/32 -p tcp -m tcp --dport 8123 -j DNAT --to-destination 10.0.1.104:8123
root@OpenWrt-main-router:~# iptables -t nat -A POSTROUTING -o br-lan -s 10.0.1.0/24 **-d 10.0.1.104/32** -p tcp -m tcp --dport 8123 -j SNAT --to-source 10.0.1.104
i also tried
iptables -t nat -A POSTROUTING -o br-lan -s 10.0.1.0/24 **-d 10.0.1.1** -p tcp -m tcp --dport 8123 -j SNAT --to-source 10.0.1.104
scenario is almost the same as described here ... just different ports of service instead of 25 ... its 8123
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
prerouting_rule all -- anywhere anywhere /* !fw3: Custom prerouting rule chain */
zone_lan_prerouting all -- anywhere anywhere /* !fw3 */
zone_lan_prerouting all -- anywhere anywhere /* !fw3 */
zone_wan_prerouting all -- anywhere anywhere /* !fw3 */
DNAT tcp -- 10.0.1.0/24 PUBLIC_IP tcp dpt:8123 to:10.0.1.104:8123
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
postrouting_rule all -- anywhere anywhere /* !fw3: Custom postrouting rule chain */
zone_lan_postrouting all -- anywhere anywhere /* !fw3 */
zone_lan_postrouting all -- anywhere anywhere /* !fw3 */
zone_wan_postrouting all -- anywhere anywhere /* !fw3 */
SNAT tcp -- 10.0.1.0/24 OpenWrt-main-router.lan tcp dpt:8123 to:10.0.1.104
Chain zone_wan_postrouting (1 references)
target prot opt source destination
postrouting_wan_rule all -- anywhere anywhere /* !fw3: Custom wan postrouting rule chain */
MASQUERADE all -- anywhere anywhere /* !fw3 */
and there are also these rules as part of the port forwarding
root@OpenWrt-main-router:~# iptables -L -t nat | grep 8123
DNAT tcp -- 10.0.1.0/24 {iPUBLIC_IP} tcp dpt:8123 to:10.0.1.104:8123
SNAT tcp -- 10.0.1.0/24 homeassistant.lan tcp dpt:8123 to:10.0.1.104
SNAT tcp -- 10.0.1.0/24 homeassistant.lan tcp dpt:8123 /* !fw3: hass (reflection) */ to:10.0.1.1
SNAT tcp -- 192.168.9.0/24 homeassistant.lan tcp dpt:8123 /* !fw3: hass (reflection) */ to:192.168.9.1
DNAT tcp -- 10.0.1.0/24 192.168.0.4 tcp dpt:8123 /* !fw3: hass (reflection) */ to:10.0.1.104:8123
DNAT tcp -- 192.168.9.0/24 192.168.0.4 tcp dpt:8123 /* !fw3: hass (reflection) */ to:10.0.1.104:8123
DNAT tcp -- anywhere anywhere tcp dpt:8123 /* !fw3: hass */ to:10.0.1.104:8123
where 192.168.0.4 is the IP of the router to which is my openwrt router connected via its wlan iface.
and 192.168.9.1 is openvpn interface
any idea - what is wrong?
thanks!