2057-15. First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring



Similar documents
IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Ethernet. Ethernet. Network Devices

1 Data information is sent onto the network cable using which of the following? A Communication protocol B Data packet

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

Transport and Network Layer

Overview of TCP/IP. TCP/IP and Internet

Network-Oriented Software Development. Course: CSc4360/CSc6360 Instructor: Dr. Beyah Sessions: M-W, 3:00 4:40pm Lecture 2

IP - The Internet Protocol

Network Programming TDC 561

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

IP address format: Dotted decimal notation:

LESSON Networking Fundamentals. Understand TCP/IP

Technical Support Information Belkin internal use only

Objectives of Lecture. Network Architecture. Protocols. Contents

Guide to Network Defense and Countermeasures Third Edition. Chapter 2 TCP/IP

8.2 The Internet Protocol

TCP/IP and the Internet

Lecture Computer Networks

TCP/IP Basis. OSI Model

Transport Layer Protocols

Basic Networking Concepts. 1. Introduction 2. Protocols 3. Protocol Layers 4. Network Interconnection/Internet

Chapter 11. User Datagram Protocol (UDP)

Internet Protocols. Background CHAPTER

TCP/IP Networking Terms you ll need to understand: Techniques you ll need to master:

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Address Resolution Protocol (ARP), Reverse ARP, Internet Protocol (IP)

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

How do I get to

Networking Test 4 Study Guide

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Internet Protocol: IP packet headers. vendredi 18 octobre 13

Virtual Server and DDNS. Virtual Server and DDNS. For BIPAC 741/743GE

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Internetworking and IP Address

Computer Networks/DV2 Lab

Indian Institute of Technology Kharagpur. TCP/IP Part I. Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology

User Datagram Protocol - Wikipedia, the free encyclopedia

Chapter 3: Review of Important Networking Concepts. Magda El Zarki Dept. of CS UC Irvine

Application Protocols for TCP/IP Administration

RARP: Reverse Address Resolution Protocol

TCP/IP Protocol Suite. Marshal Miller Chris Chase

Network Security TCP/IP Refresher

Chapter 9. IP Secure

Algemene Theorie en Vaardigheden 2. April 2014 Theaterschool OTT-2 1

Internetworking. Problem: There is more than one network (heterogeneity & scale)

Transport Layer. Chapter 3.4. Think about

Mobile IP Network Layer Lesson 02 TCP/IP Suite and IP Protocol

Interconnection of Heterogeneous Networks. Internetworking. Service model. Addressing Address mapping Automatic host configuration

Connecting with Computer Science, 2e. Chapter 5 The Internet

Review: Lecture 1 - Internet History

Lecture 8. IP Fundamentals

Internet Control Protocols Reading: Chapter 3

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

CHAPTER 0 INTRODUCTION TO TCP/IP

Network layer: Overview. Network layer functions IP Routing and forwarding

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

A host-based firewall can be used in addition to a network-based firewall to provide multiple layers of protection.

Introduction to TCP/IP

Product Standard General Interworking: Internet Server

Connecting to and Setting Up a Network

TCP Performance Management for Dummies

Internet Architecture and Philosophy

Introduction to IP v6

PART OF THE PICTURE: The TCP/IP Communications Architecture

Basic Operation & Management of TCP/IP Networks

Internet Protocols. Addressing & Services. Updated:

Protocol Specification & Design. The Internet and its Protocols. Course Outline (trivia) Introduction to the Subject Teaching Methods

Ethernet and IP A slightly less introductory networking class. Drew Saunders Networking Systems Stanford University

Cape Girardeau Career Center CISCO Networking Academy Bill Link, Instructor. 2.,,,, and are key services that ISPs can provide to all customers.

Chapter 4 Network Layer

2. IP Networks, IP Hosts and IP Ports

The Internet. Chapter 10. Learning Objectives. Chapter Outline. After reading this chapter, you should be able to:

Datacommunication. Internet Infrastructure IPv4 & IPv6

Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme. Auxiliary Protocols

Computer Networks. Lecture 3: IP Protocol. Marcin Bieńkowski. Institute of Computer Science University of Wrocław

