20
CCN: Lecture Notes—Module 4 Computer Comm. & Networking 1 TCP/IP and the Internet Computer networking today is becoming more and more entwined with the internet. By far the most popular protocol set in use is TCP/IP (Transmission Control Protocol/Internet Protocol). It is worth looking at this in more detail. As TCP/IP existed prior to the OSI, it doesn’t fit exactly into the defined layers. It does however have a layered structure and fits pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking 2 Why do we need all this stuff? Consider sending a message (say email) from your computer to another computer on the other side of the world. All you know is the address of the destination. Firstly, you use a mailer program which allows you to type a mail message and specify the address. How do we know the user at the other end has the same mailer program? We don’t and it doesn’t matter. The TCP part of the suite has a mailer that can send and received mail in a standard format that every internet user can read. Your mailer program is just an editor that supplies the message to this mailer. When TCP has formatted the mail message, we must make this message into a packet that can be sent across the internet and find its way to the destination. The IP part does this by adding a header with the IP address. This is the unique address that every internet user is addressed by. Routers can route your message with this address.

TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

  • Upload
    dodung

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 1

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 1

TCP/IP and the InternetComputer networking today is becoming more and more entwined with the internet. By far the most popular protocol setin use is TCP/IP (Transmission Control Protocol/Internet Protocol). It is worth looking at this in more detail.

As TCP/IP existed prior to the OSI, it doesn’t fit exactly into the defined layers. It does however have a layered structure and fits pretty much into layer 3 and 4.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 2

Why do we need all this stuff?Consider sending a message (say email) from your computer to another computer on the other side of the world. All you know isthe address of the destination.

• Firstly, you use a mailer program which allows you to type a mail message and specify the address. How do we know the user at the other end has the same mailer program? We don’t and it doesn’t matter. The TCP part of the suite has a mailer that can send and received mail in a standard format that every internet user can read. Your mailer program is just an editor that supplies the message to this mailer.

• When TCP has formatted the mail message, we must make this message into a packet that can be sent across the internet and find its way to the destination. The IP part does this by adding a header with the IP address. This is the unique address that every internet user is addressed by. Routers can route your message with this address.

Page 2: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 2

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 3

Why do we need all this stuff? (Cont’d)• This IP packet now has to be sent over the media at your

site. To do this we need a link layer to look after the transmission, ie. correct the error etc. This is performed by your local LLC. It is dependant on the type of network at your end.

• The next step depends on what type of media you have at your end, ie. Ethernet, Token Ring etc. The MAC will take care of this and will attach a header, preamble etc to your packet that will allow it to be sent on the local LAN.

• This packet is now sent over your LAN.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 4

Why do we need all this stuff? (Cont’d)• Somewhere on your LAN exists a router. This device will received

your network packet and disassemble it up to IP level, so it mayread the IP address. It will then pack it up again into a form suitable for the next transmission step. This may be simply another hop on a LAN or it may travel on a WAN or public network. In either case, it will be packeted into a form suitable for transmission.

• Eventually, the packet arrives at the LAN of the destination computer. The router accepts the packet and broadcasts it onto the LAN with the network address of the destination. The destinationcomputer will receive the packet and proceed to unwrap it. Firstly the MAC strips off the network headers, CRC’s etc. The LLC checks it over.

• The IP now unpacks the IP packet and passes the TCP packet to the TCP. After unpacking, the TCP recognizes it is an email. It treats the packet as email and passes it to the appropriate application. In this case your email program.

Page 3: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 3

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 5

TCP/IP (Cont’d)Each layer encapsulates the output from the layer above.

We have already examined what a network packet contains. Let use look at the rest of the TCP/IP suite.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 6

TCP/IP application level protocols

Everything feeds into the IP part of the suite. ICMP and OSPF are to deal with network operation. The TCP handles the actual data transmission and is a connection oriented protocol. UDP is a connectionless unreliable service. Its main use is in network management.

The TCP helpers sit above TCP and provide services that we are familiar with. Remember these are usually accessed by higher layers up toapplication.

Page 4: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 4

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 7

Telnet• A TCP helper that enables remote login

• Port address: 23 (also known as well-known port number) identify the specific process of application a user accesses on a host. It is contained in TCP header.

• Communication is via codes defined by Network Virtual Terminal (NVT)

• Command characters are defined by setting the MSB

• All commands are preceded by FF (IAC)

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 8

TelnetA request for 8 bit binary would be

IAC, SB, WILL, ‘0’, SE

An affirmative response would be

IAC, SB, DO, ‘0’, SE

A refuse response would be

IAC, SB, DON’T, ‘0’, SE

(NVT)

Name Code Meaning

Transmit binary 0 request/accept change to 8-bit binary

NVT option codes:

Page 5: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 5

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 9

FTP• File transfer protocol

• Port address: well-known port 21

• A helper to perform file transfers

• NVT is used to negotiate the transfer

• The operation depends on the file structure

• Unstructured, structured and random access files are supported

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 10

FTP – unstructured fileAn unstructured file can contain any type of data – binary or text. It is transferred between the two FTP protocol entities as a transparent bit stream.

