Hi, I have the following situation: one LAN (10.0.1.0/24) with 3 routers (R1: 10.0.1.1, R2: 10.0.1.2, R3:10.0.1.3) running Openwrt 23.05.4. R1 is connected to internet through PPPoE. I also installed wireguard in R1 to access my LAN when I am not at home. Everything works well.
Now, I would like to create a second/separate LAN (10.0.2.0/24) with a fourth Openwrt router (same version 23.05.4) with the following requirements:
internet connection taken from the first LAN
clients on LAN1 not communicating with clients on LAN2 and viceversa
VPN (wireguard or openvpn) access (different from the VPN in R1)
Is it possible or the first two requirements are in contrast?
I began by:
connecting R1 (Lan port) to R4 (Wan port)
creating the Lan 10.0.2.0/24 in R4
creating the Wan with a static address (IP in LAN1 range: 10.0.1.4)
Now I am a bit confused on how to continue.
At moment I have no internet connection on R4 (I tried with a ping 1.1.1.1 from ssh but the result was "network unreachable").
I imagine I have to set two static routes (one from R1 to R4 and one from R4 to R1) and set something at firewall level but i am not a network expert and I don't know how to continue.
You don't need another router for this purpose. It can all be done on your main router (R1).
Is there a reason you want to do this on a different router?
Also, what are R2 and R3 for -- are they bridged APs or are they also routing? If the latter, why do you have this configuration as compared to having all routing on the main router?
I would need the second Lan only on occasional basis
I would need to move sometimes R4 to another location (e.g. my parents' house, where I have a similar network situation)
I would prefer to modify R1, R2, R3 configurations as little as possible since they are working well and, additionally, I cannot leave LAN1 clients without internet connection in the meantime that I correctly set R1, R2, R3
My house has three floors. On each floor I put an openwrt router. R1 is the "main" router. R2 and R3 are set as simple access point (wireless and wired). I disabled DHCP and configured R1 as gateway. I am not sure that the correct reply to your question is that R2 and R3 are bridged APs in my case since, as premised, I am inexperienced in networking and I am trying to learn.
How about configuring this one to be used as a travel router. Instead of having to plug it into your home network and then disconnect when you move it, just have it as a spare for when you need to go somewhere else.
The one caveat is the VPN configuration -- depending on the commercial VPN provider, you may or may not be able to setup multiple devices. We can get into that detail later, though.
That is understandable. We could work on R4 in the travel router context, and then once you understand how it works, we can work on R1. As long as you follow our guidance, there is usually minimal downtime (measured in minutes).
Ok... as long as they are basic APs, that's great.
My purpose is not only to create a second/separate LAN using the same gateway but also to understand a little more about networking.
So, let's start, as you suggested, with R4 in travel configuration.
Supposing that R1 is the main router of a network acting also as gateway (internet connection settings are defined here, e.g PPPoE or DSL settings) and that it can be openwrt based (as in my house) or vendor firmware based with advanced settings, such as static routes (as in my parents' house).
That said, are the following first steps correct?
connecting R1 (e.g. LAN1 port 4, to be removed from LAN1 bridge) to R4 (Wan port)
creating the LAN2 10.0.2.0/24 in R4
creating in R4 the Wan with a static address (IP in LAN1 range: 10.0.1.4)
Leave the lan bridge as is -- there is no reason to remove port 4 from the bridge. But otherwise, yes, connect a cable between the wan port of R4 and the lan port of R1.
Yes, this will just be lan -- no need to call it anything different -- it's already defined, you simply need to change the IP address (10.0.2.1 will give you the 10.0.2.0/24 network)
Just use DHCP for the R4 wan. That makes it easy. You can setup a DHCP reservation on the upstream router so that it always gets the same IP address... but in the interest of making this as 'universal' as possible, don't use a static IP on the actual wan interface of R4.
In a previous step I created the "secondary/separate" LAN 10.0.2.0/24 in R4.
In the process described at the abovementioned link the WiFi guest is attached to the new interface "guest" having an IP address (e.g. 10.0.3.0/24) different from the LAN one (10.0.2.0/24).
Is this required in my case or is it sufficient to link the WiFi guest with the existing LAN interface, considering that the LAN 10.0.2.0/24 is already a sort of "guest" network (with regards to the "main" LAN 10.0.1.0/24)?
In my case, is creating a wifi network with a different ip address from the LAN perhaps useful to allow access to the router configuration page from a non-guest network? Or are there other reasons behind?
Sorry for these stupid questions. I am just trying to understand well what I am doing instead of mechanically performing the suggested steps.
Ok... I thought we were starting from a near-default state. I didn't realize you had already configured a new network. Let's take a look at the configuration of this device to see where things stand.
From there, I'll review and answer other questions based on what I see.
Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
# cat /etc/config/firewall
config defaults
option syn_flood 1
option input REJECT
option output ACCEPT
option forward REJECT
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
config zone
option name lan
list network 'lan'
option input ACCEPT
option output ACCEPT
option forward ACCEPT
config zone
option name wan
list network 'wan'
list network 'wan6'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest wan
# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
option name Allow-DHCP-Renew
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
# Allow IPv4 ping
config rule
option name Allow-Ping
option src wan
option proto icmp
option icmp_type echo-request
option family ipv4
option target ACCEPT
config rule
option name Allow-IGMP
option src wan
option proto igmp
option family ipv4
option target ACCEPT
# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
option name Allow-DHCPv6
option src wan
option proto udp
option dest_port 546
option family ipv6
option target ACCEPT
config rule
option name Allow-MLD
option src wan
option proto icmp
option src_ip fe80::/10
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family ipv6
option target ACCEPT
# Allow essential incoming IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Input
option src wan
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
list icmp_type router-solicitation
list icmp_type neighbour-solicitation
list icmp_type router-advertisement
list icmp_type neighbour-advertisement
option limit 1000/sec
option family ipv6
option target ACCEPT
# Allow essential forwarded IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Forward
option src wan
option dest *
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
option limit 1000/sec
option family ipv6
option target ACCEPT
config rule
option name Allow-IPSec-ESP
option src wan
option dest lan
option proto esp
option target ACCEPT
config rule
option name Allow-ISAKMP
option src wan
option dest lan
option dest_port 500
option proto udp
option target ACCEPT
### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
# option src lan
# option src_ip 192.168.45.2
# option dest wan
# option proto tcp
# option target REJECT
# block a specific mac on wan
#config rule
# option dest wan
# option src_mac 00:11:22:33:44:66
# option target REJECT
# block incoming ICMP traffic on a zone
#config rule
# option src lan
# option proto ICMP
# option target DROP
# port redirect port coming in on wan to lan
#config redirect
# option src wan
# option src_dport 80
# option dest lan
# option dest_ip 192.168.16.235
# option dest_port 80
# option proto tcp
# port redirect of remapped ssh port (22001) on wan
#config redirect
# option src wan
# option src_dport 22001
# option dest lan
# option dest_port 22
# option proto tcp
### FULL CONFIG SECTIONS
#config rule
# option src lan
# option src_ip 192.168.45.2
# option src_mac 00:11:22:33:44:55
# option src_port 80
# option dest wan
# option dest_ip 194.25.2.129
# option dest_port 120
# option proto tcp
# option target REJECT
#config redirect
# option src lan
# option src_ip 192.168.45.2
# option src_mac 00:11:22:33:44:55
# option src_port 1024
# option src_dport 80
# option dest_ip 194.25.2.129
# option dest_port 120
# option proto tcp
This looks generally fine, but one key thing is that you have port lan4 used in 2 places (br-lan and in the wan interface). It appears that your device has 4 ethernet ports, with lan4 used as either lan or wan. If you plan to use it as the wan, it must be removed from br-lan:
Other than that, you should be fine once you fix that and reboot. Connect a cable between lan4/wan and the upstream lan. At that point, you should see normal connectivity on your TD-W8970 and clients that are connected to it