Forums

kripz
kripz
Offline
Resolved
0 votes
I want to be able to access my modem's CP from behind my router. This is possible on other linux based routers using simple iptable rules (not for me :laugh: ). See below for examples.

You only need two lines in the firewall script. For example, my modem is 192.168.1.x and my router 192.168.0.x, so I use the script below:

ip addr add 192.168.1.1/24 dev $(nvram get wan_ifname) brd +
iptables -I POSTROUTING -t nat -o $(nvram get wan_ifname) -d 192.168.1.0/24 -j MASQUERADE

The first line uses an ip on the same subnet as the modem (but no the modems ip) while the second an ip on the routers subnet (but not the routers ip). Assuming the ips you provided are correct this should work:

ip addr add 169.254.1.0/8 dev $(nvram get wan_ifname) brd +
iptables -I POSTROUTING -t nat -o $(nvram get wan_ifname) -d 169.254.1.9/8 -j MASQUERADE

Just paste those two line into the firewall script page, save, reboot, profit?


http://www.linksysinfo.org/forums/showthread.php?t=65251
http://www.linksysinfo.org/forums/showthread.php?t=65958
http://www.linksysinfo.org/forums/showthread.php?t=65579

I cant see why this isnt possible on ClearOS.

Anyone know how i can modify the rules to achieve this?
Sunday, March 27 2011, 04:33 AM
Share this post:
Responses (5)
  • Accepted Answer

    Sunday, March 27 2011, 08:00 AM - #Permalink
    Resolved
    0 votes
    What is your LAN subnet and modem IP address?
    The reply is currently minimized Show
  • Accepted Answer

    kripz
    kripz
    Offline
    Monday, March 28 2011, 08:15 AM - #Permalink
    Resolved
    0 votes
    Modem ip is 192.168.0.2

    Router is 192.168.1.1
    The reply is currently minimized Show
  • Accepted Answer

    Monday, March 28 2011, 07:50 PM - #Permalink
    Resolved
    0 votes
    I don't use ADSL so I can't check and I did not realise you cannot access your modem directly whenever it is in bridge mode. Looking at your links you may want to try:
    iptables -I POSTROUTING -t nat -o ethx -d 192.168.0.0/24 -j MASQUERADE
    ip addr add 192.168.0.0/24 dev ethx brd +

    where ethx is your WAN interface. I've no idea what the brd bit in the ip command means.

    An alternative solution I bumped into was to create a virtual interface on your WAN and give it an address of 192.168.0.1. You can do that through the webconfig. This seems to me to be much simpler.
    The reply is currently minimized Show
  • Accepted Answer

    robin
    robin
    Offline
    Wednesday, September 05 2012, 06:37 AM - #Permalink
    Resolved
    0 votes
    Hey all,

    This is a pretty old thread but yesterday I finally managed to get access to my DSL modem through my clearos Gateway.

    I used this post found after much head scratching and facepalming:
    http://forums.whirlpool.net.au/archive/1939553

    any way after basically following the steps provided I managed to get it working.

    My steps were as follows:

    Firstly I setup a virtual ip address on the same subnet as my modem under ip settings on the clearos webconfig, for this example let just say 192.168.0.1 is my modems ip so I created the virtual ip as 192.168.0.10 please note i didnt just make it 192.168.0.2 as that is the ip clearos is using to connect to the modem and authenticate my PPPOE,
    the next step is to install the custom firewall module available from the webconfig via ClearCenter-->Software Modules.
    Once that is installed you then need to create a custom rule allowing computers on your lan to connect direct to the DSL modems config.
    The rule I used was one that I got from the post mentioned above,
    In my case it is: iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
    note that the interface mentioned is ETH0 and not PPP0 I am not sure why this is but in clearos ETH0 Is still present despite the wan interface being labled as PPP0.
    Anyway once you have entered and saved the custom rule you just have to save it, you will be asked if you want to have this rule run before all others, in my case I just clicked yes.
    voila you should now be able to access your modem using the ip address for your modem, in my case 192.168.0.1

    Please let me know if this helps anyone else.

    edit: fixed the typo Nick :)
    Also I just wanted to add that once the rule is in place I had to add the IP address of my DSL modem to the web proxy website bypass list to get it to allow me to access via web browser.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, September 05 2012, 11:23 AM - #Permalink
    Resolved
    0 votes
    Thanks for the confirmation. Your iptables rule is pretty much the same as the first one I posted except my one also restricts the rule to the destination address range. You can probably safely add that restriction.

    BTW you have a typo in the last line of your post. You may want to change "not" to "now"!
    The reply is currently minimized Show
Your Reply