Accessing the modem through the router
Introduction
- This how-to describes the method for accessing the modem connected to your OpenWrt router.
- It helps to reach the administrative interface of a DSL/DOCSIS modem operating in the bridge mode.
- The prerequisite is to know the modem's IP address, port/protocol and username/password.
Goals
- Access the modem operating in the bridge mode through the router.
Web interface instructions
Assuming your modem's IP address is 192.168.100.1
and it is connected to the router's WAN interface.
- Navigate to LuCI → Network → Interfaces.
- Click Add new interface... and specify:
- Name:
modem
- Protocol: Static address
- Interface:
@wan
- Click Create interface.
- On the General Settings tab specify:
- IPv4 address:
192.168.100.2
- IPv4 netmask:
255.255.255.0
- Navigate to LuCI → Network → Firewall.
- Under General Settings tab, scroll down to Zones.
- Edit the
wan
zone.- Open
Covered Networks
list box. - Add
modem
- Click Save, then Save & Apply.
At this point the modem should be reachable from any host in the LAN.
NOTE
If you are using the BanIP package, make sure to add the IP to the allowlist. Ex. 192.168.100.0/24
Command-line instructions
Assuming your modem's IP address is 192.168.100.1
and it is connected to the router's WAN interface.
Set up a static WAN alias and assign it to the WAN zone.
# Configure network uci -q del network.modem uci set network.modem="interface" uci set network.modem.proto="static" uci set network.modem.device="@wan" uci set network.modem.ipaddr="192.168.100.2" uci set network.modem.netmask="255.255.255.0" uci commit network service network restart # Configure firewall uci del_list firewall.@zone[1].network="modem" uci add_list firewall.@zone[1].network="modem" uci commit firewall service firewall restart
Make sure the modem subnet doesn't overlap with your LAN, otherwise change the LAN subnet.
# Configure network uci set network.lan.ipaddr="192.168.2.1" uci commit network service network restart
If the WAN L2 device doesn't match L3 device like in case of PPPoE, change the modem interface.
# Fetch WAN L2 device . /lib/functions/network.sh network_flush_cache network_find_wan NET_IF network_get_physdev NET_L2D "${NET_IF}" # Configure network uci set network.modem.device="${NET_L2D}" uci commit network service network restart