This is a really simplified guide about calculating gateway and subnet mask from an IP and subnet, these are usually represented like this: 192.168.1.15/26
I assume you already know binary and to perform logical operations (AND, OR, etc.), if you don’t you should learn that first.
The first thing is to understand that the /26 gives us the subnet mask itself. And the second thing that we need to know is that an IP is composed by 32 bits, which can be divided in 4 octets. To calculate the subnet mask you need to write down the bits with 1 from left to right and fill out the rest with 0. An IP contains 32 bits.
/26 = 26 bits = _11111111.11111111.11111111.11_000000 = 255.255.255.192
To calculate the gateway just perform and AND operation between the IP and the subnet mask.
IP = 192.168.1.15 = 11000000.10101000.00000001.00001111
AND Subnet Mask = 255.255.255.192 = 11111111.11111111.11111111.11000000
Result = 11000000.10101000.00000001.00000000
Gateway = 192.168.1.0
This may look hard or not be clear at first. Keep practicing. It’s really useful if you want to be a SysAdmin.
You could also use a subnet calculator too, but where is the fun in that?
Had to make some edits. Looks like the Android app for tumblr doesn’t play well with Markdown. I’ll have to look for an alternative later.