The Internet. Internet Technologies and Applications

Network Models and Protocols

Protocols. Packets. What's in an IP packet

Cisco Configuring Commonly Used IP ACLs

Networks: IP and TCP. Internet Protocol

EXPLORER. TFT Filter CONFIGURATION

Computer Networks/DV2 Lab

Understanding Layer 2, 3, and 4 Protocols

Lecture 15. IP address space managed by Internet Assigned Numbers Authority (IANA)

TCP/IP Fundamentals. Edmund Lam IT Audit Manager University of California 7/25/99 1

Linux MDS Firewall Supplement

8-bit Microcontroller. Application Note. AVR460: Embedded Web Server. Introduction. System Description

SUPPORT DE COURS. Dr. Omari Mohammed Maître de Conférences Classe A Université d Adrar Courriel : omarinmt@gmail.com

Packet Capture. Document Scope. SonicOS Enhanced Packet Capture

Slide 1 Introduction cnds@napier 1 Lecture 6 (Network Layer)

CCNA : Cisco Certified Network Associate Study Guide, 5th Edition ( ) Todd Lammle

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

Chapter 12 Supporting Network Address Translation (NAT)

The TCP/IP Protocol Suite

The OSI and TCP/IP Models. Lesson 2

Communications and Networking

The TCP/IP Reference Model

Efficient Addressing. Outline. Addressing Subnetting Supernetting CS 640 1

How To Design A Layered Network In A Computer Network

Savera Tanwir. Internet Protocol

Transcription:

2057-15 First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring 7-25 September 2009 TCP/IP Networking Abhaya S. Induruwa Department of Computing Canterbury Christ Church University North Holmes Road Canterbury CT1 1 QU U.K.

An Overview of TCP/IP Protocol Stack Department of Computing Canterbury Christ Church University United Kingdom 1

TCP/UDP IP Protocol Suite Developed in the late 60s early 70s Transmission Control Protocol TCP IEN5 RFC 761 RFC 793 Internet Protocol IP IEN2 RFC 760 RFC 791 User Datagram Protocol UDP RFC 768 2

TCP connection oriented reliable stream transport protocol 3

How does TCP achieve this? connection oriented uses RST, SYN, ACK, FIN flags to establish, maintain and tear down connections checksum for both header and application data sequence numbers to put the packets in the correct order acknowledgement numbers to let the sender know that a packet has been received retransmission if packets are not acknowledged. 4

UDP connection-less inherently unreliable fast message transport protocol 5

Why do we need UDP? inherently unreliable but fast no connection establishment no acknowledgements no retransmissions little transport protocol overhead (8 bytes only) messages are delivered on a best effort basis checksum is used to detect errors. If errors are detected, UDP can discard or deliver to the application with a warning 6

The role of IP Best effort delivery based on IP addresses Inter-domain and Intra-domain routing Header checksum to ensure correct header on delivery Routers can drop packets resulting packet loss IP does not do anything about it. 7

movie 8

Data Encapsulation 10

TCP Segment Header IP Header TCP Header Data from Application 0 3 7 15 31 Source Port Destination Port Sequence Number TCP HL Acknowledgement Number U R G A C K P S H Checksum R S T S Y N F I N Window Size Urgent Pointer Options Padding 11

UDP Packet Header IP Header UDP Header Data from Application 0 15 31 Source Port UDP Message Length Destination Port UDP Checksum 12

What is a Port? A port is a transport address at which processes can listen for connection requests 16 bit port address giving 65536 ports Well known ports Below 1024 (0 1023) Provide standard services Known port numbers? 13

Well Known Port Numbers Port numbers below 1024 Reserved for standard services FTP 21 File Transfer TCP SSH 22 Secure Shell Login TCP Telnet 23 Remote login TCP SMTP 25 Simple Mail Transfer TCP DNS 53 Domain Name Service TCP/UDP TFTP 69 Trivial FTP UDP Finger 79 user lookup TCP HTTP 80 World Wide Web TCP POP3 110 Post Office Protocol V3 TCP SNMP 161 Network Management UDP SNMP Traps 162 Network Management Traps UDP HTTPS 443 Secure HTTP TCP IMAP4 993 Message Access over TLS/SSL TCP http://www.iana.org www.iana.org/assignments/port-numbersnumbers 14

