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:openwrt_as_routerdevice [2021/03/10 21:26] – links vgaeteradocs:guide-user:network:openwrt_as_routerdevice [2021/10/17 17:36] – [Command-line instructions] vgaetera
Line 1: Line 1:
 ====== OpenWrt as router device ====== ====== OpenWrt as router device ======
 See also: See also:
-[[docs:guide-user:network:switch_router_gateway_and_nat|Router vs switch vs gateway and NAT]], +[[docs:guide-user:network:openwrt_as_clientdevice|OpenWrt as client device]], 
-[[docs:guide-user:network:openwrt_as_clientdevice|OpenWrt as client device]]+[[docs:guide-user:network:switch_router_gateway_and_nat|Router vs switch vs gateway and NAT]]
  
 If your device has some ports labeled LAN and at least a port labeled WAN and you want it to operate as a router (a connection between two different networks). If your device has some ports labeled LAN and at least a port labeled WAN and you want it to operate as a router (a connection between two different networks).
 Depending on actual hardware support, it may be possible to create a WAN port on a device with only LAN ports, see your device's page for more info about this. Depending on actual hardware support, it may be possible to create a WAN port on a device with only LAN ports, see your device's page for more info about this.
 The default IP of the LAN ports of a OpenWrt device is 192.168.1.1, if the addresses of the devices in the network you connect to the WAN port are **192.168.1.X** (X=any number), you need to change the IP address of the LAN interface on your OpenWrt router to **192.168.2.1** (or to something that isn't **192.168.1.X**, anyway), or change the addressing of the other network you are connecting to. The default IP of the LAN ports of a OpenWrt device is 192.168.1.1, if the addresses of the devices in the network you connect to the WAN port are **192.168.1.X** (X=any number), you need to change the IP address of the LAN interface on your OpenWrt router to **192.168.2.1** (or to something that isn't **192.168.1.X**, anyway), or change the addressing of the other network you are connecting to.
-The LAN and WAN ports MUST have at least different subnets for routing to work.+The LAN and WAN interfaces MUST have at least different subnets for routing to work.
  
 This means: This means:
Line 18: Line 18:
   * If you are confused now or don't know, simply start by leaving both config parts in its default configuration. If you experience problems with these defaults, then adapt them accordingly later.   * If you are confused now or don't know, simply start by leaving both config parts in its default configuration. If you experience problems with these defaults, then adapt them accordingly later.
  
-===== Web interface =====+===== Web interface instructions =====
   - Click on **Network** -> **Interfaces**, then click on the **Edit** button of the LAN Network.   - Click on **Network** -> **Interfaces**, then click on the **Edit** button of the LAN Network.
   - In **General Setup** tab, in **IPv4 address** type in the desired static IP address for the LAN interface of your OpenWrt Router, if your main router's address is 192.168.1.1 (most common), set the IP address of your OpenWrt router LAN interface to **192.168.2.1** (or to something that isn't **192.168.1.X**, anyway). Once you have chosen and written the IP address, write it down in the same sticker with the user/password above, it will be used to connect to your device in the future.   - In **General Setup** tab, in **IPv4 address** type in the desired static IP address for the LAN interface of your OpenWrt Router, if your main router's address is 192.168.1.1 (most common), set the IP address of your OpenWrt router LAN interface to **192.168.2.1** (or to something that isn't **192.168.1.X**, anyway). Once you have chosen and written the IP address, write it down in the same sticker with the user/password above, it will be used to connect to your device in the future.
   - By default the WAN interface/port is set as **DHCP client**, this will allow it to work with networks where there is another router giving addresses without further configuration. If you need to set static address please see the instructions for [[docs:guide-user:network:openwrt_as_clientdevice|Client device]], and change the WAN interface settings accordingly.   - By default the WAN interface/port is set as **DHCP client**, this will allow it to work with networks where there is another router giving addresses without further configuration. If you need to set static address please see the instructions for [[docs:guide-user:network:openwrt_as_clientdevice|Client device]], and change the WAN interface settings accordingly.
  
-===== Command-line interface ===== +===== Command-line instructions ===== 
-  - Type ''uci set network.lan.ipaddr='new-ip-address''' ("new-ip-address" is the new IP address you want for the LEDE device in your network) and press Return,  +Configure the LAN interface statically with a new IP address ''192.168.2.1''
-  - If needed, type ''uci set network.wan.proto='static''' to switch to static protocol on WAN interface, then change wan settings by using the [[docs:guide-user:network:openwrt_as_clientdevice#command_line_instructions|same procedure detailed for Client device]], settings for wan interface are ''network.wan.ipaddr'', ''network.wan.gateway'', ''network.wan.dns'', and so on, so change the commands accordingly+ 
-  - You might want to [[docs:guide-user:start#basic_configuration|basic OpenWrt documentation]] too, as these setups are usually very specific to your own network setup and it makes no sense to try to cover all possible cases here. +<code bash> 
-  - Type ''uci commit && service network restart'' and press Return. +uci set network.lan.ipaddr="192.168.2.1" 
-  - Then connect again to your device at its new IP address and continue.+uci commit network 
 +/etc/init.d/network restart 
 +</code> 
 + 
 +Note that changing the IP address causes the SSH session to hang/disconnect
 +Follow [[docs:guide-user:network:openwrt_as_clientdevice|OpenWrt as client device]] to configure the WAN interface if necessary.
  
  • Last modified: 2023/10/14 05:58
  • by vgaetera