Tuesday, May 26, 2009

IP address vs. Network address

I never knew the difference between these two until recently, when a external webservice that we use needed to authenticate us based on the source IP. I thought we would just give them the IP address of our website load balancer (behind it there are several servers). It turns out that we need to give the external website IP address of each of the individual server or we give them a network address (range).
So I can give them,

1.2.3.68
1.2.3.69
1.2.3.70


Or I can give them the range

1.2.3.64 netmask 255.255.255.240 (gives me 16 IPs, 14 usable)
1.2.3.64 netmask 255.255.255.248 (gives me 8 IPs, 6 usable)
1.2.3.64 netmask 255.255.255.252 (gives me 4 IPs, two usable)
1.2.3.64 netmask 255.255.255.254 (gives me 2 IPs, none usable

The second approach allows me 16 IP addresses that I can use from this network.
The advantage of the latter approach is that of tomorrow I add a new server, as long as I am with in the network range the remote site does not need any change.

Also checkout the CIDR notation for representing the network address.

0 Comments:

Post a Comment

<< Home