42
DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY TCP/IP and IP addressing

DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY TCP/IP and IP addressing

Embed Size (px)

Citation preview

DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY

TCP/IP and IP addressing

Internet and TCP/IP

• Internet is a global network of interconnected computers, enabling users to share information along multiple channels.

• Majority of widely accessible information on the internet consists of inter-linked hypertext documents and other resources of the World Wide Web (WWW).

• The Internet Protocol Suite (commonly known as TCP/IP) is the set of communications protocols used for the Internet and other similar networks. It is named from two of the most important protocols in it: the Transmission Control Protocol (TCP) and the Internet Protocol (IP), which were the first two networking protocols defined in this standard.

• TCP/IP is an open standard under direction of Internet Architecture Board (IAB) and Internet Engineering Task Force (IETF).

TCP/IP model

Application

Transport

Internet

Network Interface

Application

Presentation

Session

Transport

Network

Data Link

Physical

TCP/IP protocol suite

TCP/IP Network Access Layer

• Defines how computers and network devices should access a physical medium to send bits to another computer.

• Network Access layer has two ISO OSI layers, layer 1 and 2 (Physical and Data Link)

• IETF does not define any standard in this layer because other organizations define many standards. For instance, Ethernet is developed by IEEE.

• PDU (Protocol Data Unit) is bit in layer 1 (Physical) and frame in layer 2 (Data Link).

TCP/IP Internet Layer

• Defines how to deliver data from one host to another on various physical networks:

1. Logical addressing2. Routing and routing protocol3. Main protocols: IP, ARP, RARP (Reverse Address

Resolution Protocol), ICMP (Internet Control Message Protocol) and router protocols such as RIP (Routing Information Protocol) and OSPF (Open Shortest Path First).

4. PDU (Protocol Data Unit) is packet in layer 3

ICMP (Internet Control Message Protocol)

ICMP can report error for diagnostic or routing control purpose. Two key commands are used to test connectivity:

• PING (ICMP echo request and reply command)

• Tracert is Microsoft version command while Cisco uses traceroute to display routing path while testing connectivity.

TCP/IP Host-to-Host (Transport) Layer

• Two main protocols: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol)

• TCP provides reliable data delivery service with end-to-end error detection and correction.

• UDP provides low-overhead, connection less datagram delivery services.

• Application programmers can choose which protocol to use.

• PDU (Protocol Data Unit) is segment in layer 4 (Transport)

TCP and UDPThe two important transport layer protocols:They help to transfer data from one application

process on one computer to the correct application process on another computer.

• TCP (Transmission Control Protocol)Connection-oriented protocol, more reliable and

slower.• UDP (User Datagram Protocol)Connection-less, faster, simpler and not reliable

(no error checking).

TCP and UDP comparison

Features TCP UDP

Flow control and windowing Yes No

Connection-oriented Yes No

Error recovery Yes No

Segmentation and reassembly of data Yes No

In-order delivery of data Yes No

Identifying application using port numbers

Yes Yes

TCP/IP Application Layer

Offer interface to deal with various applications:

• File transfer: FTP, FTP, NFS

• Email: SMTP, POP3, IMAP

• Remote login: Telnet

• Network Management: SNMP, DNS

• Web browsing: HTTP, HTTPS

Some protocols (1)• FTP (File Transfer Protocol)• TFTP (Trivial File Transfer Protocol)• NFS (Network File System)• SMTP (Simple Mail Transfer Protocol)• LPD (Line Printer Daemon)• SNMP (Simple Network Management Protocol)• DNS (Domain Name Service)• DHCP (Dynamic Host Control Protocol)• TCP (Transmission Control Protocol)• UDP (User Datagram Protocol)• IP (Internet Protocol)

Some protocols (2)

• ARP (Address Resolution Protocol)

• RARP (Reverse Address Resolution Protocol)

• POP3 (Post Office Protocol V3)

• IMAP (Internet Message Access Protocol)

• RIP (Routing Information Protocol)

• OSPF (Open Shortest Path First)

IPV4 address

1. IP address must be unique in the network (Public IP address must be unique in internet and private IP address must be unique in the internal network)

2. The format is xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx (totally 32-bit).There are public IP address used in Internet and private IP address used in company/organization internal networks.

3. As 8 bits binary can present 0-255 in decimal, IP address could be (and usually is) presented as 10.1.11.12 (You must not see such IP address 260.270.280.290)

4. Network mask is to divide the IP address into two logical sections (network ID and host ID)

Network Mask

• IP address has both Network ID (network address) and Host ID (host address). If the value is 1 in the mask, it means the corresponding bit in the IP address is the network ID. If the value is 0, it means the corresponding bit is for the host ID. For instance, network musk is 255.0.0.0 which equals to binary value 11111111.00000000.00000000.00000000. The “1” section presents the network ID. So, 10.10.10.10 would have the first octet 10 as network ID. If the network mask is 255.255.255.0, the network ID of 192.168.10.10 would be 192.168.10.0 because 255.255.255 is 11111111.11111111.11111111 in the mask.

