红联Linux门户
Linux帮助

SubNetCalc:子网地址计算器(附在Ubuntu下安装SubNetCalc)

发布时间:2016-09-22 11:23:33来源:topspeedsnail.com作者:斗大的熊猫
SubNetCalc是网络地址计算器,基于命令行。可以计算IP的二进制值,广播地址、MAC、子网掩码、地理位置、DNS等等。支持IPv4和IPv6。
SubNetCalc源代码:https://github.com/dreibh/subnetcalc
SubNetCalc:子网地址计算器(附在Ubuntu下安装SubNetCalc)
 
Ubuntu安装SubNetCalc:
$ sudo apt-get install subnetcalc
 
使用示例:
 
网络的详细信息:
$ subnetcalc 132.252.150.254 255.255.255.240
Address       = 132.252.150.254
10000100 . 11111100 . 10010110 . 11111110
Network       = 132.252.150.240 / 28
Netmask       = 255.255.255.240
Broadcast     = 132.252.150.255
Wildcard Mask = 0.0.0.15
Hosts Bits    = 4
Max. Hosts    = 14   (2^4 - 2)
Host Range    = { 132.252.150.241 - 132.252.150.254 }
Properties    =
- 132.252.150.254 is a HOST address in 132.252.150.240/28
- Class B
GeoIP Country = Germany (DE)
DNS Hostname  = dummy.iem.uni-due.de
 
域名:
$ subnetcalc github.com 
Address       = 192.30.253.113
11000000 . 00011110 . 11111101 . 01110001
Network       = 192.30.253.113 / 32
Netmask       = 255.255.255.255
Broadcast     = not needed on Point-to-Point links
Wildcard Mask = 0.0.0.0
Hosts Bits    = 0
Max. Hosts    = 1   (2^0 - 0)
Host Range    = { 192.30.253.113 - 192.30.253.113 }
Properties    =
- 192.30.253.113 is a NETWORK address
- Class C
GeoIP Country = United States (US)
DNS Hostname  = (Name or service not known)
 
$ subnetcalc 2401:3800:c001::68
Address       = 2401:3800:c001::68
2401 = 00100100 00000001
3800 = 00111000 00000000
c001 = 11000000 00000001
0000 = 00000000 00000000
0000 = 00000000 00000000
0000 = 00000000 00000000
0000 = 00000000 00000000
0068 = 00000000 01101000
Network       = 2401:3800:c001::68 / 128
Netmask       = ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Wildcard Mask = ::
Hosts Bits    = 0
Max. Hosts    = 0   (2^0 - 1)
Host Range    = { 2401:3800:c001::69 - 2401:3800:c001::68 }
Properties    =
- 2401:3800:c001::68 is a NETWORK address
- Global Unicast Properties:
+ Interface ID = 0000:0000:0000:0068
+ Sol. Node MC = ff02::1:ff00:0068
GeoIP Country = China (CN)
DNS Hostname  = (Name or service not known)
 
$ subnetcalc 2001:638:501:4ef8:223:aeff:fea4:8ca9/64
Address       = 2001:638:501:4ef8:223:aeff:fea4:8ca9
2001 = 00100000 00000001
0638 = 00000110 00111000
0501 = 00000101 00000001
4ef8 = 01001110 11111000
0223 = 00000010 00100011
aeff = 10101110 11111111
fea4 = 11111110 10100100
8ca9 = 10001100 10101001
Network       = 2001:638:501:4ef8:: / 64
Netmask       = ffff:ffff:ffff:ffff::
Wildcard Mask = ::ffff:ffff:ffff:ffff
Hosts Bits    = 64
Max. Hosts    = 18446744073709551616   (2^64 - 1)
Host Range    = { 2001:638:501:4ef8::1 - 2001:638:501:4ef8:ffff:ffff:ffff:ffff }
Properties    =
- 2001:638:501:4ef8:223:aeff:fea4:8ca9 is a HOST address in 2001:638:501:4ef8::/64
- Global Unicast Properties:
+ Interface ID = 0223:aeff:fea4:8ca9
+ MAC address  = 00:23:ae:a4:8c:a9
+ Sol. Node MC = ff02::1:ffa4:8ca9
GeoIP Country = Germany (DE)
DNS Hostname  = (Name or service not known)
 
man帮助:
subnetcalc(8)  BSD System Manager's Manual  subnetcalc(8)
NAME
subnetcalc — IPv4/IPv6 Subnet Calculator
SYNOPSIS
subnetcalc [Address] [Netmask/Prefix] [-n] [-uniquelocal] [-uniquelocalhq]
DESCRIPTION
subnetcalc is an IPv4/IPv6 subnet address calculator. For given IPv4 or
IPv6 address and netmask or prefix length, it calculates network address,
broadcast address, maximum number of hosts and host address range. Also,
it prints the addresses in binary format for better understandability.
Furthermore, it prints useful information on specific address types (e.g.
type, scope, interface ID, etc.).
ARGUMENTS
The following arguments have to be provided:
Address
The IP address. If a hostname is provided here, it is tried to
resolve the address by a DNS server and the first returned
address is used. Internationalized Domain Names (IDN) are sup‐
ported.
Netmask/Prefix
The netmask or prefix length (0-32 for IPv4; 0-128 for IPv6).
-n      Skip trying a reverse DNS lookup.
-uniquelocal
Given an IPv6 address, the first 48 bits of the address are
replaced by a randomly chosen IPv6 Unique Local prefix in
fc00::/7 (see also RFC 4193). Under Linux, /dev/urandom is used
for random number generation.
-uniquelocalhq
Like -uniquelocal, but using /dev/random instead on Linux systems
for highest-quality random number generation. On other systems,
this option is equal to -uniquelocal. Note, that reading from
/dev/random may take some time. You can speed up this process by
delivering random input e.g. by pressing keys or moving the
mouse.
EXAMPLES
subnetcalc 132.252.250.0 255.255.255.0
subnetcalc 132.252.250.0/255.255.255.0
subnetcalc 132.252.250.0 24
subnetcalc 132.252.250.0/24
subnetcalc fec0:2345:6789:1111:221:6aff:fe0b:2674 56
subnetcalc 2a00:1450:8007::69 64
subnetcalc ff08::1:2:3
subnetcalc 131.220.6.5/24
subnetcalc 132.252.181.87 -n
subnetcalc www.iem.uni-due.de 24
subnetcalc www.six.heise.de
subnetcalc fd00:: 64 -uniquelocal
subnetcalc fd00::9876:256:7bff:fe1b:3255 56 -uniquelocalhq
subnetcalc düsseldorf.de 28
subnetcalc www.köln.de
subnetcalc räksmörgås.josefsson.org 24
AUTHORS
Thomas Dreibholz
http://www.iem.uni-due.de/~dreibh/subnetcalc
mailto://dreibh@iem.uni-due.de
subnetcalc  June 19, 2010  subnetcalc
 
本文永久更新地址:http://www.linuxdiyf.com/linux/24386.html