ipcalc

提供: FreeBSD入門
2014年8月17日 (日) 17:53時点におけるDaemon (トーク | 投稿記録)による版 (ページの作成:「ipcalc (IP Calculator)とは、ドット区切りの10進数とCIDRもしくはネットマスクからネットワークに含まれるホストのIPアドレ...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索
スポンサーリンク

ipcalc (IP Calculator)とは、ドット区切りの10進数とCIDRもしくはネットマスクからネットワークに含まれるホストのIPアドレスの個数などを調べて、表示します。

読み方

ipcalc
あいぴーかるく
IP Calculator
あいぴー かるきゅれーたー

概要

ipcalc は、ネットワークのアドレスからIPアドレスの個数や始まりと終わりのIPアドレスを計算するコマンドです。

インストール

pkgコマンドでインストールする場合

sudo pkg install ipcalc

使い方

コマンドラインオプション

IP Calculator 0.41
 
Enter your netmask(s) in CIDR notation (/25) or dotted decimals
(255.255.255.0).
Inverse netmasks are recognized. If you mmit the netmask, ipcalc uses the
default netmask for the class of your network.
 
Look at the space between the bits of the addresses: The bits before it are
the network part of the address, the bits after it are the host part. You can
see two simple facts: In a network address all host bits are zero, in a
broadcast address they are all set.
 
The class of your network is determined by its first bits.
 
If your network is a private internet according to RFC 1918 this is remarked.
When displaying subnets the new bits in the network part of the netmask are
marked in a different color.
 
The wildcard is the inverse netmask as used for access control lists in Cisco
routers. You can also enter netmasks in wildcard notation.
 
Do you want to split your network into subnets? Enter the address and netmask
of your original network and play with the second netmask until the result
matches your needs.
 
 
Questions? Comments? Drop me a mail...
krischan at jodies.de
http://jodies.de/ipcalc
 
Thanks for your nice ideas and help to make this tool more useful:
 
Bartosz Fenski
Denis A. Hainsworth
Foxfair Hu
Frank Quotschalla
Hermann J. Beckers
Igor Zozulya
Kevin Ivory
Lars Mueller
Lutz Pressler
Oliver Seufer
Scott Davis
Steve Kent
Sven Anderson
Torgen Foertsch
 
Usage: ipcalc [options] <ADDRESS>[[/]<NETMASK>] [NETMASK]
 
ipcalc takes an IP address and netmask and calculates the resulting broadcast,
network, Cisco wildcard mask, and host range. By giving a second netmask, you
can design sub- and supernetworks. It is also intended to be a teaching tool
and presents the results as easy-to-understand binary values.
 
 -n --nocolor  Don't display ANSI color codes.
 -b --nobinary Suppress the bitwise output.
 -c --class    Just print bit-count-mask of given address.
 -h --html     Display results as HTML (not finished in this version).
 -v --version  Print Version.
 -s --split n1 n2 n3
               Split into networks of size n1, n2, n3.
 -r --range    Deaggregate address range.
    --help     Longer help text.
 
Examples:
 
ipcalc 192.168.0.1/24
ipcalc 192.168.0.1/255.255.128.0
ipcalc 192.168.0.1 255.255.128.0 255.255.192.0
ipcalc 192.168.0.1 0.0.63.255
 
 
ipcalc <ADDRESS1> - <ADDRESS2>  deaggregate address range
 
ipcalc <ADDRESS>/<NETMASK> --s a b c
                                split network to subnets
                                where a b c fits in.
 
! New HTML support not yet finished.
 
ipcalc 0.41

使用例

CIDRで入力する例です。

$ ipcalc 192.168.0.1/24
Address:   192.168.0.1          11000000.10101000.00000000. 00000001
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
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

ドット区切りの10進数で指定する例です。

$ ipcalc 192.168.0.1/255.255.128.0
Address:   192.168.0.1          11000000.10101000.0 0000000.00000001
Netmask:   255.255.128.0 = 17   11111111.11111111.1 0000000.00000000
Wildcard:  0.0.127.255          00000000.00000000.0 1111111.11111111
=>
Network:   192.168.0.0/17       11000000.10101000.0 0000000.00000000
HostMin:   192.168.0.1          11000000.10101000.0 0000000.00000001
HostMax:   192.168.127.254      11000000.10101000.0 1111111.11111110
Broadcast: 192.168.127.255      11000000.10101000.0 1111111.11111111
Hosts/Net: 32766                 Class C, Private Internet

クラスAのアドレスの場合です。

$ ipcalc 0.0.0.0/8
Address:   0.0.0.0              00000000. 00000000.00000000.00000000
Netmask:   255.0.0.0 = 8        11111111. 00000000.00000000.00000000
Wildcard:  0.255.255.255        00000000. 11111111.11111111.11111111
=>
Network:   0.0.0.0/8            00000000. 00000000.00000000.00000000
HostMin:   0.0.0.1              00000000. 00000000.00000000.00000001
HostMax:   0.255.255.254        00000000. 11111111.11111111.11111110
Broadcast: 0.255.255.255        00000000. 11111111.11111111.11111111
Hosts/Net: 16777214              Class A
$ ipcalc -r 0.0.0.0/8
deaggregate 0.0.0.0 - 255.0.0.0
0.0.0.0/1
128.0.0.0/2
192.0.0.0/3
224.0.0.0/4
240.0.0.0/5
248.0.0.0/6
252.0.0.0/7
254.0.0.0/8
255.0.0.0/32

関連項目




スポンサーリンク