OpenWrt Forum Archive

Topic: Accessing my DSL router from my LAN

The content of this topic has been archived on 9 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

My home network is setup in a fairly standard way: a bunch of machines on a LAN connected to an (OpenWRT) WRTSL54GS Linksys router doing a PPPoE connection over a DSL line via a DSL modem.
Now, my DSL modem provides some useful web pages to get DSL statistics and configuration and I'd like to be able to access it from any machine on the LAN.

So let's say my LAN uses 192.168.1.NN addresses and I've setup my DSL modem to use IP address 192.168.2.3 (it's on another network, obviously, connected to the WAN port of the router).

On the router I did "ifconfig eth1 192.168.2.4" which gives an IP address to my WAN connection and sets up a route, so I can now connect to my modem from my router.  This works fine.

But when trying to connect from other machines on my LAN, this doesn't work: presumably the packets do go to the router (thanks to the defaultrule) and then from there to modem, but the modem doesn't know how to reply to 192.168.1.XX.  Maybe I could try and setup a route on my modem to access the 192.168.1.XX network via my router, but I'm not sure how I could do that (sadly this DSL box isn't running OpenWRT), so another option is to use NAT.

I tried "iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 192.168.2.4" but it doesn't seem to do what I want.  Could someone help me out?

The snat should be working, that is how I have mine setup.  You can check outgoing packets on eth1 with tcpdump.  you might also want to limit what source packets can use this rule. PLus because its a -A it append to the end of the table, check what is before this rule.

Thanks.  I finally figured it out: it turns out that the problem was in the FORWARD: it only allows forwarding from br0 to br0 and from $LAN to $WAN (where $LAN is br0 and $WAN is the ppp0), but not from $LAN to $WANDEV (the eth1 on which is connected my modem).
Makes me curious: why allow br0->br0 and $LAN->$WAN?
I'd have expected a rule that allows from $LAN to anywhere.
(tho maybe it's different in kamikaze: I'm still on whiterussian here).

This is interesting, have you figured out how to make it work?

The discussion might have continued from here.