Registered Port Numbers Port numbers from 1024 to 49151 L2TP 1071 Layer 2 Tunnelling Protocol PPTP 1723 Point to Point Tunnelling Protocol Port numbers above 49151 are unassigned. These are for Dynamic/Private services. http://www.iana.org www.iana.org/assignments/port-numbersnumbers 15

IPv4 datagram IP Header Data (TCP segment or UDP packet) 0 3 7 15 31 Head Ver Ser type Packet Length Len Identification TTL D F Protocol ID Number Source Address Destination Address M Fragment Offset F Header Checksum Options Padding 16

IPv4 Header IP Header has a 20 byte fixed part A variable length optional part Padding is used to align with a byte boundary IP Header is transmitted in big endian order. ie. From left to right with the high order bit of the version field going first SUN Sparc is big endian architecture Intel Pentium is little endian architecture 17

IPv4 Header (contd...) Fragmentation is controlled by two bits DF Do not Fragment instructs the router not to fragment this packet MF More Fragments when set to one indicates that this packet is fragmented and this fragment is not the last one Fragmentation Offset 13 bit field to specify in bytes the offset of the data field of this packet from the starting point of the source packet. Identification 2 byte filed used to identify the packets created as a result of fragmentation. All fragments of the same packet must have the same value in this field. 18

IPv4 Header (contd...) Protocol Identification Number Specify the higher layer protocol for which the payload is intended (using Assigned Internet Protocol Numbers). 1 ICMP 6 TCP 8 EGP 17 UDP 41 IPv6 89 OSPFIGP 115 L2TP 255 Reserved http://www.iana.org/assignments/protocol-numbers Header Checksum 2 bytes; calculated for header only Since some header fields get changed in the course of packet transmission across the network, the header checksum is recomputed at each router node. 19

IPv4 Addresses 32 bit source address 32 bit destination address Completely different from any hardware address (eg. 48 bit Ethernet Address) Every node (host or router) on an internetwork should have at least one unique IP address Hosts connected to more than one network will have a different IP address to every connection (multi homed networks) 20

IPv4 Address Classes 5 different classes known as Classful Class A Class B Class C Class D Class E 0 7 15 23 31 0 Net ID Host ID 1 0 Net ID Host ID 1 1 0 Net ID Host ID 1 1 1 0 Multicast address 1 1 1 1 0 Reserved for future use Network Portion of the Address Host Portion of the Address 21

IPv4 Addressing Network ID No of networks No of Hosts Class A 1-127127 126 16, 777,214 Class B 128-191 191 16,384 65,534 Class C 192-223 223 2,097,151 254 22

IPv4 Address Ranges Address Range Class A 1.0.0.0-127.255.255.255 Class B 128.0.0.0-191.255.255.255 Class C 192.0.0.0-223.255.255.255 23

IPv4 Addresses A total of 4 Giga addresses Usually written in dotted decimal notation IP address space is managed by ICANN (Internet Corporation for Assigned Names and Numbers) Every Internet Host and Router has a unique IP address which encodes its network number and host number 24

Special IPv4 Addresses 0.0.0.0 This host on this network used during boot up 255.255.255.255 Direct Broadcast on LAN 127.x.y.z Local loopback address eg. 127.0.0.0 Data sent to this address will not be transmitted into the network Packets received with this address are returned to the upper layer protocol of the same computer Useful for testing programme 25

Network Layer Supporting Protocols IP is the main network layer protocol used for data transfer. Several control protocols exist to assist IP ICMP RFC 792 ARP RFC 826 (IP to hardware address) RARP RFC 903 (H/W to IP address) BOOTP RFCs 951, 1048 and 1084 DHCP RFCs 2131 and 2132 26

Network Sockets Socket is an end point of a communication channel identified by a socket address in IPv4 socket addresses are 48 bits not to be confused with 48 bit Ethernet addresses obtained by combining IP address (32 bits) with port address (16 bits) TCP sockets and UDP sockets 27

