I urge every new OpnSense user to carefully plan their subnets - preferably in advance. While this seems obvious or "easy", the devil lies in the details, some of which you may not know or anticipate.
Of course, if you know anything about networks at all, you will have heard about RFC1918.
This standard defines IPv4 ranges that are to be used on local networks and will not be routed into the open internet, thus needing a NAT translation.
There are three available ranges, namely 192.168.0.0/16, 172.16.0.0/12 and 10.0.0.0/8. You might think, well fine, let's just use one of those, but wait...
By convention, the 192.168.0.0/16 range is almost always divided up into smaller /24 subnetworks - and you should do the same. There are some reasons for that:
If you really need to configure netmasks different from /24, please do so in the 172.16.0.0/12 or 10.0.0.0/8 range. Because these are more often used by businesses or big enterprises, there a lot less assumptions for those.
Another hint:
Do not use 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.88.0/24, 192.168.100.0/24, 192.168.123.0/24 or 192.168.178.0/24 for your (V)LAN subnets. This is why:
Those ranges are often the default for many routers, including OpnSense itself. Most people, who often know jack about networking, leave their routers at their default settings. At some point in the future, when you try to build a Wireguard site-2-site VPN to a friend, you will find that one of you has to restructure their whole network to be able to route anything at all. Depending on the complexity of the network, this may be hard task. Also, many ONTs, cable and DSL modems use IPs from these range. If you want them to be made accessible on the WAN interface, you must not have the same range in one of your own (V)LANs. And finally, those ranges are often used by devices in their default state, which may conflict with your network when you connect those.
Of course, if you know anything about networks at all, you will have heard about RFC1918.
This standard defines IPv4 ranges that are to be used on local networks and will not be routed into the open internet, thus needing a NAT translation.
There are three available ranges, namely 192.168.0.0/16, 172.16.0.0/12 and 10.0.0.0/8. You might think, well fine, let's just use one of those, but wait...
By convention, the 192.168.0.0/16 range is almost always divided up into smaller /24 subnetworks - and you should do the same. There are some reasons for that:
- If you want to use larger ranges, because you need more than 254 clients within one subnet, think again:
- More than about 200 clients in one subnet will cause a significant amount of broadcasts. Not only for ARP, but also for proprietary protocols that many IoT and smart devices use. While modern ethernet with full-duplex is nice, it does not help for broadcasts, let alone what broadcasts do on wireless networks (consider separating them from your (V)LANs).
- Also, you should at least split up your network into several VLANs based on the trustworthiness of your clients by type: Do they "phone home"? Then put them into a separate VLAN! This alone will probably result in less than 200 devices per VLAN/subnet. - If you want to use smaller ranges, take care. For example, you may think that for accessing your modem, which has an 192.168.100.1 address, you could use a very small network containing only two adresses (thus with a netmask of /31), you would be wrong to choose 192.168.100.2 on your WAN interface. Think about why (use a network calculator if needed).
This example provides two insights:
a) A netmask of /31 is always wrong, because usually, you have at least a "network", a "broadcast", a router and one client address, therefore you need a /30 netmask at least and
b) anything apart from a /24 netmask is hard to visually get correct. /24 netmasks are easy to deal with for humans, because their 3rd octet is always the same, so you can see if two IPs belong to the same subnet (hint: 192.168.100.1 and 192.168.100.2 do not lie together in any /31 subnet). - In fact, anything apart from a /24 subnet in the 192.168.0.0/16 range is considered "unconventional" - and if not explicitely stated, will not be implicitely assumed by anyone trying to help you. This may lead to much wasted time while troubleshooting.
If you really need to configure netmasks different from /24, please do so in the 172.16.0.0/12 or 10.0.0.0/8 range. Because these are more often used by businesses or big enterprises, there a lot less assumptions for those.
Another hint:
Do not use 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.88.0/24, 192.168.100.0/24, 192.168.123.0/24 or 192.168.178.0/24 for your (V)LAN subnets. This is why:
Those ranges are often the default for many routers, including OpnSense itself. Most people, who often know jack about networking, leave their routers at their default settings. At some point in the future, when you try to build a Wireguard site-2-site VPN to a friend, you will find that one of you has to restructure their whole network to be able to route anything at all. Depending on the complexity of the network, this may be hard task. Also, many ONTs, cable and DSL modems use IPs from these range. If you want them to be made accessible on the WAN interface, you must not have the same range in one of your own (V)LANs. And finally, those ranges are often used by devices in their default state, which may conflict with your network when you connect those.