Page 6: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 6

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 11

FTP• File transfer protocol

• A helper to perform file transfers

• NVT is used to negotiate the transfer

• The operation depends on the file structure

• Unstructured, structured and random access files are supported

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 12

FTP – structured filestructured files consist of a sequence of fixed-sized records of a defined type. Hence the content of such files are normally transferred as a string or fixed sized blocks.

The contents may be transferred in compressed form. E.g., the space characters in a text file can be compressed before transmission.

Page 7: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 7

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 13

FTP• File transfer protocol

• A helper to perform file transfers

• NVT is used to negotiate the transfer

• The operation depends on the file structure

• Unstructured, structured and random access files are supported

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 14

FTP – random access fileRandom access files consist of records of variable-size. Normally, such records are pages in a paged file. Each record/page has a header indicating length, type field and position of the page in the file content.

Page 8: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 8

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 15

SMTP• Simple mail transfer protocol (SMTP) transfer mail from one host

computer mail system to another. It is not responsible for accepting/distributing mails from/to local users--Local mail system’s job.

• The native email protocol

• Mail is send via local mail system to SMTP server/client. The client is initiating the transfer of mail to another system while the sever is receiving mail.

• ASCII headers are used

• SMTP send NVT like commands over the TCP connection

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 16

SMTPWhen a mail is ready to sent, the local mail system determines from name (recipient) if deposited into local mailbox or send out.

To send, the client SMTP gets the IP address from domain name system and uses the port address of SMTP (25) to set up a connection with the sever SMTP in the destination host

Page 9: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 9

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 17

HTTPHypertext transfer protocol. Port address: well-know port 80

Used for access to WWW

HTTP is a request-response protocol.

1. An HTTP client program establishes a TCP connection to an HTTP server program and requests a specific service from the server.

2. The server accept the connection and responds to the client’s request.

3. Request messages are via a user agent, i.e., a web browser, editor, search engine, etc.

Request

Get: to request data from the sever

Head: to ask only for headers

Post: to send information to server

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 18

HTTPMost HTTP requests apply to a resource residing on an origin server. When used in the content of WWW, the resource can be accessed via the Internet

WWW sites are addressed by a Uniform Resource Locator (URL)

METHOD://HOST/PATH

METHOD: The protocol used to retrieve the data. FTP, HTTP, TELNET, gopher

HOST: Computer address usually is stored as an alias often starting with www.

PATH: Path through directories of host machine separated by slashes.

http://maxwell.me.gu.edu.au/yg/teaching/CCN/CCN_Mod4.pdf

Page 10: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 10

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 19

HTTP—Web page

Web pages are static, dynamic or active

Static page is set by the creator and cannot be altered by the user. Hypertext Markup Language (HTML) is normally used to create the page layout.

HTML uses tags to convey the markup of all text, graphics and links.

Eg.

<B>Hello there</B> will print bold text

Hello there Multimedia search with google

Web browser architecture

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 20

HTTP—Web page (multimedia) search

Web browser architecture

Page 11: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 11

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 21

HTTP—Dynamic and active pagesDynamic pages

The document served will vary depending on the request given

They are usually created using a Common Gateway Interface (CGI) script. This script is run at the server site so the browser needs no knowledge of its syntax.

Active pages

Often we need to execute a program at the client site. This might be to display animated graphics, calculators etc.

Java is often used as a language to do this. The code binary is downloaded to the client where it is executed.

Java consists of a programming language, runtime environment and class library. It is object oriented and C++ like.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 22

Transmission Control Protocol (TCP)Examination of the packet header will give an insight to the operation of the TCP segment.

Source port: This gives a service access point at the source end, ie. which application sent the segment.

Destination port: Similarly which application at the far end should get the segment.

Page 12: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 12

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 23

TCP—header

Sequence number: Sequence number of the first data octet in this segment. When a SYN flag is set, this is the initial sequence number (ISN). TCP is stream oriented, ie. a sequence number applies to the first octet of data in the segment. If a segment had 500 octets and its sequence number was 2000 thenthe next segment would have sequence number 2500.

Acknowledgement number: Contains the sequence number of the next segment to be received.

Data offset: Number of 32 bit words in the header.

Reserved: Reserved for future use.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 24

TCP—header

Flag: (if set to 1, it means)URG Urgent pointer field significantACK Acknowledge field significantPSH Push functionRST Reset the connectionSYN Synchronise the sequence numbersFIN No more data

Window: Flow control. Contains the number of data octets that sender is willingto accept.

Checksum: The one’s complement of the sum modulo 216-1 of all the 16 bit words in the segment plus a pseudo header. Reference WWW http://WilliamStallings.com/DCC/DCC7e.html

Page 13: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 13

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 25

TCP—header

Urgent pointer: point to the octet after any urgent data. So the amount of urgent data can be measured.

Options: Maximum segment size.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 26

Internet Protocol (IP)

Version: Allows use of newer versions of the IP

Internet Header Length (IHL): Length in 32 bit words of header. Minimum is 5 for minimum length of 20 octets.

Service type: Defines reliability, precedence, delay and throughput parameters.

Page 14: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 14

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 27

