Provides a route-able protocol for delivering data-gram packets across networks based on IP address. There are two version, version 4 (IPv4) which uses 32 bit addresses (< 4 billion addresses) and a less widely used version 6 (IPv6) which uses 128 bit addresses (< ~340 undecillion addresses). For now IPv4 still remains the primary Internet protocol:
An IPv4 Header contains among other information:
Packets are routed based on destination. It isn't necessarily the case that a packet will be returned along the same path that one was sent. It is also the case that the source address can be completely bogus.
/etc/protocols
> ifconfig
Example:
ifconfig eth0 139.102.14.201 netmask 255.255.255.0 broadcast 139.102.14.255 or maybe: ifconfig eth0 139.102.14.201/24 Configures eth0 for: IP address 139.102.14.201 Netmask 255.255.255.0 Broadcast address 139.102.14.255
ifconfig eth0 139.102.14.201 netmask 255.255.255.0 broadcast 139.102.14.255 or maybe: ifconfig eth0 139.102.14.201/24
ifconfig eth0 139.102.14.201 netmask 255.255.255.0 broadcast 139.102.14.255
ifconfig eth0 139.102.14.201/24
> ip
Consist of 32 bits, typically listed in 4 8-bit "octet" dot-decimal notation.
Distributed by the Internet Assigned Numbers Association (IANA) a department of ICANN (Internet Corporation of Assigned Names and Numbers):
Delegates allocations to Regional Internet Registries (RIRs) which each address different areas of the world.
Administers the data in the root domain name servers
ICANN also:
IPv4 Private addresses:
CIDR Starting address Ending address Number of IPs 10.0.0.0/8 10.0.0.0 10.255.255.255 (~16M) 172.16.0.0/12 172.16.0.0 172.31.255.255 (~1M) 192.168.0.0/16 192.168.0.0 192.168.255.255 (~65K)
The 127.0.0.0/8 block is the loopback or localhost address range and is a virtual network range that exists only with a machine itself via the virtual loopback device lo or lo0, typically assigned the address 127.0.0.1.
lo
lo0
127.0.0.1
IP addresses are usually assigned in two ways:
Static assignment, where the IP address is configured manually on the host and does not change.
Dynamic assignment, where a protocol, such as DHCP (Dynamic Host Configuration Protocol) or BOOTP is used to request an IP address.
The Broadcast address for a host is the host part of the IP address where all bits are 1's. (139.102.14.201&255.255.255.0)|0.0.0.255 -> 139.102.14.255 Packets with the destination set to the broadcast address are typically recieved by all machines on the local network.
(139.102.14.201&255.255.255.0)|0.0.0.255
139.102.14.255
Multicast IP addresses: 224.0.0.0/4 (224.0.0.0-239.255.255.255)
224.0.0.0/4
224.0.0.0-239.255.255.255
> route
> routel
> traceroute [-n] hostname
> traceroute
-n
# echo "1" > /proc/sys/net/ipv4/ip_forward
> ping hostname
> ping
Classful network design:
Classless Inter-Domain Routing (CIDR)
CIDR divides an IP network into smaller logical sub-networks. Given:
[ Network prefix ][ Host number ] / \ [ Network prefix ][Subnet #][Host #]
192.168.1.0/30: (2 bits for host part)
11111111.11111111.11111111.111111 00 Netmask: 255.255.255.252 11000000.10101000.00000001.000000 00 Network address: 192.168.1.0 11000000.10101000.00000001.000000 01 1st IP: 192.168.1.1 11000000.10101000.00000001.000000 10 2nd IP: 192.168.1.2 11000000.10101000.00000001.000000 11 Broadcast address: 192.168.1.3
11111111.11111111.11111111.111111 00
11000000.10101000.00000001.000000 00
11000000.10101000.00000001.000000 01
11000000.10101000.00000001.000000 10
11000000.10101000.00000001.000000 11
192.168.1.4/30: (2 bits for host part, second network)
11111111.11111111.11111111.111111 00 Netmask: 255.255.255.252 11000000.10101000.00000001.000001 00 Network address: 192.168.1.4 11000000.10101000.00000001.000001 01 1st IP: 192.168.1.5 11000000.10101000.00000001.000001 10 2nd IP: 192.168.1.6 11000000.10101000.00000001.000001 11 Broadcast address: 192.168.1.7
11000000.10101000.00000001.000001 00
11000000.10101000.00000001.000001 01
11000000.10101000.00000001.000001 10
11000000.10101000.00000001.000001 11
192.168.1.10/16: (16 bits for host part)
11111111.11111111. 00000000.00000000 Netmask: 255.255.0.0 11000000.10101000. 00000000.00000000 Network address: 192.168.0.0 11000000.10101000. 00000000.00000001 1st IP: 192.168.0.1 11000000.10101000. 11111111.11111110 last IP: 192.168.255.254 11000000.10101000. 11111111.11111111 Broadcast address: 192.168.255.255
11111111.11111111. 00000000.00000000
11000000.10101000. 00000000.00000000
11000000.10101000. 00000000.00000001
11000000.10101000. 11111111.11111110
11000000.10101000. 11111111.11111111
139.102.14.201/24: (8 bits for host part):
11111111.11111111.11111111. 00000000 Netmask: 255.255.255.0 10001011.01100110.00001110. 00000000 Network address: 139.102.14.0 10001011.01100110.00001110. 00000001 1st IP: 139.102.14.1 10001011.01100110.00001110. 11111110 last IP: 139.102.14.254 10001011.01100110.00001110. 11111111 Broadcast address: 139.102.14.255
11111111.11111111.11111111. 00000000
10001011.01100110.00001110. 00000000
10001011.01100110.00001110. 00000001
10001011.01100110.00001110. 11111110
10001011.01100110.00001110. 11111111