How to create Complex Wildcard Masks

Hi Parastoo,

Let’s say we have the following networks:

192.168.0.0 /24
192.168.1.0 /24
192.168.2.0 /24
192.168.3.0 /24

This is what the 3rd octet looks like in binary:

0 = 0000 0000
1 = 0000 0001
2 = 0000 0010
3 = 0000 0011

What the even networks have in common is that the last bit is always a 0, the uneven networks always have a 1 as the last bit. That’s something we can match on:

Wildcard 254 = 1111 1110 and means “don’t look at the first 7 bits but the last bit HAS to match”.

Wildcard 14 = 0000 1110 and means that the first 4 bits have to match, we don’t care about bit 5,6 and 7 but the last bit also has to match.

We don’t care about those first 4 bits, only the last bit is interesting if we want to match on even or uneven networks.

Also your last octet should be 255 (not 0). We don’t care about the last octet in this example.

Rene