Internet Protocol (IP) (Cont’d)

Total length: Length of entire datagram in octets.

Identification: A sequence number combined with the source and destination addresses and protocol which makes this datagram totally unique. Determine next header in the packet after IP header

Flags: Only 2 defined. More bit --- used for fragmentation. Don’t fragment bit --- prevents fragmentation.

Fragment offset: Describes where this fragment belongs in the original datagram. Measured in 64 bit units.

Data: in octets, not greater than 65,535 octets

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 28

Internet Protocol (IP) (Cont’d)

Time to live: Specify how long, in seconds, a datagram is allowed to remain in the Internet. How many router hops this datagram will live for.

Protocol: Shows what higher level protocol is to receive this datgram at he receiving end. Determine next header in the packet after IP header

Header checksum: The 16 bit ones complement addition of all 16 bit words in the header. It is recalculated at each router as some header fields (such as time to live) may change.

Source address: Internet address or IP address of sender.

Page 15: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 15

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 29

Internet Protocol (IP) (Cont’d)

Destination address: IP address of destination.

Options+padding: Contains user options plus padding to ensure header is a multiple of 32 bits.

Data: no more than 65,535, octets.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 30

Network addressesIf networks are to be connected together then unique addresses of all nodes must be employed. The Internet Protocol addresses perform this function.

• Each address is a 32 bit number (IPv4 address)

• The break-up of this number is dependent on the class of LAN.

Page 16: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 16

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 31

Network addresses

A Class A address begins with a decimal number ranging from 0 to 127.

A Class B address begins with a decimal number ranging from 128 to 191.

A Class C address begins with a decimal number ranging from 192 to 223.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 32

Network addresses

• These difference classes of LAN’s allow more efficient use of the addresses.

• A large LAN would be assigned to class A giving it up to 224 possible node address. (There are a maxmum of 27=128 Class A networks)

• A small LAN would be assigned to class C allowing netID’s for many of these types of LAN.

• Addresses are often expressed in dotted decimal notation. E.g., address of an MEE machine 10000100 11101010 00000111 00101011

as 132.234.7.43 (this machine is within a class B site)

Page 17: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 17

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 33

Network addressesOften subnet masks are employed to speed communication within a large LAN.

• The hostID part is now broken into a subnetID part and a host ID part.

• A subnet mask is used to distinguish the 2 parts.

• Each node masks incoming addresses with the mask to identify thehostIDpart of the address.

E.g., A class B site could break itself up into 256 subnets each with 256 nodes by using a subnet mask of 255.255.255.0

• This allows better performance within each smaller separate subnet whilst retaining only one netID for the site.

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 34

Non-internet addressingIn addition there are some addresses which have been assigned for nodes that live on a network that is not directly connected to the Internet. You may use these addresses freely as long as theyare not transmitted onto the Internet.

Page 18: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 18

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 35

IPv6The current version of IP is version 4 (IPv4). There are some limitations becoming apparent with this version. An upgrade (IPv6) is presently being slowly implemented.

The biggest and most needed change is the size of the IP address field is now much bigger. This can allow many more nodes to have unique addresses on the Internet. IPv4 has a 32 bit address giving 232 possible addresses.

IPv6 has a 128 bit address giving 2128 possible addresses. That is 340,282,366,920,938,463,463,374,607,431,768,211,456 unique addresses.

This is 1564 addresses for every square metre of the earth!!

The written notation is slight different

6489:0000:0000:0000:73B2:998E:65F7:5708

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 36

IPv6There are many other improvements in IPv6. It will be slowly implemented in areas where translation can take place. This is clearly a very difficult task to roll it out.

Page 19: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 19

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 37

Domain names and DNSPeople don’t work well with numbers, so IP addresses may also be specified by name.

When names like this are used, a Domain Name Server (DNS), whichwill be resident for each LAN, will supply the IP address when given the name.

Domain names are broken up logically to try to simplify addressing

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 38

Domain names and DNSIP addresses are administered internationally by the Network Information Centre (InterNIC). The subnet addressing is then administered locally.

The IP address is used to locate a node on the larger network and is encapsulated into an IP packet. Routers unpack the address to route the packet. At the last router however the packet is passed onto the LAN. Here a physical address is used. This is the address of the LAN physical layer hardware in each node. (Commonly called the ethernetaddress)

Every card produced has a unique 48 bit address

The router builds a table that relates IP addresses to physical addresses for nodes connected in its LAN.

Page 20: TCP/IP and the Internet - Griffith University ·  · 2004-10-13TCP/IP and the Internet ... pretty much into layer 3 and 4. CCN: Lecture Notes—Module 4 Computer Comm. & Networking

CNN: Lecture Notes--Module 3 20

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 39

Domain names and DNS

CCN: Lecture Notes—Module 4 Computer Comm. & Networking 40

DNS sever• DNS servers provide name resolution service. • Each subdomain has at least one name server that is

authoritative for that domain. • It maintains complete and accurate information about all the

hosts within its subdomain. • Name servers also have the address of other servers they

can contact in the event they cannot resolve a name locally.• They also have the address of at least one root server, which

provides interdomain name resolution capability.