Show Lecture.IPAddresses as a slide show.
CT320 IP Addresses
Port 49757
198.51.100.135
Port 22
203.0.113.42
Format
An IPv4 (as opposed to the newer IPv6) IP address is
a 32-bit quantity which represents a host on the internet.
It is usually represented as four numbers,
each 0–255, separated by dots. For example:
198.51.100.106
- There are 232 (~4.2 billion) IP addresses.
- This is a ridiculously large number.
- We’re running out.
Grouping
- It is often useful to group IP addresses.
- For example, Hewlett-Packard owns all the 16.whatever IP addresses.
🐷
- Yeah, well, the DoD owns nearly five percent of all IP addresses!!
🐷🐷🐷🐷🐷
- What notation shall we use, other than “whatever”?
Old-Fashioned Classful Addresses
How address ranges used to be allocated
Class | Pattern | Networks | Hosts/network | Addresses |
A | 0nnnnnnn hhhhhhhh hhhhhhhh hhhhhhhh | 27 | 224 (~16 million) | 0–127.whatever |
B | 10nnnnnn nnnnnnnn hhhhhhhh hhhhhhhh | 214 | 216 (65536) | 128–191.whatever |
C | 110nnnnn nnnnnnnn nnnnnnnn hhhhhhhh | 221 | 28 (256) | 192–223.whatever |
- Class A: IBM (380,000 employees in 2016)
or the U.S. Postal Service (639,789 employees in 2017)
- Class B: CSU (33,198 students in 2016)
- Class C: Jack’s house (20 hosts in 2017)
List of assigned class A networks
Classful no good
- Originally, three classes:
- Problem
- Classes too rigid (C too small, B too big)
- Solution
- Rather than having only three possibilities:
- 8-bit class A network
- 16-bit class B network
- 24-bit class C network
- Have a variable-sized network:
- 30 bits, 23 bits, you name it
Masking
- Consider a small business that has been allocated the addresses
198.51.100.0 – 198.51.100.255.
- First 24 bits are the Network ID (the neighborhood)
- Last 8 bits are Host ID (the street address)
- Netmask: FF FF FF 0016
(11111111 11111111 11111111 000000002)
- The 1 bits represent the network
- The 0 bits represent the host
- All the 1 bits in the subnet mask are on the left
- What a stupid system!
- Still used by some Linux networking commands
CIDR
- Subnet masks are old-fashioned
- Use CIDR (Classless Inter-Domain Routing) instead.
- prefix/length
- 198.51.100/24 (omit trailing zero bytes)
- 198.51.100.0/24 (also ok)
- 198.51.100.42/24 (invalid—the last 8 (32−24) bits must be zeroes)
- Does not have to be on byte boundaries.
- 198.51.100.128/27 is acceptable.
- Represents addresses 198.51.100.128 through 198.51.100.159.
- How many hosts is that?
CIDR example
Consider the CS network, 129.82.44/23
- 10000001.01010010.00101100.00000000 = 129.82.44.0
- Make the left 23 bits, the network, red,
and the remaining bits, the host, blue.
- 10000001.01010010.00101100.00000000 = 129.82.44.0
- Now, change all the blue bits from 0 to 1:
- 10000001.01010010.00101101.11111111 = 129.82.45.255
∴ 129.82.44/23 is the range of addresses 129.82.44.0 … 129.82.45.255.
It contains 129.82.44.whatever and 129.82.45.whatever,
for 512 addresses total.
Special classes of addresses
$ host art
art.edu has address 3.233.19.193
art.edu mail is handled by 0 us-smtp-inbound-1.mimecast.com.
art.edu mail is handled by 0 us-smtp-inbound-2.mimecast.com.
$ host denver
$ host tuba
Host tuba not found: 3(NXDOMAIN)
- CSU: 129.82/16
- Documentation:
192.0.2/24, 198.51.100/24, 203.0.113/24
- Private use:
10/8, 172.16/12, 192.168/16
- CSB 315: 192.168.110/24, a subset of 192.168/16
- CS printers: 10/8; only our subnet can access them!
I’m sorry that CSU addresses begin with 129, which is so similar
to the 192 that begins one form of private networks.
/etc/hosts
/etc/hosts
is the first stage of translating a name to an IP address:
$ grep "ub" /etc/hosts
10.1.44.62 tuba.cs.colostate.edu tuba
129.82.44.223 rubens.cs.colostate.edu rubens
129.82.45.169 rhubarb.cs.colostate.edu rhubarb
129.82.45.204 ruby.cs.colostate.edu ruby
$ grep -oP '^(\d+\.){3}' /etc/hosts | sort | uniq -c | pr -2t
2 10.1.101. 31 129.82.119.
8 10.1.118. 11 129.82.138.
116 10.1.44. 246 129.82.208.
10 10.1.45. 203 129.82.44.
1 10.2.44. 171 129.82.45.
1 104.154.34. 5 192.168.100.
1 127.0.0. 1 255.255.255.
74 129.82.118.
Stupid IP Address Tricks
These all work in my browser:
Avoid actual links, as the linkcheck program will complain.
http://cs.colostate.edu
http://%63%73%2e%63%6f%6c%6f%73%74%61%74%65%2e%65%64%75
http://129.82.45.114
http://0x81.0x52.0x2d.0x72
http://0201.0122.055.0162
http://2169646450
http://0x81522d72
http://020124426562