My goal is to setup an OpenWrt router, IPv4 without Double NAT and make subnets for:
- WAN
-
LAN
** LAN / WAN Access
** Management LAN? -
Family LAN
** LAN / WAN Access
** (Double NAT here with pfsense behind it to prevent the boys from accessing bad websites using SquidGuard, they won't be using any services, so it's okay) -
DMZ (ddns access)
**Everything below secured via SSH private key / public key port forwarding
*** gitea webserver accessed
*** wiki accessable externally
*** nextCloud server with del.icio.us type bookmarks
** Maybe knockd for hiding the ssh port. -
Backups (BareOS / Bacula)
** Separate Subnet for backup servers
** Want to keep this separate from WAN, but still able to do backups from other subnets likely through routing rules between subnets.
I decided to go with subnetting since I never seem to be able to understand the OpenWrt documentation for switches / VLANs though I've tried many. many times; see below:
I used the python3's ipaddress library to come up with the subnets above.
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[1])
IPv4Network('192.168.57.64/26')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[1]).hosts())[0]
IPv4Address('192.168.57.65')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[1]).hosts())[1]
IPv4Address('192.168.57.66')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[1]).hosts())[-1]
IPv4Address('192.168.57.126')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[1]).netmask
IPv4Address('255.255.255.192')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[2]).netmask
IPv4Address('255.255.255.192')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[2]).hosts())[0]
IPv4Address('192.168.57.129')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[2]).hosts())[1]
IPv4Address('192.168.57.130')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[2]).hosts())[-1]
IPv4Address('192.168.57.190')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3]).netmask
IPv4Address('255.255.255.192')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3])
IPv4Network('192.168.57.192/26')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3]).netmask
IPv4Address('255.255.255.192')
>>> (list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3])
IPv4Network('192.168.57.192/26')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3]).hosts())[0]
IPv4Address('192.168.57.193')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3]).hosts())[1]
IPv4Address('192.168.57.194')
>>> list((list(ipaddress.IPv4Network('192.168.57.0/24').subnets(new_prefix=26))[3]).hosts())[-1]
IPv4Address('192.168.57.254')