Chapter4-IPv4
Chapter4-IPv4
COURSE
BASIC COMPUTER NETWORK
3/66
/50 4/66
/50
1. The IPv4 Header 1. The IPv4 Header
Time-to-Live (TTL): Contains an 8-bit binary Internet Header Length (IHL) - Contains a
value that is used to limit the lifetime of a packet 4-bit binary value identifying the number of 32-bit
(referred to as hop count). words in the header. The IHL value varies due to the Options and
Decreased by one each time the packet is processed by a router, or Padding fields.
hop. If the TTL field decrements to 0, the router discards the packet
and sends an Internet Control Message Protocol (ICMP) Time Minimum: 5 Maximum: 15
Exceeded message to the source IP address.
Protocol: This 8-bit binary value indicates the data payload type Total Length (Packet Length), this 16-bit field defines the entire
(upper-layer). packet (fragment) size, including header and data, in bytes.
ICMP (0x01), TCP (0x06), and UDP (0x11) . Minimum: 20 -> Maximum: 65,535 bytes.
Flags - This 3-bit field identifies how the packet is fragmented. It is 2 Fragmentation
used with the Fragment Offset and Identification fields to help
reconstruct the fragment into the original packet.
DF: D Fragments flag, MF: More Fragments flag
R1 R2 FragOffset R3 B FragOffset
1st Fragment 1st Fragment
2nd Fragment 2nd Fragment
3rd Fragment 3rd Fragment
4th Fragment 4th Fragment
9/66
5th Fragment 5th Fragment 10
/50
2. Fragmentation 2. Fragmentation
Flag (3 bits) Reassembly timer
More Fragment
If a fragment arrives, a buffer is allocated.
reserved
(DF) (MF) o Because of the field, the fragment can then be
stored in the buffer in the appropriate position.
Reassembly timer is started.
Must be 0 Must not fragment Set to 1 for all fragments except the final one.
the packet and
must drop it
Tells the receiver where the fragments stop When all fragments have arrived, the packet is sent on up as a
instead. completed IPv4 packet.
11/66
/50 12/66
/50
3. Interfaces
IP addresses are assigned not to hosts or nodes, but to interfaces.
E.g., LAN interface in PC.
3 Interfaces
13 14/66
/50
3. Interfaces 3. Interfaces
Loopback interface Multihomed hosts
Providing a way to deliver IP packets to other processes on the same A non-router host with multiple non-loopback network interfaces is
machine. often said to be multihomed.
o IPv4 loopback address: 127.0.0.1 o Interfaces are been used simultaneously, with different IP
o IPv6 loopback address: ::1 addresses assigned to each.
Client/server testing.
Check the processes in current host. o E.g., Laptops have both an Ethernet interface and a Wi-Fi
interface.
Virtual interface
VPN connections.
Virtual machine
15/66
/50 16/66
/50
4. Special Addresses
Private addresses
IPv4 addresses intended only for site internal use.
If a packet shows up at any non-private router (e.g., at an ISP
router), with a private IPv4 address as either source or destination
address, the packet should be dropped.
4 Special Addresses
23 24/66
/50
5. The Classless IP Delivery Algorithm 5. The Classless IP Delivery Algorithm
Classful (discontinuation) Classless
Fixed the network portion and host portion Dynamic network portion and host portion
o Have to use Subnet Mask
25/66
/50 26/66
/50
Hierarchical routing:
6 IPv4 Subnets first we route to the
primary network, then
inside that site we
route to the subnet,
and finally the last hop
delivers to the host.
29 30/66
/50
Network: 192.168.1.0/25
Mask: 255.255.255.128
Network: 192.168.1.128/25
Mask: 255.255.255.128
31/66
/50 32/66
/50
6. IPv4 Subnets 6. IPv4 Subnets
33/66
/50 34/66
/50
6. IPv4 Subnets
Need 4 Subnets?
Borrowing 2 bits to create 4 subnets. 22 = 4 subnets
35/66
/50 36
7. VLSM 7. VLSM
Traditional subnetting - same number of addresses is allocated for each Variable Length Subnet Mask (VLSM) or subnetting a subnet
subnet. provides more efficient use of addresses.
Subnets that require fewer addresses have unused (wasted) addresses. Process repeated as necessary to
For example, WAN links only need 2 addresses. create subnets of various sizes.
37/66
/50 38/66
/50
7. VLSM 7. VLSM
192.168.20.64/27 192.168.20.128/27
10.0.0.0/8 Subnet using /16
192.168.20.0/27 192.168.20.128/27
Subnet 1st Host Last Host Broadcast
10.0.0.0/16 10.0.0.1 10.0.255.254 10.0.255.255
10.1.0.0/16 10.1.0.1 10.1.255.254 10.1.255.255
10.2.0.0/16 Subnet
10.2.0.1 1st Host
10.2.255.254 Last Host
10.2.255.255 Broadcast
192.168.20.32/27 192.168.20.96/27 192.168.20.64/27
10.3.0.0/16 10.2.0.0/24
10.3.0.1 10.2.0.1
10.3.255.254 10.2.0.254
10.3.255.255 10.2.0.255
Sub-subnet
Etc. 10.2.1.0/24 10.2.1.1 10.2.1.254 10.2.1.255 7 Networks with 30 usable
Using /24
10.255.0.0/16 10.2.2.0/24 10.2.2.1
10.255.0.1 10.255.255.254 10.2.2.254
10.255.255.255 10.2.2.255 addresses for each network
Etc.
10.2.255.0/24 10.2.255.1 10.2.255.254 10.2.255.255
Wasted 28 addresses on each
WAN link
39/66
/50 40/66
/50
7. VLSM 7. VLSM
41/66
/50 42/66
/50
43 44/66
/50
8. Address Resolution Protocol: ARP
45/66
/50 46
9. Dynamic Host Configuration Protocol (DHCP) 9. Dynamic Host Configuration Protocol (DHCP)
DHCP works in a client/server mode. Lease Origination: 4 Step Process.
When the client connects, the server assigns or leases an IP address
to the device.
The device connects to the network with that leased IP address until
the lease period expires.
The host must contact the DHCP server periodically to extend the
lease.
The leasing of addresses assures that addresses that are no longer
used are returned to the address pool for use by other devices.
47/66
/50 48/66
/50
9. Dynamic Host Configuration Protocol (DHCP)
Lease Renewal: 2 Step Process
49/66
/50 50
10. Internet Control Message Protocol 10. Internet Control Message Protocol
ICMP is a protocol for sending IP-layer error and status messages. The Destination Unreachable type has a large number of subtypes:
ICMP messages are identified by an 8-bit type field. Network unreachable: some router had no entry for forwarding
the packet, and no default route.
Queries
sent by one host
to another
Error
sent by
a
router
to the
sender
,
51/66
/50
192.168.4.1 52
10. Internet Control Message Protocol 10. Internet Control Message Protocol
The Destination Unreachable type has a large number of subtypes: The Destination Unreachable type has a large number of subtypes:
Network unreachable: some router had no entry for forwarding Host unreachable: the packet reached a router that was on the
the packet, and no default route. same LAN as the host, but the host failed to respond to ARP queries
192.168.1.0/24 F0/0 192.168.1.0/24 F0/0
192.168.2.0/24 F0/1 192.168.2.0/24 F0/1
192.168.4.0/24 ???
192.168.3.0/24 S0/0/0 192.168.3.0/24 S0/0/0
192.168.4.0/24 S0/0/0
ICMP Request
192.168.4.1 53 192.168.4.100 54
10. Internet Control Message Protocol 10. Internet Control Message Protocol
The Destination Unreachable type has a large number of subtypes: The Destination Unreachable type has a large number of subtypes:
Host unreachable: the packet reached a router that was on the Port unreachable:
same LAN as the host, but the host failed to respond to ARP queries o The packet was sent to a UDP port on a given host, but that port
was not open.
192.168.4.100 ??? TCP, on the other hand, deals with this situation by replying to
ICMP: Host Unreachable the connecting endpoint with a reset packet.
o FYI: the UDP Port Unreachable message is sent to the host, not
to the application on that host that sent the undeliverable packet,
and so is close to useless as a practical way for applications to be
informed when packets cannot be delivered.
192.168.4.100 55 56/66
/50
10. Internet Control Message Protocol 10. Internet Control Message Protocol
The Destination Unreachable type has a large number of subtypes: The Destination Unreachable type has a large number of subtypes:
Port unreachable: Port unreachable:
o The packet was sent to a UDP port on a given host, but that port o The packet was sent to a UDP port on a given host, but that port
was not open. was not open.
HTTP
server
not
DNS
server
192.168.4.1:53 (DNS) 57
192.168.4.1:53 (DNS) 58
10. Internet Control Message Protocol 10. Internet Control Message Protocol
The Destination Unreachable type has a large number of subtypes: The Destination Unreachable type has a large number of subtypes:
Fragmentation required but DF flag set: a packet arrived at a Fragmentation required but DF flag set: a packet arrived at a
router and was too big to be forwarded without fragmentation. router and was too big to be forwarded without fragmentation.
However, the Fragment bit in the IPv4 header was set, However, the Fragment bit in the IPv4 header was set,
forbidding fragmentation. forbidding fragmentation. Packet size is too big, must fragment.
192.168.4.1 59
192.168.4.1 60
10. Internet Control Message Protocol 10. Internet Control Message Protocol
The Destination Unreachable type has a large number of subtypes: The Destination Unreachable type has a large number of subtypes:
Administratively Prohibited: this is sent by a router that knows it Administratively Prohibited: this is sent by a router that knows it
can reach the network in question, but has configure intro to drop can reach the network in question, but has configure intro to drop
the packet and send back Administratively Prohibited messages. A the packet and send back Administratively Prohibited messages. A
router can also be configured to blackhole messages: to drop the router can also be configured to blackhole messages: to drop the
packet and send back nothing. packet and send back nothing.
access to Server 1. Drop the packet.
192.168.4.1 61
192.168.4.1 62
10. Internet Control Message Protocol 10. Internet Control Message Protocol
Traceroute and Time Exceeded Redirects
The traceroute program uses ICMP Time Exceeded messages. Most non-router hosts start up with an IPv4 forwarding table
consisting of a single (default) router.