Ipcalc - Cálculo de máscara sub-rede IPV4
Autor: Anderson Weige Dias | Publicado: 2016-09-09T21:52:00-03:00


Ipcalc é uma ferramenta que auxilia o cálculo de máscara de sub-redes IPV4. Quem administra redes sabe que segmentar uma rede, trabalhar com máscaras de rede e roteamento são tarefas corriqueiras. Além disso, ela pode ser uma ferramenta de aprendizagem, pois oferece resultados bem estruturados.



INSTALAÇÃO



Para instalar em distros derivadas do Debian, como Ubuntu:

sudo apt-get install ipcalc

COMO USAR?



Pressupõe-se que você tem conhecimentos técnicos sobre o tema.



1- Especificar CIDR

ipcalc 192.168.0.0/24


Address:   192.168.0.0          11000000.10101000.00000000. 00000000
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=&gt;
Network:   192.168.0.0/24       11000000.10101000.00000000. 00000000
HostMin:   192.168.0.1          11000000.10101000.00000000. 00000001
HostMax:   192.168.0.254        11000000.10101000.00000000. 11111110
Broadcast: 192.168.0.255        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet




2. Exibe uma sub-rede para 10 hosts válidos (mínimo de desperdício)

ipcalc 192.168.1.0 –s 10


[...]

1. Requested size: 10 hosts
Netmask:   255.255.255.240 = 28 11111111.11111111.11111111.1111 0000
Network:   192.168.1.0/28       11000000.10101000.00000001.0000 0000
HostMin:   192.168.1.1          11000000.10101000.00000001.0000 0001
HostMax:   192.168.1.14         11000000.10101000.00000001.0000 1110
Broadcast: 192.168.1.15         11000000.10101000.00000001.0000 1111
Hosts/Net: 14                    Class C, Private Internet

Needed size:  16 addresses.
Used network: 192.168.1.0/28
Unused:
192.168.1.16/28
192.168.1.32/27
192.168.1.64/26
192.168.1.128/25




3. Múltiplas sub-redes para hosts válidos

ipcalc 172.18.0.0/24 –s 10 20 20


[...]

1. Requested size: 10 hosts
Netmask:   255.255.255.240 = 28 11111111.11111111.11111111.1111 0000
Network:   172.18.0.64/28       10101100.00010010.00000000.0100 0000
HostMin:   172.18.0.65          10101100.00010010.00000000.0100 0001
HostMax:   172.18.0.78          10101100.00010010.00000000.0100 1110
Broadcast: 172.18.0.79          10101100.00010010.00000000.0100 1111
Hosts/Net: 14                    Class B, Private Internet

2. Requested size: 20 hosts
Netmask:   255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Network:   172.18.0.0/27        10101100.00010010.00000000.000 00000
HostMin:   172.18.0.1           10101100.00010010.00000000.000 00001
HostMax:   172.18.0.30          10101100.00010010.00000000.000 11110
Broadcast: 172.18.0.31          10101100.00010010.00000000.000 11111
Hosts/Net: 30                    Class B, Private Internet

3. Requested size: 20 hosts
Netmask:   255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Network:   172.18.0.32/27       10101100.00010010.00000000.001 00000
HostMin:   172.18.0.33          10101100.00010010.00000000.001 00001
HostMax:   172.18.0.62          10101100.00010010.00000000.001 11110
Broadcast: 172.18.0.63          10101100.00010010.00000000.001 11111
Hosts/Net: 30                    Class B, Private Internet

Needed size:  80 addresses.
Used network: 172.18.0.0/25
Unused:
172.18.0.80/28
172.18.0.96/27
172.18.0.128/25




4. Dividir super bloco em subredes menores

ipcalc 192.168.0.0/24 26



Neste exemplo é criada 4 sub-redes a partir de um /24


Subnets after transition from /24 to /26

Netmask:   255.255.255.192 = 26 11111111.11111111.11111111.11 000000
Wildcard:  0.0.0.63             00000000.00000000.00000000.00 111111

 1.
Network:   192.168.0.0/26       11000000.10101000.00000000.00 000000
HostMin:   192.168.0.1          11000000.10101000.00000000.00 000001
HostMax:   192.168.0.62         11000000.10101000.00000000.00 111110
Broadcast: 192.168.0.63         11000000.10101000.00000000.00 111111
Hosts/Net: 62                    Class C, Private Internet

 2.
Network:   192.168.0.64/26      11000000.10101000.00000000.01 000000
HostMin:   192.168.0.65         11000000.10101000.00000000.01 000001
HostMax:   192.168.0.126        11000000.10101000.00000000.01 111110
Broadcast: 192.168.0.127        11000000.10101000.00000000.01 111111
Hosts/Net: 62                    Class C, Private Internet

 3.
Network:   192.168.0.128/26     11000000.10101000.00000000.10 000000
HostMin:   192.168.0.129        11000000.10101000.00000000.10 000001
HostMax:   192.168.0.190        11000000.10101000.00000000.10 111110
Broadcast: 192.168.0.191        11000000.10101000.00000000.10 111111
Hosts/Net: 62                    Class C, Private Internet

 4.
Network:   192.168.0.192/26     11000000.10101000.00000000.11 000000
HostMin:   192.168.0.193        11000000.10101000.00000000.11 000001
HostMax:   192.168.0.254        11000000.10101000.00000000.11 111110
Broadcast: 192.168.0.255        11000000.10101000.00000000.11 111111
Hosts/Net: 62                    Class C, Private Internet


Subnets:   4
Hosts:     248




5. Resultado impresso em HTML

ipcalc 192.168.1.0/24 –h &gt; subrede.html | xdg-open subrede.html



Mais Informações



ipcalc –help

Fonte: Linux Descomplicado