TCP/IP Client Server Example A user enters a URL on a browser to access a web server. How many different protocols are used? HTTP DNS TCP UDP IP Physical layer, eg. Ethernet 28

user HTTP Client-Server Application 1 HTTP client TCP 7 6 http://www.anyserver.anywhere.com/anydocument.html www.anyserver.anywhere.com 192.5.8.31 2 Application Layer 5 IP DNS client UDP DLL and Physical Layer Protocols Transport Layer IP Layer Host to Network Layer HTTP server 192.5.8.31:80 3 4 DNS Server 29

DHCP Protocol Dynamic Host Configuration Protocol RFC 1541 superseded by RFC 2131 on booting the device broadcasts its MAC address the DHCP server listens to these broadcasts and replies with an IP address IP address can be allocated from a pool hence dynamic IP address can also be fixed kept in a table 30

DHCP Protocol DHCP Server MAC IP Client-1 172.16.16.11 Client -2 172.16.16.12 Client -3 172.16.16..13 Client - 1 Client - 2 Client - 3 Client - n Clients get the IP address corresponding to their MAC address from the table. 31

TFTP Protocol Trivial File Transfer Protocol RFC 1350 uses UDP over port 69 no security Typically used by disk-less workstations used by embedded systems, such as Geode and ARM boards On booting the device sends a DHCP request for the IP address Once it gets its IP address, it sends a RRQ using TFTP to read the file 32

NFS Protocol Originally developed by Sun Microsystems in 1984 allows a client to share files and directory over a network in a manner similar to how local storage is accessed used UDP NFSv2 released as Open Source in 1989 RFC 1094 Now NSFv4 (2003), version developed by the IETF TCP based Next revision is 612 pages! 33

NFS Protocol NFS Server /dev/sda5 mounted under /nfsshare Client - 1 Client - 2 Client - 3 Client - n NSF clients can mount /nfsshare and use as if they are accessing local hard disk 34

Network Programming Network programming can be done in many popular languages C, C++, Java, C#, VB.NET all have APIs to programme network functions PHP is an alternative 35

Hello World in PHP <!-- This example shows how PHP code is embedded in HTML code. The browser will display the header from the HTML part of the code. Then it will display the output by executing PHP code. --> <html><body><h1>hello World Example</h1></body></html> <html> <body> <?php // echo will display the string argument echo "Hello World";?> </body> </html> 36

<!-- Network Programming in PHP This example shows how PHP programming can be used to deal with IP addresses and host names. --> <html><body><h1>ip Address Example</h1></body></html> <?php // get host by address $hostaddress = gethostbyaddr('127.0.0.1'); print $hostaddress; print "<p>the host name is: $hostaddress". "</p>\n"; // get host by name $hostip = gethostbyname("www.ictp.it"); print "The host address is: $hostip". "<p/>\n"; // and re-check echo gethostbyaddr("$hostip"); echo "<br/>"; // convert dotted decimal IPv4 address to IP proper address $longip = ip2long($hostip); print ("The long address is: $longip". "<p/>\n"); // convert to packed notation $packedip = inet_pton($hostip); printf ('%$s %$b', "The packed address is: " $packedip); echo inet_ntop($packedip); echo long2ip(-1939271547);?> 37

Network Programming in PHP Some of the available PHP commands: checkdnsrr Check DNS records corresponding to a given Internet host name or IP address dns_check_record Alias of checkdnsrr dns_get_mx Alias of getmxrr dns_get_record Fetch DNS Resource Records associated with a hostname gethostbyaddr Get the Internet host name corresponding to a given IP address gethostbyname Get the IPv4 address corresponding to a given Internet host name gethostbynamel Get a list of IPv4 addresses corresponding to a given Internet host name gethostname Get the host name getprotobyname Get protocol number associated with protocol name getprotobynumber Get protocol name associated with protocol number 38

Network Programming in PHP References: http://it2.php.net/manual/en/book.network.php http://it2.php.net/manual/en/ref.sockets.php http://www.devshed.com/c/a/php/an-introduction-to-sockets-in-php/ 39