Document 382907

By Joshua Newell
Protocols and Protocol Binding
• p. 159-162
• Show Activity 6-1
• Show adding protocols
TCP/IP Subnetting
(continued..)
Review
IP Addresses
• Every IP Address has a node portion and a
network portion
IP Address:
Network Portion:
Node Portion:
192.168.5.201
192.168.5.201
192.168.5.201
Subnet Mask
•The subnet mask tells us which part of an IP address
is the node portion vs. the network portion
•An IP address without a subnet mask is meaningless
IP Address:
192.168.5.201
Subnet Mask:
255.255.255.0
---------------------------------------------------Network ID:
192.168.5.0
Subnet Mask and ANDing
• IP:
• Subnet:
IP:
Subnet:
192.168.5.201
255.255.255.0
11000000.10101000.00000101.11001001
11111111.11111111.11111111.00000000
-----------------------------------------------
AND
11000000.10101000.00000101.00000000
TCP/IP Cheat Sheet: The Rules
• The Subnet/network address is always
hidden behind the 1s in the mask
IP:
Subnet:
11000000.10101000.00000101.11001001
11111111.11111111.11111111.00000000
-----------------------------------------------
11000000.10101000.00000101.00000000
TCP/IP Cheat Sheet: The Rules
(Except in special cases)
• The all-1s and all-0s subnet addresses
are invalid (but NOT in CIDR)
Ex.
0s hide the
host
address
Network ID
192.168.1.0
Subnet Mask 255.255.255.128 ->
11111111.11111111.11111111.10000000
192.168.1.250=
192.168.1.5= .00000101
.11111010
These bits belong to
the Big IP in the Sky
--------------------------These are
(we can’t change
the bits
them)
1s hide the
00000000
10000000
that we
subnet(except
address in CIDR
Breaks the rule!
)
own
TCP/IP Cheat Sheet: The Rules
(Except in special cases)
• The all-1s and all-0s host addresses are
invalid (Always)
Ex.
IP Address:
Subnet Mask:
IP Address:
Subnet Mask:
192.168.1.0
255.255.255.0
OR
192.168.1.255
255.255.255.0
Reason Behind the Rule
• The all zeros host address is the same as
the network ID
Ex.
IP: 192.168.1.0
Subnet: 255.255.255.0
---------------------------------------Network ID:
192.168.1.0
• The all ones host address is reserved for
the broadcast address
Classful Networking - <1993
Class
Default Mask
Networks
Hosts
A
255.0.0.0
127
16.8 mil
B
255.255.0.0
16,384
65,534
C
255.255.255.0
2,097,152
254
D
Multicast
E
Experimental/
Reserved
How do we
get this?
Classful Networking - <1993
Class
Leading
Bits
Start
End
A
0
0.0.0.0
127.255.255.255
B
10
128.0.0.0
191.255.255.255
C
110
192.0.0.0
223.255.255.255
D
1110
224.0.0.0
239.255.255.255
E
1111
240.0.0.0
255.255.255.255
Reserved IP Ranges
Addresses
0.0.0.0 0.255.255.255
Purpose
Zero
Addresses
10.0.0.0 10.255.255.255
Private IP
addresses
Localhost
Loopback
Address
Zeroconf /
APIPA
Private IP
addresses
Private IP
addresses
127.0.0.0 127.255.255.255
169.254.0.0 169.254.255.255
172.16.0.0 172.31.255.255
192.168.0.0 192.168.255.255
Class
Total
addresses
A
16,777,216
A
16,777,216
A
16,777,216
B
65,536
B
1,048,576
C
65,536
NAT
`
192.168.5.101
192.168.5.1
`
68.25.13.107
192.168.5.102
192.168.5.0
NAT Enabled Router
Internet
192.168.5.103
192.168.5.104
CIDR (Classless Inter-Domain
Routing) - ~>1993
• Specifically, rather than allocating address
blocks on eight-bit (i.e., octet) boundaries
forcing 8, 16, or 24-bit prefixes, it used the
technique of variable-length subnet
masking (VLSM) to allow allocation on
arbitrary-length prefixes.
My company needs 4 IPs
• With classful subnetting, I would need a Class C (default subnet
mask 255.255.255.0) with 254 IPs What a waste!
• How would we use CIDR?
– We’re only going to need to look at the last octet
• 255.255.255.0
• Remember that the subnet mask can’t have embedded
1s
• So, we need to know what mask to use in the 4th octet
Let’s Look at the Cheat Sheet
Bits
0000 0000
1000 0000
1100 0000
1110 0000
1111 0000
1111 1000
1111 1100
1111 1110
1111 1111
Mask
0
128
192
224
240
248
252
254
255
Blocks
256
128
64
32
16
8
4
2
1
Nets
1
2
2*
6
14
30
62
126
254
Hosts
254
126
62
30
14
6
2
X
X
So we could use a network with a subnet mask of 255.255.255.248
# of 1s in
the mask
CIDR Notation
CIDR
Notation
/24
/25
/26
Bits
0000 0000
1000 0000
1100 0000
Mask
0
128
192
Blocks
256
128
64
Nets
1
2
2*
Hosts
254
126
62
/27
/28
/29
1110 0000
1111 0000
1111 1000
224
240
248
32
16
8
6
14
30
30
14
6
/30
/31
/32
1111 1100
1111 1110
1111 1111
252
254
255
4
2
1
62
126
254
2
X
X
A network with a 255.255.255.248 subnet mask is called a /29
Using Subnetting to Segment a
Network
• Suppose we lease 219.123.113 /24
– (1 network, 254 hosts using 8 host bits)
• We need to borrow some of our host bits
and use them for network bits.
IP
Mask
219.123.113.0000 0000
255.255.255.0000 0000
Ex. Use the /27 Mask
IP
Mask
219.123.113.0
255.255.255.224
What’s the block size? 32
Computer
Number
Block Size/
People Number
(0000 0000)
(1110 0000)
Last Address
Last Address
minus Block Size
0…31 | 32…63 | 64…95 | 96…127 | 128…159 | 160…191 | 192…223 | 224…255
Network ID for
the 0 subnet
Network ID for
the 1 subnet
Network ID for
the 7 subnet
Why is it called the 0 subnet?
• Ex. The /27 mask borrows 3 host bits and makes
them network bits
.0
.224
= 0000 0000
= 1110 0000
• Looking at the 3 borrowed bits:
Borrowed Bits Value
All Bits Value
0000 0000
0
0
0010 0000
1
32
0100 0000
2
64
0110 0000
3
96
1000 0000
4
128
1010 0000
5
160
1100 0000
6
192
1110 0000
7
224
Subnetting Exercise:
You’ve been hired to troubleshoot a problem network. The
customer says that they are having problems with
computers being able to connect to each other.
• The network has computers with the following IPs:
–
–
–
–
–
–
–
201.54.13.1
201.54.13.6
201.54.13.21
201.54.13.31
201.54.13.32
201.54.13.63
201.54.13.65
• All the computers are using the 255.255.255.224 mask
Which computers are able to communicate?
Sample Problem:
Select the correct base network ID for 203.121.45.27 /29
• We could enumerate the /29 segments but that would
take a while.
• Instead, convert the IP to binary, but only the relevant
octets.
– 27d -> binary = 0001 1011
• Look at the cheatsheet to get the subnet mask for /29
– 255.255.255.248 -> 1111 1000
• AND the IP and the mask
0001 1011
AND 1111 1000
--------------------------------0001 1000b-> 24d
• So, the base network ID is 203.121.45.24
Exercise
• Select the correct base network ID for
203.121.45.31 /30
IP
203.121. 45 . 0001 1111
Mask
255.255.255. 1111 1100
------------------------------------------------AND
203.121. 45 . 0001 1100 = 28
203.121.45.28
Subnetting Exercise 2:
Write out the subnets for the 202.54.13.0
network, subnetted with the
255.255.255.240 mask.
What’s the network address of the 0 subnet?
What’s the first host address in the 0
subnet?
What’s the last host address in the 2
subnet?
What’s the broadcast address for the 3
subnet?
TCP/IP Network Model
Thanks!
Hey everybody!
I’ll remember
Who
ARP
is
that
192.168.5.104?
for next time.
`
192.168.5.101
Not me… Not me…
Not me…
`
192.168.5.102
192.168.5.1
68.25.13.107
Internet
NAT Enabled Router
192.168.5.103
192.168.5.104
Hey 192.168.5.101! I am.
My MAC is
00:11:22:33:44:AB:CD:EF
I want to see what’s new on
Hey www.yahoo.com
operating system, send
an http get request to
www.yahoo.com on Port 80
Ports and Sockets
`
I provide http
services on
port 80
68.15.123.14
Internet
I provide ftp
services on
port 20
ftp.microsoft.com
www.yahoo.com
Ok! But first I need to create a port
for you
sotoI can
keep track of
I also
need
get www.yahoo.com’s
Dear {tcp,
87.248.113.14, 80},
everything.
IP address….
OK, got it from DNS
Please send me your webpage. My
address is: 68.15.123.14:49152
`
68.15.123.14
I got a message from
www.yahoo.com. It’s addressed on
port 49152. That’s for Internet
Explorer. Hey IE, here’s your
page.
Thanks!
TCP: 49152 - OPEN
Internet
Dear {tcp, 68.15.123.14, 49152},
I got your message. The webpage is
as follows:….
ftp.microsoft.com
www.yahoo.com
DHCP Lease Process
DHCP Discover (Broadcast)
DHCP Offer (Broadcast)
`
DHCP Request (Broadcast)
DHCP Acknowledgment (Broadcast)
DHCP Client
DHCP Server
DHCP Relay Agent
•Routers do not forward broadcast traffic
•(Does everyone in the world need to hear your LAN ARP requests?)
`
192.168.5.101
DHCP
192.168.5.1
`
`
192.168.6.102
192.168.6.1
192.168.5.102
192.168.5.0
192.168.6.0
192.168.6.103
192.168.5.103
192.168.6.104
192.168.5.104
DHCP Relay Process
DHCP Discover (Broadcast)
`
DHCP Client
DHCP Offer (Broadcast)
DHCP Relay Agent
DHCP Request (Broadcast)
DHCP Acknowledgment (Broadcast)
DHCP Discover, DHCP Offer, DHCP Request,
DHCP Acknowledgment
(All done in Unicast)
DHCP Server
DNS
• FQDN – Fully qualified domain name
www.google.com.
– .(dot) = Root
– com = Top Level Domain (TLD)
– Google = Second-level domain
– www = Alias or Host Name
DNS