Valid network mask

Binary value Decimal value

00000000 0

10000000 128

11000000 192

11100000 224

11110000 240

11111000 248

11111100 252

11111110 254

11111111 255

IP address classTraditionally, the IP address was classified in classes:Class A: network 1 – 126 with subnet mask 255.0.0.0

(Initial bit starts as 0)Class B: network 128 – 191 with subnet mask

255.255.0.0 (Initial bit starts as 10)Class C: network 192 – 223 with subnet mask

255.255.255.0 (Initial bit starts as 110)Class D: network 224 – 239 (Initial bit starts as 1110)

for multicast IP addressClass E: network 240 – 255 (Initial bit starts as 1111)

experimental useThe special network 0 and127 are not included in

those official classical IP address. 127.0.0.1 is the loopback address which is used to test TCP/IP stacks.

Some basic rules

• In same network, no routing or router is required.

• In same network, IP address must be unique to identify the computer or network host. In the internet, public IP address must be globally unique (we will introduce private IP address soon).

• Router or routing is required between different networks.

Power calculation of 2The powers of 2 Decimal value Binary Value

2^0 1 00000001

2^1 2 00000010

2^2 4 00000100

2^3 8 00001000

2^4 16 00010000

2^5 32 00100000

2^6 64 01000000

2^7 128 10000000

2^8 256 100000000

2^9 512 1000000000

2^10 1024 10000000000

2^11 2048 100000000000

2^12 4096 1000000000000

2^13 8192 10000000000000

Network address and Broadcast address

• Network address is also called network ID. It is the part defined by subnet mask. For instance, network musk is 255.0.0.0 which equals to binary value 11111111.00000000.00000000.00000000. The “1” section presents the network ID. So, 10.10.10.10 would have the first octet 10 as network ID. Network ID is to have all 0 in the host ID section.

• If the broadcast address is the destination address of a packet, it would be sent to all hosts in the same network. Broadcast address is to have all 1 in the host ID section. For instance, broadcast address of 10.10.10.10/8 is 10.255.255.255

Unicasts, Multicasts, and Broadcasts Unicasts:– Packet travels from one host to another specific host. Multicasts:– Packet travels from one host to a select number of other hosts.– Supports voice and audio broadcasts, news feeds, distribution ofsoftware, re-imaging clients off peak times. Broadcasts:– Packet travels from one host to all hosts on the local network.

All of the bits in the host portion of the broadcast IP address ends with binary 1s.– For network 176.10.0.0•10110000.0001010.00000000.00000000– The broadcast address is 176.10.255.255 So in binary-----10110000.0001010.11111111.11111111

Broadcast Address

Valid host number• If the host id bits are all 0 in IP address, it presents the network address; If

the host id bits are all 1 in IP address, it presents the broadcast address of the network. Valid host cannot have those 2 special (reserved) IP address.

• Valid host number is: 2^(number-of-host-bits) – 2• Computer operating systems usually would not treat 192.168.4.0 as a valid

host IP address. For the same reason, it cannot use 192.168.4.255 as the computer IP address.

Class Size of host id (bytes)

Size of host id (bits)

Number of hosts per network

A 3 24 2^24 – 2 = 16,777,214

B 2 16 2^16 – 2 = 65,534

C 1 8 2^8 – 2 =254

Network number calculation

Class Size of network id (bytes)

Size of network id (bits)

Number of fixed bits at beginning

Number of network bits that vary

Number of networks

A 1 8 1 7 2^7 – 2 = 126

B 2 16 2 14 2^14 – 2 = 16,192

C 3 24 3 21 2^21 – 2 = 2,097,152

The tricky part is that there are fixed bits in network ID of all classes. Class A has 0 in first bit all the time (0-126). Class B always has 10 in the first two bits. Class C has 110 as fixed bits.

Subnet

Subnet is to logically divide your network into many sub networks.

• In the same subnet, traffic is “local” and not gateway (router) is required. Network hosts would use ARP table for the MAC address of the destination machine and send the packet to it accordingly. If it is not local, packets would be forwarded to default gateway for future routing (redirecting).

• In addition, the broadcast would be limited to the small subnets leading to less “noise” in the network traffic.

• You can also use subnet to logically specify hosts for different departments. (for security control, connection, asset management, etc, etc)

Define subnet number• Subnet bits (“1”) can tell how many subnet could be produced by the

mask. The formula is 2^(number of subnet “1” bits) - 2Original classfull network mask:• Class A network has the form N.H.H.H, the default subnet mask is 8 bits

long.• Class B network has the form N.N.H.H, the default subnet mask is 16

