Netwerken · Netwerken TCP / IP. 3de jaar Netwerkbeheerder Page: 2 Syntra Antwerpen &...
Transcript of Netwerken · Netwerken TCP / IP. 3de jaar Netwerkbeheerder Page: 2 Syntra Antwerpen &...
3de jaar Netwerkbeheerder Page: 1
Syntra Antwerpen & Vlaams-Brabant
Netwerken
TCP / IP
3de jaar Netwerkbeheerder Page: 2
Syntra Antwerpen & Vlaams-Brabant
• IPv4 Essentials: Architectural overview.
– The 4-layer model.– ARP– IP– ICMP– IGMP– TCP / UDP
• IPv4 Essentials: addressing / netmasking.
– Classfull IP adressing– Limitations of classfull adressing– Subnetting– Subnetting example
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 3
Syntra Antwerpen & Vlaams-Brabant
2.1.1 The 4-layer model.
2.1 IP Essentials: Architectural overview.
Layer 5,6,7Layer 5,6,7
Layer 4Layer 4
Layer 3Layer 3
Layer 1,2Layer 1,2
FTPFTPSMTPSMTP TelnetTelnet SNMPSNMP TFTPTFTP NFSNFS
TCPTCP UDPUDP
IPIP ICMPICMP
ARPARP
Media Access (LAN & WAN)Media Access (LAN & WAN)
RARPRARP
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 4
Syntra Antwerpen & Vlaams-Brabant
2.1.1 The 4-layer model.
• Layer 1, Media access layer (OSI-layers 1 & 2).
– Network interface layer.– Transmitting and receiving of data (frames).
• Layer 2, IP/ARP/ICMP/IGMP (OSI-layer 3)
– Internet layer.– IP (Internet Protocol): routing of data packets.– ARP (Address Resolution Protocol): collects hardware addresses of hosts in the same
physical network.– ICMP (Internet Control Message Protocol): sends messages and creates error messages
when packets are not correctly delivered.– IGMP (Internet Group Management Protocol): used for multicasting.
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 5
Syntra Antwerpen & Vlaams-Brabant
2.1.1 The 4-layer model.
• Layer 3, TCP / UDP (OSI-layer 4)
– Transport layer.– TCP (Transport Control Protocol): connection-oriented communication, creates a logical link
between sender and receiver reliable communication.– UDP (User Datagram Protocol): connection-less communication. No checking to see if data
arrives correctly at the receiver unreliable communication.
• Layer 4, SMTP, FTP, Telnet, … (OSI-layers 5,6 & 7)
– Application layer.– All different IP applications are situated in this layer :
• SMTP: Mail• FTP: File Transfer Protocol.• …
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 6
Syntra Antwerpen & Vlaams-Brabant
2.1.2 ARP.
• Sender must know MAC address of receiver in order to communicate.
• Address resolution is the process of linking an IP address to a MAC address.
• Broadcast based.
• How ?
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 7
Syntra Antwerpen & Vlaams-Brabant
2.1.2 ARP.
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 8
Syntra Antwerpen & Vlaams-Brabant
2.1.2 ARP.
• ARP-cache used to minimalize number of broadcasts.
• Contains dynamic and static addresses:
– dynamic: addresses are added and removed automatically.– static: address stays in cache till the next reboot of the system.
• ARP-cache contains permanently the broadcast address of the local subnet. It’s never shown if you look at the content of the cache.
• Every entry in the cache has a potential lifetime of 10 minutes.
• If an entry is not used within 2 minutes it is removed.
• If an entry is used within 2 minutes it stays in the cache.
• Every entry is always removed after max 10 minutes, even if it is being used!
• When cache is full FIFO principle (First In, First Out).
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 9
Syntra Antwerpen & Vlaams-Brabant
2.1.3 IP.
• Connection-less protocol No reliable communication.
• No acknowledgement when packets arrive correctly at the receiver.
• Acknowledgements are handled by the applications in the upper layers.
• Following fields are added into the IP-header when a packet arrives from the transport layer:
2.1 IP Essentials: Architectural overview.
Field Function
IP address sender The IP address of the sender (source IP)
IP address receiver The IP address of the receiver (destination IP)
Protocol Informs the IP-layer of the receiver to which protocol the data has to be transferrred: TCP or UDP
Checksum A calculation method to check if the IP packet contains errors
TTL (Time To Live) The number of seconds a data packet can exist. Every time a packet passes a router, TTL = TTL -1. When TTL = 0 the packet is dropped.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 10
Syntra Antwerpen & Vlaams-Brabant
2.1.3 IP.
• How does the routing process work?
On the PC:
2.1 IP Essentials: Architectural overview.
New IP packet
Localaddress?
yes Packet is sent directlyto receiver
noExisting routeto receiver?
Packet is sent viathis route to receiver
yes
no
Packet is sent tothe default gateway
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 11
Syntra Antwerpen & Vlaams-Brabant
2.1.3 IP.
On the router:
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
Incoming IP packet
TTL = 0 ??
TTL = TTL - 1
Drop Packetyesno
Fragment packet ??
Calculate newchecksum
LocalAddress ??
Forward to receiver
Forward todefault router
yes
Create new header for every fragment withfollowing fields:•A flag to indicate that other fragments follow.•A fragment ID.•A fragment offset (tells receiver how many fragments to use for reassembling ip packet.
yes
noExisting routeto receiver?
no
yes
Packet is sent usingthis route
no Fragment packet ??
Calculate newchecksum
Fragmentation if needed.Procedure idem as described above
Fragmentation if needed.Procedure idem as described above
3de jaar Netwerkbeheerder Page: 12
Syntra Antwerpen & Vlaams-Brabant
3.1.4 ICMP.
• Doesn’t make IP reliable.
• Tries to report errors and to give feedback on certain conditions.
• ICMP packages can be delayed or can be lost during transmission.
• Unreliable.
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 13
Syntra Antwerpen & Vlaams-Brabant
2.1.5 IGMP.
• Defined in RFC 1112.
• Only used for multicasting (one to many transmissions).
• IGMP information is sent to all routers supporting multicasting.
• IGMP Packets are sent as datagrams and therefore unreliable.
• PS.: Use following url to look for RFC’s:
http://www.rfc-editor.org/rfcsearch.html
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 14
Syntra Antwerpen & Vlaams-Brabant
2.1.5 IGMP.
• Defined in RFC 1112.
• Only used for multicasting (one to many transmissions).
• IGMP information is sent to all routers supporting multicasting.
• IGMP Packets are sent as datagrams and therefore unreliable.
• PS.: Use following url to look for RFC’s:
http://www.rfc-editor.org/rfcsearch.html
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 15
Syntra Antwerpen & Vlaams-Brabant
2.1.6 TCP / UDP.
• TCP: Connection oriented service reliable.• UDP: Connection-less service unreliable.
2.1 IP Essentials: Architectural overview.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 16
Syntra Antwerpen & Vlaams-Brabant
2.1.7 Layered communication.
• How do layers address each other?
At least 3 addresses: IP + Port Number + Protocol type (TCP or +UDP) = Socket
2.1 IP Essentials: Architectural overview.
To: 34To: 34From: 2813From: 2813
To: 193.210.191.190To: 193.210.191.190From: 193.210.191.2From: 193.210.191.2
To: 27BACD456FECTo: 27BACD456FECFrom: A460F41BC52DFrom: A460F41BC52D
MACMAC
IPIP
TCPTCP
Applic.Applic.From: Prot + From: Prot + IPIP + + Port Port ((> Socket> Socket))To: Prot + IP + Port (< Socket)To: Prot + IP + Port (< Socket)
From: 2813From: 2813To: 34To: 34
From: 193.210.191.2From: 193.210.191.2To: 193.210.191.190To: 193.210.191.190
From: A460F41BC52DFrom: A460F41BC52DTo: 27BACD456FECTo: 27BACD456FEC
From: Prot + From: Prot + IPIP + + Port Port ((> Socket> Socket))To: Prot + IP + Port (< Socket)To: Prot + IP + Port (< Socket)
Module 2: IPv4 Essentials
From: 34From: 34To: 2813To: 2813
To: 2813To: 2813From: 34From: 34
From: 193.210.191.190From: 193.210.191.190To: 193.210.191.2To: 193.210.191.2
To: 193.210.191.2To: 193.210.191.2From: 193.210.191.190From: 193.210.191.190
From: 27BACD456FECFrom: 27BACD456FECTo: A460F41BC52DTo: A460F41BC52D
To: A460F41BC52DTo: A460F41BC52DFrom: 27BACD456FECFrom: 27BACD456FEC
3de jaar Netwerkbeheerder Page: 17
Syntra Antwerpen & Vlaams-Brabant
2.2.1 Classfull IP adressing.
• IP address = 32 bit
• IP address has 2 parts:
– Network ID or network prefix: identifies the network where the system belongs too.– Host ID or host number: identifies the system itself.
2.2 IP Essentials: addressing / netmasking.
Network ID
32 bit IPv4 address
Host ID
• 2 hosts on the same network both have the same network prefix but different host number.
• 2 hosts on a different network both have a different network prefix but could have same host number (not necessary)
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 18
Syntra Antwerpen & Vlaams-Brabant
2.2.1 Classfull IP adressing.
2.2 IP Essentials: addressing / netmasking.
Network : “0” + 7 bitsdec. addr. : 1.x.x.x to 126.x.x.xSubnet mask : 255.0.0.0126 networks of 16.777.214 hosts50% of total IPv4 address space
Network :” 10” + 14 bitsdec.addr. : 128.0.x.x to 191.255.x.xSubnet mask : 255.255.0.016.384 networks of 65.534 hosts25% of total IPv4 address space
Network :” 110” + 21 bitsdec.addr.: 192.0.0.x to 223.255.255.xSubnet mask : 255.255.255.02.097.152 networks of 254 hosts.12,5% of total IPv4 address space.
Class A (1-126)
0 + 7bits 24 bits
Network Host
Class B (128-191)
1 0 + 14 bits 16 bits
HostNetwork
Class C (192-223)
1 1 0 + 21 bits 8 bits
HostNetwork
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 19
Syntra Antwerpen & Vlaams-Brabant
2.2.1 Classfull IP adressing.
2.2 IP Essentials: addressing / netmasking.
Network : “1110” + 4 bitsdec. addr. : 224.x.x.x to 239.x.x.xSubnet mask : 128.0.0.016 networks of 16.777.214 hosts.6,25% of total IPv4 address space.
Network :” 1111” + 20 bitsdec.addr. : 240.x.x.x to 255.x.x.xSubnet mask : 255.255.255.01.048.576 networks of 254 hosts6,25% of total IPv4 address space.
Class D (224-239)
1 1 1 0 + 4 bits 24 bits
Host
Class E (240-255)
1 1 1 1 + 20 bits 8 bits
HostNetwork
Network
• Class D used for multicasting.
• Class E Experimental use only.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 20
Syntra Antwerpen & Vlaams-Brabant
2.2.2 Limitations of classfull IP adressing.
• In the early days of internet IP address space was given to company based on what they were asking, not on what they needed.
• This was allowed because the IPv4 address space seemed inexhaustible infinitesimal big.
• Nobody worried about exhausting the available IPv4 address space.
• By choosing to work with a 32 bit address the available address space is 232 = 4.294.967.296 addresses
• Problem for medium-sized companies :– a class C network = too small– a class B network = too big
• As a result lots of companies received an IP network range which was too big lots of IP addresses were unusable.
• Not a very efficient use of the IPv4 address space!
2.2 IP Essentials: addressing / netmasking.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 21
Syntra Antwerpen & Vlaams-Brabant
2.2.3 Subnetting.
• Third level added in the structure of the IP address Subnet number
2.2 IP Essentials: addressing / netmasking.
Network prefix Host number
Classfull hierarchy with 2 levels
Network prefix Host numberSubnet number
Subnet hierarchy with 3 levels
extended network prefix
• Extended network prefix = Network prefix + Subnet number
• Defined by the subnet mask.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 22
Syntra Antwerpen & Vlaams-Brabant
2.2.3 Subnetting.
• Bits in subnet mask and the bits in IP address have a 1 to 1 relation.
• For the bits in subnet mask equal to 1 corresponding bits in IP address are part of extended network prefix.
• For the bits in subnet mask equal to 0 corresponding bits in IP address are part of host number
2.2 IP Essentials: addressing / netmasking.
130.5.5.25 (class B) 10000010 . 00000101 . 00000101 . 00011001
255.255.255.0 11111111 . 11111111 . 11111111 . 00000000
Extended Network Prefix
SubnetNumberNetwork Prefix
HostNumber
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 23
Syntra Antwerpen & Vlaams-Brabant
2.2.3 Subnetting.
• Sometimes one only speaks about the length of the extended network prefix and not about the subnet mask.
• Length of extended network prefix = number of bits equal to 1 in subnet mask.
• Different notation:
– subnet mask 255.255.255.0 /24 (24 bits are equal to 1 in subnet mask)– subnet mask 255.255.0.0 /16 (16 bits are equal to 1 in subnet mask)– subnet mask 255.0.0.0 /8 (8 bits are equal to 1 in subnet mask)
2.2 IP Essentials: addressing / netmasking.
130.5.5.25 10000010 . 00000101 . 00000101 . 00011001
255.255.255.0 11111111 . 11111111 . 11111111 . 00000000
130.5.5.25 / 24 10000010 . 00000101 . 00000101 . 00011001
or
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 24
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Facts:
Network number 193.1.1.0 / 24 has been assigned to a company.6 subnets have to be created.The biggest subnet must contain 25 hosts.
1. Questions:
Calculate all possible subnets and give the respective subnet ID’s.Give the broadcast address for every subnet.Calculate and give all host addresses for the second subnet.
2.2 IP Essentials: addressing / netmasking.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 25
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define subnet mask / extended network prefix.
How many bits do we need to create 6 subnets ?
3 bits (binary system !) 23 = 8 possible subnets
What is the extended network prefix ?
We have received a /24 network ID already 24 bits in subnet mask. We want to subnet this network in 8 different subnets we need the 3 extra bits to do this. In total we need 24 + 3 = 27 bits for the extended network prefix
We have 5 bits left for the host number. 25 = 32 possible combinations the addresses with all bits = 0 (subnet ID) or all bits = 1 (broadcast) are never a host address Maximum number of hosts = 32 – 2 = 30 (still more than is needed)
2.2 IP Essentials: addressing / netmasking.
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 26
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define subnet mask / extended network prefix.
2.2 IP Essentials: addressing / netmasking.
193.1.1.0 11000001 . 00000001 . 00000001 . 000
255.255.255.224 11111111 . 11111111 . 11111111 .
Extended Network Prefix – 27 bits
SubnetNumber
bits
Network Prefix
HostNumberbits
00000
111 00000
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 27
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define different subnet ID’s.
2.2 IP Essentials: addressing / netmasking.
Basic network address : 11000001.00000001.00000001.00000000 = 193.1.1.0 / 24
Subnet #0 : 11000001.00000001.00000001.00000000 = 193.1.1.0 / 27
Subnet #1 : 11000001.00000001.00000001.00100000 = 193.1.1.32 / 27
Subnet #2 : 11000001.00000001.00000001.01000000 = 193.1.1.64 / 27
Subnet #3 : 11000001.00000001.00000001.01100000 = 193.1.1.96 / 27
Subnet #4 : 11000001.00000001.00000001.10000000 = 193.1.1.128 / 27
Subnet #5 : 11000001.00000001.00000001.10100000 = 193.1.1.160 / 27
Subnet #6 : 11000001.00000001.00000001.11000000 = 193.1.1.192 / 27
Subnet #7 : 11000001.00000001.00000001.11100000 = 193.1.1.224 / 27
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 28
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Subnet with all bits = 0 and all bits = 1.
2.2 IP Essentials: addressing / netmasking.
Subnet ID : 193.1.1.0 / 27 11000001 . 00000001 . 00000001 . 000
27 bit - prefix
00000
Network ID : 193.1.1.0 / 24 11000001 . 00000001 . 00000001 . 000
24 bit - prefix
00000
Subnet broadcast : 193.1.1.255 / 27 11000001 . 00000001 . 00000001 . 111
27 bit - prefix
11111
Network broadcast : 193.1.1.255 / 24 11000001 . 00000001 . 00000001 . 111
24 bit - prefix
11111
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 29
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define all possible host addresses for subnet #2.
2.2 IP Essentials: addressing / netmasking.
Subnet #2 : 11000001.00000001.00000001.01000000 = 193.1.1.64 / 27
Host #1 : 11000001.00000001.00000001.01000001 = 193.1.1.65 / 27
Host #2 : 11000001.00000001.00000001.01000010 = 193.1.1.66 / 27
Host #3 : 11000001.00000001.00000001.01000011 = 193.1.1.67 / 27
Host #4 : 11000001.00000001.00000001.01000100 = 193.1.1.68 / 27
Host #5 : 11000001.00000001.00000001.01000101 = 193.1.1.69 / 27
Host #6 : 11000001.00000001.00000001.01000110 = 193.1.1.70 / 27
Host #7 : 11000001.00000001.00000001.01000111 = 193.1.1.71 / 27
Host #8 : 11000001.00000001.00000001.01001000 = 193.1.1.72 / 27
Host #9 : 11000001.00000001.00000001.01001001 = 193.1.1.73 / 27
Host #10 : 11000001.00000001.00000001.01001010 = 193.1.1.74 / 27
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 30
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define all possible host addresses for subnet #2.
2.2 IP Essentials: addressing / netmasking.
Subnet #2 : 11000001.00000001.00000001.01000000 = 193.1.1.64 / 27
Host #11 : 11000001.00000001.00000001.01001011 = 193.1.1.75 / 27
Host #12 : 11000001.00000001.00000001.01001100 = 193.1.1.76 / 27
Host #13 : 11000001.00000001.00000001.01001101 = 193.1.1.77 / 27
Host #14 : 11000001.00000001.00000001.01001110 = 193.1.1.78 / 27
Host #15 : 11000001.00000001.00000001.01001111 = 193.1.1.79 / 27
Host #16 : 11000001.00000001.00000001.01010000 = 193.1.1.80 / 27
Host #17 : 11000001.00000001.00000001.01010001 = 193.1.1.81 / 27
Host #18 : 11000001.00000001.00000001.01010010 = 193.1.1.82 / 27
Host #19 : 11000001.00000001.00000001.01010011 = 193.1.1.83 / 27
Host #20 : 11000001.00000001.00000001.01010100 = 193.1.1.84 / 27
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 31
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define all possible host addresses for subnet #2.
2.2 IP Essentials: addressing / netmasking.
Subnet #2 : 11000001.00000001.00000001.01000000 = 193.1.1.64 / 27
Host #21 : 11000001.00000001.00000001.01010101 = 193.1.1.85 / 27
Host #22 : 11000001.00000001.00000001.01010110 = 193.1.1.86 / 27
Host #23 : 11000001.00000001.00000001.01010111 = 193.1.1.87 / 27
Host #24 : 11000001.00000001.00000001.01011000 = 193.1.1.88 / 27
Host #25 : 11000001.00000001.00000001.01011001 = 193.1.1.89 / 27
Host #26 : 11000001.00000001.00000001.01011010 = 193.1.1.90 / 27
Host #27 : 11000001.00000001.00000001.01011011 = 193.1.1.91 / 27
Host #28 : 11000001.00000001.00000001.01011100 = 193.1.1.92 / 27
Host #29 : 11000001.00000001.00000001.01011101 = 193.1.1.93 / 27
Host #30 : 11000001.00000001.00000001.01011110 = 193.1.1.94 / 27
Module 2: IPv4 Essentials
3de jaar Netwerkbeheerder Page: 32
Syntra Antwerpen & Vlaams-Brabant
2.2.4 Subnetting example.
1. Answer:
Define broadcast address for every subnet.
Broadcast address = address with all bits of the host number = 1
2.2 IP Essentials: addressing / netmasking.
Basic network address : 11000001.00000001.00000001.00000000 = 193.1.1.0 / 24
Broadcast subnet #0 : 11000001.00000001.00000001.00011111 = 193.1.1.31 / 27
Broadcast subnet #1 : 11000001.00000001.00000001.00111111 = 193.1.1.63 / 27
Broadcast subnet #2 : 11000001.00000001.00000001.01011111 = 193.1.1.95 / 27
Broadcast subnet #3 : 11000001.00000001.00000001.01111111 = 193.1.1.127 / 27
Broadcast subnet #4 : 11000001.00000001.00000001.10011111 = 193.1.1.159 / 27
Broadcast subnet #5 : 11000001.00000001.00000001.10111111 = 193.1.1.191 / 27
Broadcast subnet #6 : 11000001.00000001.00000001.11011111 = 193.1.1.223 / 27
Broadcast subnet #7 : 11000001.00000001.00000001.11111111 = 193.1.1.255 / 27
Module 2: IPv4 Essentials