Access To Modem Configuration

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:36, 11 November 2013 (edit)
JNavas (Talk | contribs)
(Primary Method - add Success Report)
← Previous diff
Revision as of 19:37, 11 November 2013 (edit) (undo)
JNavas (Talk | contribs)
m (Case of a Bridged modem - minor edit)
Next diff →
Line 14: Line 14:
By default if you type the IP address of the modem you have an "Impossible to contact the server" error. By default if you type the IP address of the modem you have an "Impossible to contact the server" error.
 +
=== Primary Method === === Primary Method ===
Line 46: Line 47:
'''Note: With WAN access, important to set ''strong'' passwords on both modem and DD-WRT.''' '''Note: With WAN access, important to set ''strong'' passwords on both modem and DD-WRT.'''
 +
===Alternate Method=== ===Alternate Method===

Revision as of 19:37, 11 November 2013

Contents


Case of a Bridged modem

Introduction

In this case the router itself creates the PPPoE connection to the ISP server; but to work, the connection between the modem and the router must have an IP address. Usually the modem gives an address to the client; but this address will never be used except to access the configuration interface of the modem.

My modem is a Speedtouch 510, is IP address is 10.0.0.138 and it gives the 10.0.0.1 address to the device connected to it. The easiest way to know these addresses is to connect the modem directly to your computer and take a look at your network card configuration. The default gateway is the Modem address and the Card address is the one provided by the modem.

Note: Many modems come configured to use the 192.168.1.x subnet. This is the same subnet that DD-WRT uses for the LAN by default. You need to either set the modem to use a different subnet or set the router's LAN to use an IP in a different subnet such as 192.168.2.1 so that they're not using the same subnet.

So it looks like this.

image:access.to.modem.png

By default if you type the IP address of the modem you have an "Impossible to contact the server" error.


Primary Method

Replace the 10.0.0.2 with an IP in the same range as the modem. If your modem is 10.0.0.1, you should use 10.0.0.2. If your modem is 192.168.0.1, use 192.168.0.2

  • Go to Administration -> Commands
  • Enter
ifconfig `nvram get wan_ifname`:0 10.0.0.2 netmask 255.255.255.0

and click on Save Startup

  • Enter
iptables -t nat -I POSTROUTING -o `nvram get wan_ifname` -j MASQUERADE

and click on Save Firewall

Notes:

  1. `nvram get wan_ifname` gets the WAN port of your router automatically. If you wish to enter it manually, you should run echo `nvram get wan_ifname` to get your WAN interface name.


Success Report

Environment:

  • ADSL2+ service with static IP (no PPPoE or DHCP)
  • TP-LINK TD-8817 ADSL2+ Modem Router configured as bridge with web page at 192.168.1.1
  • Linksys E1200v2 Wireless Router with DD-WRT 21676 and LAN address of 192.168.2.1

Administration > Commands

ifconfig `nvram get wan_ifname`:0 192.168.1.2 netmask 255.255.255.0

[Save Startup]

iptables -t nat -I POSTROUTING -o `nvram get wan_ifname` -j MASQUERADE

[Save Firewall]

NAT / QoS > Port Forwarding

DSL Modem   Both                   8081   192.168.1.1   80

[so modem web page can be accessed from WAN as well as LAN]

Note: With WAN access, important to set strong passwords on both modem and DD-WRT.


Alternate Method

An alternative way to execute the above commands on startup if you have JFFS enabled is the following:

  • Log in via ssh/telnet
  • create a file with the following content:
#!/bin/sh 
ifconfig `nvram get wan_ifname`:0 10.0.0.2 netmask 255.255.255.0
  • save it as "/jffs/etc/config/modem.startup"
  • create another file with the following content:
#!/bin/sh 
iptables -t nat -I POSTROUTING -o `nvram get wan_ifname` -j MASQUERADE
  • save it as "/jffs/etc/config/modem.wanup"
  • make them executable:
chmod +x /jffs/etc/config/modem.*