bits long.• Class C network has the form N.N.N.H, the default subnet mask is 24

bits long.

The additional subnet bits can generate subnet. For instance, You have an IP of 156.233.0.0 with a subnet mask of 7 bits. How many hosts and subnets are possible?There is additional 7 bits to the default subnet mask. The total number of bits in subnet are 16+7 = 23. This leaves us with 32-23 =9 bits for assigning to hosts. 7 bits of subnet mask corresponds to (2^7-2)=128-2 = 126 subnets. 9 bits belonging to host addresses correspond to (2^9-2)=512-2 = 510 hosts.

Define host number in each subnet• Subnet bits (“0”) can tell how many host could be contained in each

subnet. The formula is 2^(number of host “0” bits) - 2Original classfull network mask:• Class A network has the form N.H.H.H, the default host mask is 24 bits

long.• Class B network has the form N.N.H.H, the default host mask is 16 bits

long.• Class C network has the form N.N.N.H, the default host mask is 8 bits

long.

The additional subnet bits can generate subnet. For instance, You have an IP of 156.233.0.0 with a subnet mask of 7 bits. How many hosts and subnets are possible?There is additional 7 bits to the default subnet mask. The total number of bits in subnet are 16+7 = 23. This leaves us with 32-23 =9 bits for assigning to hosts. 7 bits of subnet mask corresponds to (2^7-2)=128-2 = 126 subnets. 9 bits belonging to host addresses correspond to (2^9-2)=512-2 = 510 hosts.

Routing

• If all traffics are in the same LAN (subnet), no routing is required. The computers talk to each other over network cable directly.

• In different LAN (subnet), the packet sent from sender must be “redirected” (routed) to another network in which the recipient is located.

Cisco 2610 interfaces (optional)

Public IP address

IANA (Internet Assigned Numbers Authority www.iana.org) has the ultimate authority. It authorizes member organizations to assign registered unique IP address to users. For instance, ARIN (American Registry for Internet Numbers) is in charge of assigning IP address in US.

In general, each computer needs a public IP address to identify itself and access Internet.

Private IP address

Thus, it is possible for many companies / organizations using same network address internally. (For instance, 10.10.10.10 could be used for computer Tom in company Apple and by computer Jerry in company Boss) But, again, the potential duplicated addresses are used internally.

Certain blocks are reserves as private IP address used in company / organization internal networks. More computers could have “unique” IP address in IPV4.

Class Range of IP address

Range of Network number

Default network mask

Total number of networks

A 10.0.0.0 – 10.255.255.255

10.0.0.0 – 10.0.0.0

/8 (255.0.0.0) 1

B 172.16.0.0 – 172.31.255.255

172.16.0.0 – 172.31.255.255

/12 (255.240.0.0)

16

C 192.168.0.0 – 192.168.255.255

192.168.0.0 – 192.168.255.255

/16 (255.255.0.0)

256

NAT (Network Address Translation)

• Allow 65,535 user connections with the same public (registered) IP address.

• Enable multiple users (computers) sharing single internet connection.

• The computers may have internal private IP address. But, they can have public identifier via the public IP address.

• The solution is to use NAT map to associate user connection from internal private IP address and public IP address. The NAT map is beyond this course. But, port number is used to have the many-to-many mapping.

NAT Illustration (optional)

IPV6

• 128 bits address format

• 6 octets

• Usually presented in hex

• May support 10^30 IP addresses (IPV4 only supports 4,294,467,295 IP addresses)

• Still not in final implementation

• NOT interoperable with IPV4

IP address assignment

IP address could be assigned by:• StaticUser manually assign the IP address, mask,

default gateway and DNS.• Dynamic (automatically) by DHCP (Dynamic

Host Control Protocol) serverNo need to do any configuration. Enable DHCP

client and the computer (client) would get IP address and other info from DHCP server. (Network Administrator does need to do configuration on server side.)

Compare static and DHCP

DHCP Static

Good for large network Yes No

Client side configuration No Yes

Server side configuration Yes No

Move whole network address to another number blocks (change 172.20.1.0 to 192.168.5.0)

Yes No

Can reuse the IP address by other computers

Yes No

Security control Average High

ARP (Address Resolution Protocol)

• ARP table is to contain IP address and associated MAC address information.

• To add or update ARP table:1. Senders sends ARP Request (ARP

broadcast) out.2. Receiver returns ARP Reply (unicast)

back.• RARP is to offer IP address against MAC

address (reverse direction)

ARP command

• ARP command can be used to display, add and clear entries in ARP table:

Arp /? can display all options of the command:

arp –a

arp –s

arp -d

Question

Any question?

If you do not have question, please start subnet calculation.

1. What subnet mask would be if I want to have 10 subnets in 10.0.0.0/8?

2. What subnet mask would be if I want to have 20 hosts in each subnet in 192.169.12.0/24?

Do not forget the lab assignment.