2

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:

  1. 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
  2. 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
tonyAndr
  • 21
  • 4
  • Are you sure your ISP adsl modem is really just a modem and not a router? Having 192.168.1.x and 192.168.2.x at the OpenWRT would suggest that you have a router. You would need to setup port forwarding in that router as well. TO verify, what is the default gateway in your OpenWRT? (`ip r |grep ^default`) – RalfFriedl Aug 19 '18 at 14:13
  • Yes, it is adsl router, but since I don't have access to its admin interface and prefer to use openwrt (which doesn't support adsl) - I have additional wifi router behind it. Sorry, idk how to use this command, SSH says that 'ip' not found. I edited my question and added network cfg from second router. – tonyAndr Aug 19 '18 at 14:26
  • If your OpenWRT doesn't know the `ip` command, use `route -n`. There should be an entry with `0.0.0.0`. – RalfFriedl Aug 19 '18 at 14:32
  • there are several, see EDIT 2 – tonyAndr Aug 19 '18 at 14:46
  • 1
    The first line with `0.0.0.0` at the beginning is the line that is important here. As you see, the target is `192.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. – RalfFriedl Aug 19 '18 at 14:54
  • Ok, gotta wait for ISP's answer. I wasn't sure where is the problem, but suspected the same thing you suggested. Thanks you, will update this topic as soon as they answer me (wasn't my downvote btw). – tonyAndr Aug 19 '18 at 15:04
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/81930/discussion-between-tonyandr-and-ralffriedl). – tonyAndr Aug 20 '18 at 11:16

1 Answers1

0

As RalfFriendl said, my first adsl modem was actually a router and I needed to setup port forwarding on it as well.

Thanks for you help.

tonyAndr
  • 21
  • 4