I'm trying to access my local network from the internet. My setup: ISP adsl modem with internet connection, default firmware (192.168.1.1) TP-Link OpenWRT Wifi router behind ISP modem to share Internet (192.168.2.1) My PC with MAMP connected to TP-Link's Wifi (dynamic local ip, let's say 192.168.1.158)
I have domain name from FreeDNS provider mywebsite.mooo.com and ddns scripts installed in openwrt.
config ddns 'global'
option date_format '%F %R'
option log_lines '250'
option allow_local_ip '0'
config service 'myddns_ipv4'
option username 'your_username'
option interface 'wan'
option ip_source 'web'
option ip_url 'http://ip.changeip.com'
option enabled '1'
option service_name 'freedns.afraid.org'
option domain 'mywebsite.mooo.com'
option password 'http://sync.afraid.org/u/my_key/'
option use_syslog '2'
option use_logfile '1'
It works fine when I'm in this local network - I can access my ISP modem's web interface. The problem is - it isn't working from the outside of LAN network.
I was trying to configure port forwarding on the TP-LINK, like this:
config redirect
option target 'DNAT'
option src 'wan'
option dest 'lan'
option proto 'tcp udp'
option src_dport '81'
option dest_port '81'
option name 'local-web-81'
option dest_ip '192.168.2.144'
This IP 192.168.2.144 was suggested in the LUCI interface, it's my desktop PC with MAMP. Also I was trying to change it manually to 192.168.1.158 (same PC in the main network) and still had no result at all. Even from LAN I can't access my MAMP using domain name with port 'mywebsite.mooo.com:81/'.
So I have 2 questions:
- how to redirect this particular address 'mywebsite.mooo.com' to any custom lan ip:port correctly (192.168.1.158:81 in my case), I don't want it to point to modem's web interface
- how to enable access to it from the internet? Do I need to change settings on ISP modem as well (the problem is that I don't have login/password to enter into web interface yet, but I have requested them and hope to receive eventually)?
EDIT: network config from openwrt router
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fda5:9a54:873f::/48'
config interface 'lan'
option ifname 'eth0'
option force_link '1'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.2.1'
config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option macaddr '15:AA:69:44:B2:17'
option type 'bridge'
config interface 'wan6'
option ifname 'eth1'
option proto 'dhcpv6'
option macaddr '15:AA:69:44:B2:17'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '0 1 2 3 4'
EDIT 2:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 br-wan
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br-wan
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 br-wan
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
ip r |grep ^default
)ip
command, useroute -n
. There should be an entry with0.0.0.0
.0.0.0.0
at the beginning is the line that is important here. As you see, the target is192.168.1.1
, a private address. And whoever downvoted this, I was correct to assume that it is a router and not just a modem. So unless you can arrange a port forwarding on the modem/router, you can't accept connections from the outside.