1.24k likes | 1.37k Views
212 F Network Programming and Design TCP/IP 5 March 2009. Philip Tsang. New Learning Ecology Innovation in LT&R : 3C + C Skills, YouTube and Podcasting. Contents. C ritical Thinking. T&L. Collaborative. Communicative. Agenda for TCP/IP. Review of Quizzes of 25 /27 Feb
E N D
212 F Network Programming and Design TCP/IP 5 March 2009 Philip Tsang
New Learning Ecology Innovation in LT&R: 3C + C Skills, YouTube and Podcasting Contents Critical Thinking T&L Collaborative Communicative
Agenda for TCP/IP • Review of Quizzes of 25 /27 Feb • Cover Key concepts in Unit 3 • TCP/IP architecture & Basic concepts • Internet Layer • IP addressing, Subnet, IP Routing, Routing Table, Routing protocols, CIDR, ICMP • Address translation • ARP : IP address -> MAC address • RARP : MAC address -> IP address • Transport Layer • TCP (Transmission Control Protocol) • UDP (User Datagram Protocol)
Quiz of 25 Feb 2008 • Name:________________ • Student #______________ • Date: 25 Feb 2008 • 212F TCP/IP Self Assessment question Quiz • (1) Identify and describe two methods to handle the rapid depletion of IP addresses. [2 marks] • (2) Your boss asks you to create 124 sub-networks with the assigned Class B address 150.150.0.0. Answer the following questions: • What is the subnet mask? [1/2] • List the first three valid network numbers. [1/2] • List the range of host IP addresses on those three networks. [2] • List the last valid network and range of IP addresses. [2] • How many subnets does this solution allow? [2] • How many host addresses can be on each subnet? [1]
Answer • (a)To have 124 sub-networks, we need to borrow 7 bits from the host field. So the subnet mask is 255.255.254.0.1 • (b) 150.150.2.0, 150.150.4.0, • (c) 150.150.2.1.– 150.150.3.254; 150.150.4.1-150.150.5.254;150.150.6.1-150.150.7.254 • [See following IP Subset Calculator screen capture]2 • d) Network: 150.150.252.0 • Range of IP addresses: 150.150.252.1-150.150.253.2542 • (e)In part • the 2^N-2 equation where N =10, 2^7-2=126. 126 subnets can be allowed.2 • (f) The subnet mask 255.255.254.0 has 9 bits set to 0. • Use the 2^N-2 equation where N =6, 2^9-2=512512 host addresses can be on each subnet.
(1) The first method is using the private IP for the local network. Since private IP can use in different local network repeatedly. So the hosts no need to assign the public IP. The second method is using more bits to represent the IP address. So the number of IP address will increase. (2) a) The subnet mask used to determine what subnet an IP address belongs to. b) The first three valid network numbers are 150.150.1.0, 150.150.2.0, 150.150.3.0 c) On 150.150.1.0, the range of host IP addresses is 150.150.1.1 - 150.150.1.254 On 150.150.2.0, the range of host IP addresses is 150.150.2.1 - 150.150.2.254 On 150.150.3.0, the range of host IP addresses is 150.150.3.1 - 150.150.3.254 d) The last valid network is 150.150.254.0 Its range of host IP addresses is 150.150.254.1 – 150.150.254.254 e) This solution allows 128 subnets. f) Addresses can be on each subnet are 510.
Subnet mask consist the number between 0~255,it allows you to identify which part of an IP address is reserved for the network, and which part is available for host use. Also it required setting in the TCP/IP control panel.
List the first three valid network numbers. [1/2] • Class A : Network 8 bits; (0=Reserved ;127=Loopback address) (e.g. US government , IBM) • Class B : Network 16 bits; Range=128-191 • Class C : Network 24 bits. Range=192-223
c. List the range of host IP addresses on those three networks. [2] • Class A: Host address is denoted by last 24 bits or last 3 octets. • Host IP configuration for class A can be shown as - • network.host.host.host
Class B: Host address is denoted by last 16 bits or last 2 octets. • Host IP configuration for class B can be shown as - • network.network.host.host
Class C : Host address address is denoted by last 8 bits or last octet. • Host IP configuration for class C can be shown as - • network.network.network.host
Quiz of 27 Feb 2008 • Repeat your answers of Quiz of 25 Feb through a multimedia presentation
Objective of Unit 3 • Describe the concept of the Internet architecture • Identify the different roles of IP, TCP and UDP in Internet communication • Describe the features of the IP • Discuss IP naming and address translation mechanisms • Demonstrate an understanding of IP routing • Compare connection-oriented and connectionless communication • Discuss TCP protocol mechanism • Discuss UDP protocol mechanism • Analyze the benefits & limitations of TCP and UDP
5 questions for communication between 2 s/w (eg. Client & server) on 2 different machines • How to identify a machine ?? • How to identity a s/w running in a machine ?? • How to transfer data from one machine to another ?? • How to ensure all data are correctly received by destination s/w ?? • What to do if there is network congestion due to : • Transmitting host sends out data too fast?? • receiving capability of destination machine is not enough (eg. Less processing power, memory, NIC speed, etc) ??
Basic concepts (1) • Encapsulation & de-capsulation • De-multiplexing • IP address • uniquely identify a interface/host/subnet/network in INTERNET (more discussion in later section) • TCP port & UDP port are different • Each application within a host is uniquely identified by a port number; 16 bit; • reserved well-known port : 1 ~ 1023 • Socket • one end of each communication connection • Uniquely identify which host, which application • IP address + port number + protocol type (tcp or udp)
Basic concepts (2) • Connection • identified by a pair of sockets on both ends of connection. (protocol type, source IP address, source port number, destination IP address, destination port number) • MTU (Maximum Transmission Unit) • Upper limit on size of data portion of network access layer, excluding header and trailer • Different Network access (link) layer technologies have different MTU.
5 questions for communication between 2 s/w (eg. client & server) on 2 different machines • How to identify a machine IP address • How to identity a s/w running in a machine (IP address + transport layer protocol type + port number ) • How to transfer data from one machine to another?? • How to ensure all data are correctly received by destination s/w ?? • What to do if there is network congestion due to : • Transmitting host sends out data too fast; • receiving capability of destination machine is not enough (eg. Less processing power, memory, NIC speed, etc) ??
~~~~~~~~ Internet Layer ~~~~~~~~~ • IP address • IP subnet & CIDR • IP routing • IP fragmentation & reassembly • ICMP & ARP
Functions of internet layer • Functions of internet layer : • Provide unique identification (i.e. logical IP address) to an interface of INTERNET node (eg. Host, router) or network/subnet • Classful • Classless (CIDR) • Packet forwarding (or routing) • Fragmentation • Reassembly
IP Address (1) • IP-v4 classful address : • 32 bit long, four 8-bit fields, separated by period • 2 formats : • Decimal : 192.123.44.23 (note each field between period is 0 ~ 255), more convenient • Binary : 11000000.01111011.00110100.00010111 • Composed of 2 portions – network portion, host portion • All hosts of same network must have same value on network portion • Based on first 4 bits (MSB) of IP address, it is classified into 5 classes : class A through E. Only Class A through C can be assigned to a machine/host.
Class attendance quiz • Illustrate with steps to identify/show the max value of the first decimal number of Class C address is 223. • Send email to: drphiliptsang@gamil.com • Subject: 212f Quiz> Your name + Your SN
IP Address (3) • Network mask is used to specify which part of an IP address is network-portion. • Consecutive bit of value “1” specify corresponding bit as network portion
IP Subnet (1) • What is sub-netting? • Divide a large network into a number of smaller subnets • Each subnet is also a network, a broadcast domain. Subnets are connected by router (not hub/LAN switch) • How to sub-net? • Network mask changes • extends continuous ones towards right to host portion. The extension part is called subnet portion. The network mask is now called subnet mask. • Each IP address now consists of 3 portions • Network, subnet, host portion • Why sub-netting : • Better utilization of IP addressing space • Reduces network congestion by reducing broadcast domain • Reduce number of hosts per subnet => better performance in Ethernet
IP Subnet (4) • Scenario 1 : • Class A network : 12.0.0.0 • default network mask = 255.0.0.0 • Number of networks = 1 • Number of hosts per network = 2 24 -2 • subnet mask=255.255.0.0 • Number of subnets = 256 –2 = 254 • Number of hosts per network = 2 16 –2 • Effect : one class A network increases from 1 to 254 subnets but the number of hosts per subnet decreases from (2 24 –2) to (2 16 –2)
IP Subnet (5) • Scenario 2 : • Class B network : 158.182.0.0 • default network mask = 255.255.0.0 • Number of network = 1 • Number of hosts per network = 2 16 -2 • subnet mask=255.255.240.0 • Number of network = 24 – 2 = 14 • Number of hosts per network = 2 12 – 2 = 4094 • Effect : one class B network increases from 1 to 14 subnets but the number of hosts per subnet decreases from (2 16 –2) to 4094
IP Subnet (5) Scenario 3 : Class C network : 192.182.0.0(?) default network mask = 255.255.255.0 Number of network = 1 Number of hosts per network = 2 8 -2 subnet mask=255.255.255.240 Number of network = 24 – 2 = 14 Number of hosts per network = 2 12 – 2 = 4094 Effect : one class B network increases from 1 to 14 subnets but the number of hosts per subnet decreases from (2 16 –2) to 4094
IP Subnet Quiz Scenario 3 : Class C network : default network mask = XXX Number of network = X Number of hosts per network = XXX subnet mask=XXXXXX Number of network = XXXX Number of hosts per network = XXX Effect : one class B network increases from M to n subnets but the number of hosts per subnet decreases from N Send answer to: drphiliptsang@gmail.com Subject 212F Subnet Quiz>Your Name +SN
IP Routing principle • Unreliable; hop-by-hop routing • Each hop (router) only provide IP address of next best hop (router) to destination network/subnet • Routing decision is made based on destination IP address of incoming packet to be routed and metrics for the path • Each router/host has a routing table, from which routing decision is made • Contents of routing table can be : • Dynamic, learned from routing protocols (eg. RIP, OSPF, IGRP, EIGRP) • Default route by hard-coded • Static by hard-coded • Directly connected network/subnet
IP Routing table • Each entry of routing table must contain at least following columns : • IP address of destination network/subnet • IP address of next hop (router) to destination • Note next hop is sometimes called gateway • metric for that route • Outgoing interface to next hop • Default gateway : • Definition : When there is no entry in routing table matching destination IP address, entry of default gateway will be used. Destination is represented by 0.0.0.0/0.0.0.0 • Host with single interface : simplify by using default gateway entry • One more usage of default gateway. What is it?
ARP (Address Resolution Protocol) • Function : Get MAC address of other TCP/IP host, on the same segment, from IP address of that host (i.e. IP address -> MAC address)
IP V6 • Previous discussion is for IPv4. • IPv6 is compatible with IPv4 with following enhancement: • IP address : 32 bits -> 128 bits => more IP available • Support QoS for timing critical application such as Voice over IP, video conference, etc. • Support security extension for authenticating source, providing integrity & encryption. • Header processing is speed up to increase performance • Addition of anycast address, which allows messages to be sent to any of several possible service providers or to any of a related group of remote destinations, with the idea that any one of them can manage the forwarding of the packet to others. • More : http://www.ipv6.org
IP - CIDR (1) • Classless InterDomain Routing (CIDR) • No more class boundary or subnet on IP address • Combine multiple continuous smaller subnets (eg. Class C) into a larger supernet or CIDR block • Representation of CIDR network : prefix + length Eg. 158.182.4.40 /12
ICMP • ICMP (Internet Control Message Protocol) : • Network control and error reporting • test node reachability across an internetwork with echo and reply messages (eg. Ping) • stimulate more efficient routing with redirect messages (eg. ICMP redirect) • “time exceeded” messages to inform sources that a datagram has exceeded its allocated time to exist within the internetwork (eg. Traceroute, tracert) • Router advertisement and router solicitation messages
Labs and discussion of Quizzes • Remember to submit your Quiz to drphiliptsang@gmail.com • So far only half of your have submitted it.
5 questions for communication between 2 s/w (eg. Client & server) on 2 different machines • How to identify a machine IP address • How to identity a s/w running in a machine IP address + transport layer protocol type + port number • How to transfer data from one machine to another routing table + IP layer • How to ensure all data are correctly received by destination s/w ?? • What to do if there is network congestion due to : • Transmitting host sends out data too fast; • receiving capability of destination machine is not enough (eg. Less processing power, memory, NIC speed, etc) ??
212 F Network Programming and Design TCP/IP of 5-10 March 08 Philip Tsang
~~~~~ Transport Layer ~~~~~ TCP : connection-oriented UDP : connectionless