Sunteți pe pagina 1din 36

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: 192.168.5.201
Network Portion: 192.168.5.201
Node Portion: 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: 192.168.5.201
• Subnet: 255.255.255.0

IP: 11000000.10101000.00000101.11001001
Subnet: 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: 11000000.10101000.00000101.11001001
Subnet: 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
Network ID 192.168.1.0 host
Subnet Mask 255.255.255.128 -> address

11111111.11111111.11111111.10000000
These bits belong to 192.168.1.250=
192.168.1.5= .00000101
.11111010
the Big IP in the Sky
(we can’t change
--------------
--------------
These are
the bits
them) 1s hide the 00000000
10000000
that we
Breaks the rule!
subnet(except
address in CIDR )
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: 192.168.1.0
Subnet Mask: 255.255.255.0
OR
IP Address: 192.168.1.255
Subnet Mask: 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/ How do we
get this?
Reserved
Classful Networking - <1993
Class Leading Start End
Bits
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
Total
Addresses Purpose Class addresses
0.0.0.0 - Zero
0.255.255.255 Addresses A 16,777,216
   10.0.0.0 -
10.255.255.255 Private IP a A 16,777,216
ddresses
Localhost
  127.0.0.0 - Loopback
127.255.255.255 Address A 16,777,216
169.254.0.0 - Zeroconf /
169.254.255.255 APIPA B 65,536
 172.16.0.0 -
172.31.255.255 Private IP a B 1,048,576
ddresses
192.168.0.0 -
192.168.255.255 Private IP a 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 Mask Blocks Nets Hosts
0000 0000 0 256 1 254
1000 0000 128 128 2 126
1100 0000 192 64 2* 62
1110 0000 224 32 6 30
1111 0000 240 16 14 14
1111 1000 248 8 30 6
1111 1100 252 4 62 2
1111 1110 254 2 126 X
1111 1111 255 1 254 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 Bits Mask Blocks Nets Hosts
/24 0000 0000 0 256 1 254
/25 1000 0000 128 128 2 126
/26 1100 0000 192 64 2* 62
/27 1110 0000 224 32 6 30
/28 1111 0000 240 16 14 14
/29 1111 1000 248 8 30 6
/30 1111 1100 252 4 62 2
/31 1111 1110 254 2 126 X
/32 1111 1111 255 1 254 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 219.123.113.0000 0000
Mask 255.255.255.0000 0000
Ex. Use the /27 Mask
IP 219.123.113.0 (0000 0000)
Mask 255.255.255.224 (1110 0000)
What’s the block size? 32 Last Address

Computer Block Size/ Last Address


Number People Number minus Block Size

0…31 | 32…63 | 64…95 | 96…127 | 128…159 | 160…191 | 192…223 | 224…255

Network ID for Network ID for Network ID for


the 0 subnet the 1 subnet the 7 subnet
Why is it called the 0 subnet?
• Ex. The /27 mask borrows 3 host bits and makes them
network bits
.0 = 0000 0000
.224 = 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!
is
that
ARP
Hey everybody!
I’ll remember
192.168.5.104?
Who
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 operating system,
www.yahoo.com
Ports and Sockets
send an http get request to
www.yahoo.com on Port 80

68.15.123.14
I provide http
services on
port 80
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
I also sotoI can
need keep track of
get www.yahoo.com’s
Dear {tcp, 87.248.113.14,
everything. 80},
IP address…. OK, got it from DNS
Please send me your webpage. My
address is: 68.15.123.14:49152

` I got a message from www.yahoo.com


. It’s addressed on port 49152. That’s
for Internet Explorer. Hey IE, here’s
68.15.123.14
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.1 192.168.6.102
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 Relay Agent
DHCP Offer (Broadcast)

DHCP Client 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

S-ar putea să vă placă și