IP Address
Subnet masks
a.b.c.d/30 -> 4 addresses in network
a.b.c.d/29 -> 8 addresses in network
a.b.c.d/28 -> 16 addresses in network
‥ etc ‥
The number of hosts is the number of addresses minus 2 (which account for the ones and zeroes broadcast addresses of the subnetwork).
Determining own IP address
Windows
The
PowerShell script
ip.ps1 prints IP addresses of local non-loopback adapters.
Linux
dig +short myip.opendns.com @resolver1.opendns.com
Yet, this approach does not seem to work behind
NAT.
Virtual machine
One of the following to commands should report the public IP address if executed in a
virtual machine.
$ curl ipconfig.me
$ curl ipconfig.me/ip
Sometimes, it's necessary to get the IP4 address:
$ curl -4 ipconfig.me/ip
Omitting zeros to abbreviate IP addresses
a.b.d is interpreted as a.b.0.d.
a.d is interpreted as a.0.0.d
d is interpreted as 0.0.0.d
So, the saying goes: there is no place like 127.1.
Making a HTTP GET request to localhost:
$ curl 0:80
Some tools possibly can't handle abbreviated IP addresses.
See also
RFC 7020: The Internet Numbers Registry System.
Autonomous Systems (AS)
An autonomous system (AS) is is a group of one or more IP prefixes that are maintained(?) by one or more network operators.
Autonomous system number (ASN)
Each AS is assigned an autonomous system number (ASN).
ASNs are needed by network operators to control routing between themselves.
ASNs come as 2 byte and 4 byte numbers.
The 2-byte range 64512 to 65534 and the 4-byte range 4200000000 to 4294967294 is reserved by IANA for private use.
Using
whois to query an ASN:
$ whois AS402332
TODO
RFC 1930, RFC 5396, RFC 6793, RFC 6996.
Border Gateway Protocol (BGP)
The Border Gateway Protocol is an inter-Autonomous System routing protocol.
The protocol's primary purpose is to excange reachability information with other BGP systems.
BGP listens on TCP port 179.
Contrast the BGP with the Interior Gateway Protocol (IGP) which is a routing protocol used to exchange routing information among routers within a single Autonomous System.
TODO: RFC 1518, RFC 1519, RFC 1722, RFC 1930, RFC 1997, RFC 2858.