Search notes:

Internet Protocol

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

In Windows, the IP address can be determined with a combination of ipconfig.exe and findstr.exe.
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.
In Windows, C:\Windows\System32\drivers\etc\hosts allows to assign aliases (host names) to IP addresses.

IPv6

See also Linux networking IPv6

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.
BGP-4 is discussed in RFC 4271.
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.

Ports

Bad ports

Some ports are designated as bad ports and might be blocked by a browser (Compare also with Chromium source /net/base/port_util.cc):
Port Typical service
0
1 tcpmux
7 echo
9 discard
11 systat
13 daytime
15 netstat
17 qotd
19 chargen
20 ftp-data
21 ftp
22 ssh
23 telnet
25 smtp
37 time
42 name
43 nicname
53 domain
69 tftp
77
79 finger
87
95 supdup
101 hostname
102 iso-tsap
103 gppitnp
104 acr-nema
109 pop2
110 pop3
111 sunrpc
113 auth
115 sftp
117 uucp-path
119 nntp
123 ntp
135 epmap
137 netbios-ns
139 netbios-ssn
143 imap
161 snmp
179 bgp
389 ldap
427 svrloc
465 submissions
512 exec
513 login
514 shell
515 printer
526 tempo
530 courier
531 chat
532 netnews
540 uucp
548 afp
554 rtsp
556 remotefs
563 nntps
587 submission
601 syslog-conn
636 ldaps
989 ftps-data
990 ftps
993 imaps
995 pop3s
1719 h323gatestat
1720 h323hostcall
1723 pptp
2049 nfs
3659 apple-sasl
4045 npp
4190 sieve
5060 sip
5061 sips
6000 x11
6566 sane-port
6665 ircu
6666 ircu
6667 ircu
6668 ircu
6669 ircu
6679 osaut
6697 ircs-u
10080 amanda

TODO

This page should be merged with TCP/IP

See also

include/uapi/linux/in.h
NETSTAT.EXE
ipconfig.exe

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1788373392, '216.73.217.21', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/networking/IP(277): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78