begin  quoting markw as of Fri, Jun 06, 2008 at 03:57:03PM -0700:
> Karl Cunningham wrote:
> >$ ipcalc 167.190.1.0 255.255.248.0
> >Address:   167.190.1.0          10100111.10111110.00000 001.00000000
> >Netmask:   255.255.248.0 = 21   11111111.11111111.11111 000.00000000
> >Wildcard:  0.0.7.255            00000000.00000000.00000 111.11111111
> >=>
> >Network:   167.190.0.0/21       10100111.10111110.00000 000.00000000
> >HostMin:   167.190.0.1          10100111.10111110.00000 000.00000001
> >HostMax:   167.190.7.254        10100111.10111110.00000 111.11111110
> >Broadcast: 167.190.7.255        10100111.10111110.00000 111.11111111
> >Hosts/Net: 2046                  Class B
> 
> You can do this all in your head.  Just subtract the mask from 256. 
> 256-248 is 8, so you have 0-7, with 0.0 as the network, 7.255 as the 
> broadcast and a whole lot of hosts and noise in between.

Careful. The netmask doesn't HAVE to be contiguous.

> The network portion is extracted by logically anding the netmask with 
> the address.  This example makes it easy to see that.  Again, just 
> remember 256 and you can usually figure it out before you can punch it 
> into ipcalc, or some similar tool.

Do it a few times manually (by converting to binary and back), then
use a tool, and most of the time you don't need to worry about such
things except when the network is acting up.

-- 
I use bc with obase=2 and ibase=10 (or vice versa).
Stewart Stremler


-- 
KPLUG-List@kernel-panic.org
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to