Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:network:wan:access.modem.through.nat [2021/03/04 13:16] – update vgaeteradocs:guide-user:network:wan:access.modem.through.nat [2024/10/30 00:44] – [Web interface instructions] Easier to assign the "modem" interface to the "wan" zone. lastedit
Line 1: Line 1:
-====== Accessing your modem ====== +====== Accessing the modem through the router ====== 
-DSL/DOCSIS modems can operate in the bridge mode and provide internet to your OpenWrt router. +{{section>meta:infobox:howto_links#basic_skills&noheader&nofooter&noeditbutton}}
-To access the modem administrative interface, you need to find out the its IP address and the port/protocol it is using. +
-Sometimes you additionally need the correct username and the password to gain access or to apply changes.+
  
-===== Command-line interface ===== +===== Introduction ===== 
-Assuming that your modem address is `192.168.100.1/24` set up a static WAN [[docs:guide-user:network:network_interface_alias|alias]]:+  * 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.
  
-<code bash> +===== Goals ===== 
-# Configure firewall +  * Access the modem operating in the bridge mode through the router.
-uci add_list firewall.@zone[1].network="modem" +
-uci commit firewall +
-/etc/init.d/firewall restart+
  
 +===== 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''
 +  - On the **Firewall Settings** tab assign the ''modem'' interface to the ''wan'' zone:
 +    * Create / Assign firewall-zone: ''wan''
 +  - 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 [[docs:guide-user:network:network_interface_alias|alias]] and assign it to the WAN zone.
 +
 +<code bash>
 # Configure network # Configure network
-uci -q delete network.modem+uci -q del network.modem
 uci set network.modem="interface" uci set network.modem="interface"
-uci set network.modem.ifname="@wan" 
 uci set network.modem.proto="static" 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.ipaddr="192.168.100.2"
 uci set network.modem.netmask="255.255.255.0" uci set network.modem.netmask="255.255.255.0"
 uci commit network uci commit network
-/etc/init.d/network restart+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
 </code> </code>
  
-Make sure the modem subnet doesn't overlap with your LAN, otherwise change the LAN subnet:+Make sure the modem subnet doesn't overlap with your LAN, otherwise change the LAN subnet.
  
 <code bash> <code bash>
Line 30: Line 63:
 uci set network.lan.ipaddr="192.168.2.1" uci set network.lan.ipaddr="192.168.2.1"
 uci commit network uci commit network
-/etc/init.d/network restart+service network restart
 </code> </code>
  
-In some cases you may need to disable IP masquerading or use the physical device name for the WAN interface.+If the WAN L2 device doesn't match L3 device like in case of PPPoE, change the modem interface.
  
 <code bash> <code bash>
-Configure firewall +Fetch WAN L2 device 
-uci add_list firewall.@zone[1].masq_dest="!modem" +. /lib/functions/network.sh 
-uci commit firewall +network_flush_cache 
-/etc/init.d/firewall restart+network_find_wan NET_IF 
 +network_get_physdev NET_L2D "${NET_IF}"
  
 # Configure network # Configure network
-uci set network.modem.ifname="eth0.2:1"+uci set network.modem.device="${NET_L2D}"
 uci commit network uci commit network
-/etc/init.d/network restart+service network restart
 </code> </code>
- 
-===== Web interface ===== 
-Add alias: Navigate to Admin -> Network -> Interfaces -> WAN, fill in a name in the "IP-Aliases" add field and click "Add". 
- 
-{{:doc:howto:modem-step-1.png|}} 
- 
-Within the appearing alias section, fill out the IP address and netmask fields suitable for your modem, hit "Save & Apply". 
-In my case the modem is reachable via 192.168.100.1, so I've choosen 192.168.100.10 as alias address. 
-After a while you should see the alias prefix appear in the interface status display (underlined red). 
- 
-{{:doc:howto:modem-step-2.png|}} 
- 
-Navigate to Admin -> Network -> Firewall and open the WAN zone properties (framed red). 
-{{:doc:howto:modem-step-3.png|}} 
- 
-Switch to the "Advanced Settings" tab and enter ''!modem'' into the destionation restriction field, 
-this will tell the firewall to //not// NAT traffic directed at the modem address range. 
-Hit "Save & Apply" to make the change effective. 
- 
-{{:doc:howto:modem-step-4.png|}} 
- 
-At this point the modem should be reachable from any host in the LAN. 
  
  • Last modified: 2024/10/30 06:14
  • by lastedit