S
S
Sam Stay2017-09-04 19:04:30
linux
Sam Stay, 2017-09-04 19:04:30

How to make it possible to connect to local services on OpenWrt (LEDE) on local machines from an external IP?

How to make openwrt so that you can connect to local services on local machines from an external IP?
I somehow found information about this, but it was a long time ago and I don’t remember anymore.
The scheme is as follows:
There is a router with openwrt. It has openvpn. From the outside, I can connect to this openvpn. And when I try to connect from the inside, to an external IP address, the connection does not work. This is necessary so that being on the internal network, you do not need to change the IP address of the server to connect to in the ovpn config.
Clarification:
The device (telephone laptop) is in the internal network (192.168.1.0/24), and when I try to connect to the external IP (xxx.xxx.xxx.xxx) from this network, the connection fails. But if the device is not in the network, then the connection goes through without problems.
Previously, everything worked without problems on pure OpenWrt, when I switched to LEDE, such a problem appeared.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sam Stay, 2017-09-05
@savenko_egor

This is how it worked from the inside:
iptables -t nat -A prerouting_rule -d $EXTERNAL_IP -p udp -j DNAT --to $ROUTER_IP
iptables -A forwarding_rule -p udp -d $ROUTER_IP -j ACCEPT
iptables -t nat -A postrouting_rule -s $NETWORK/24 -p udp -d $ROUTER_IP -j MASQUERADE
But now it doesn't connect outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question