Data Transfer - PowerPoint PPT Presentation

1 / 67
About This Presentation
Title:

Data Transfer

Description:

Title: Author: Last modified by: pcs3412 Created Date: 9/15/2000 7:52:52 AM Document presentation format: – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 68
Provided by: 6649734
Category:

less

Transcript and Presenter's Notes

Title: Data Transfer


1
Data Transfer
From TCP/IP ???? Craig Hunt ? ??? ????
Reference Book Computer Networking A Top Down
Approach. 4th edition. Jim Kurose, Keith Ross.
Addison-Wesley, July 2007.
2
Outlines
?????
  • IP addressing
  • Determine the path
  • Address resolution
  • Protocol, port and
  • socket
  • ???? IP ?? ???????
  • ????? IP ????
  • ??header???????????????
  • ????????????????
  • ?????? port ????????????????

3
Part 1IP Addressing
-- ???? IP ????????
4
IP Addressing
  • Provide Internet addressing
  • Logic addresses
  • Give each network interface a unique IP address.
  • Deliver data to the correct host through
    heterogeneous physical networks

5
IP Addressing
  • IP address is a 32-bit binary number
  • network address host address
  • IP address identifies a specific network, and a
    host in that network.
  • The prefix length defines the size of network
    address.
  • IP address class
  • Classless Inter-domain Routing(CIDR) and CIDR
    addressing mask

6
Principles of IP Addresses
  • IP address is not assigned to a host.
  • IP address is assigned to the interface card
    between the host and network.
  • If a host has several network interfaces (ex
    routers), each interface card needs one IP
    address.

7
IP Address Class
In the first byte, A 0 ? 127 B 128
? 191 C 192 ? 223 D 224 ? 239 E
240 ? 255
8
Three Types of IP Addresses
  • Unicast address
  • Ex140.138.136.254
  • Multicast address
  • Ex224.0.0.9
  • First decimal number is 224 through 239
  • Broadcast address
  • Ex140.138.137.255
  • Bits in Host address are all 1s.

9
Address Space for Each Class
  • IP address class is not fit the requirement of
    each organization on Internet.

10
Classless Inter-domain Routing (CIDR)
  • Using addressing mask to determine the network
    space
  • Network mask is a 32-bit stream
  • Prefix is all 1s network part
  • Suffix is all 0s host part
  • Examplemask255.255.254.0
  • 11111111,11111111,11111110,00000000

network address 140.138.16.0
11
IP address and Network Mask
  • You have to set the computer A
  • IP address (ex 140.138.137.201)
  • Network mask (ex 255.255.254.0)
  • Default gateway (ex140.138.136.202)

140.138.137.20110001100 10001010 10001001
11001001 255.255.254.0 11111111 11111111
11111110 00000000 140.138.136.0 10001100
10001010 10001000 00000000
A
A and B has the same network address in the same
LAN
140.138.137.20210001100 10001010 10001001
11001010 255.255.254.0 11111111 11111111
11111110 00000000 140.138.136.0 10001100
10001010 10001000 00000000
B
A and C dont have the same network address
in different LAN
140.138.135.10810001100 10001010 10000111
01101100 255.255.254.0 11111111 11111111
11111110 00000000 140.138.134.0 10001100
10001010 10000110 00000000
C
12
Cost of CIDR
  • Modify all routing protocols and routers
  • Send the network mask except for original IP
    datagram
  • IP192.168.16.122/21
  • /21 denotes that mask has 21 1s in prefix

13
Special IP Addresses
  • Default route 0.0.0.0
  • Used during bootstrap
  • Loopback address 127.0.0.1
  • For testing
  • For all network
  • Host address is all 0s the network itself
  • Host address is all 1s all hosts in this
    specified network (called as Directed Broadcast
    Address)
  • Limited Broadcast Address 255.255.255.255
  • Broadcast on local network

14
Private Network
  • The following addresses are reserved for the
    private network
  • Class A10.0.0.
  • Class B172.16.. to 172.31..
  • Class C192.68.0. to 192.68.255.

15
Subnet
  • For the reason of management, we separate a large
    network into several subnets.
  • We set network masks to cut a space of IP address
    into subset.
  • The number of IP addresses will decrease after
    cutting.
  • Subsets may use different physical networks and
    be connected by routers.

16
Different Physical Networks under IP
17
Subnet Example
  • A large network172.16.0.0/16
  • 172.16.0.1172.16.255.254
  • Network mask 255.255.0.0
  • Separate to 16 subnets
  • Network mask 255.255.240.0
  • Subnet 1172.16.0.0/20
  • 172.16.0.1172.16.15.254
  • Subnet 2172.16.16.0/20
  • 172.16.16.1172.16.31.254
  • Subnet 3172.16.32.0/20
  • 172.16.32.1172.16.47.254

18
Part 2Determine the Path
-- ???? IP ????????
19
Logical View of Routing
20
IP Datagram Routing(1/2)
  • For all network devices including hosts and
    gateways, they must decide the path themselves
    while sending a datagram to a destination.
  • If the destination is in the same network, send
    the datagram to the destination directly.
  • If the destination is not in the same network,
    send the datagram to the gateway.
  • For hosts, to choose a path is just to choose a
    network.

21
IP Datagram Routing(2/2)
  • IP module calculates the network address of
    destination IP by using network mask.
  • Compare with its network address
  • Not the samecheck routing table and find the
    next hop. In other words, the IP address of
    gateway which would forward this datagram.
  • This device uses ARP to get the MAC address of
    destination or gateway and put it on the Ethernet
    frame.
  • IP datagram is encapsulated into Ethernet frame
    without modification.

22
IP Encapsulation
  • IP datagram is enveloped in Ethernet frame.
  • The destination MAC address in Ethernet frame
    points to next hop in the delivering path.

23
Peanut Network 172.16.12.0/24
24
Peanut Example
  • network mask255.255.255.0
  • Peanut has network prefix172.16.12.0
  • Case1 Sourcepeanut, Destinationwalnut
  • 255.255.255.0 172.16.12.4 172.16.12.0
  • Next hop 172.16.12.4
  • Case2 Sourcepeanut, Destinationbanana
  • 255.255.255.0 172.16.1.2 172.16.1.0
  • Next hop 172.16.12.3

25
IP module in peanut network
26
Addresses in Routing Path
  • peanut ? walnut
  • peanut ? pecan ? banana

Source IP172.16.12.2 MAC080020000ec8
Destination IP172.16.12.4
MAC00c03417b220
Source IP172.16.12.2 MAC080020000ec8
Destination IP172.16.1.2
MAC0020af1e7e5e
Source IP172.16.12.2 MAC04390f1534f0
Destination IP172.16.1.2
MAC03705b113450
27
Routing Table
  • ??????????(destination)????????
  • Routing table ???? System manager ???? Routing
    protocol ???
  • ExamplePeanut Routing Table
  • UNIX ? netstat -nr ?????

28
Peanut Routing Table
  • Destination Gateway Flags Ref
    Use Interface
  • 127.0.0.1 127.0.0.1 UH 1
    298 lo0
  • default 172.16.12.1 UG 2
    50360
  • 172.16.12.0 172.16.12.2 U 40
    111379 le0
  • 172.16.2.0 172.16.12.3 UG 4
    1179
  • 172.16.1.0 172.16.12.3 UG 10
    1113
  • 172.16.3.0 172.16.12.3 UG 2
    1379
  • 172.16.4.0 172.16.12.3 UG 4
    1119

29
netstat -nr (mis)
  • mis netstat -r
  • Kernel IP routing table
  • Destination Gateway Genmask
    Flags MSS Window irtt Iface
  • localnet
    255.255.255.0 U 0 0
    0 eth0
  • loopback
    255.0.0.0 U 0 0
    0 lo
  • default 140.126.155.254 0.0.0.0
    UG 0 0 0 eth0
  • mis netstat -nr
  • Kernel IP routing table
  • Destination Gateway Genmask
    Flags MSS Window irtt Iface
  • 140.126.155.0 0.0.0.0 255.255.255.0
    U 0 0 0 eth0
  • 127.0.0.0 0.0.0.0 255.0.0.0
    U 0 0 0 lo
  • 0.0.0.0 140.126.155.254 0.0.0.0
    UG 0 0 0 eth0

30
netstat -nr (ms)
  • Destination Gateway
    Flags Refs Use Netif Expire
  • default 140.126.111.20
    UGSc 48 1531 fxp0
  • 127.0.0.1 127.0.0.1
    UH 1 54 lo0
  • 140.126.111/24 link1 UC
    0 0 fxp0
  • 140.126.111.1 0902776a262 UHLW
    1 1863 fxp0 1182
  • 140.126.111.3 0a0c98b61e3 UHLW
    1 157 lo0
  • 140.126.111.4 080c8ef7c69 UHLW
    0 178 fxp0 961
  • 140.126.111.19 link1
    UHLW 2 0 fxp0
  • 140.126.111.20 0e0633df80 UHLW
    48 0 fxp0 1197
  • 140.126.111.153 080c8ef465d UHLW
    1 336 fxp0 683
  • 140.126.111.155 080c8ef7ff4 UHLW
    0 223 fxp0 1012
  • 140.126.111.157 0c026ef653 UHLW
    1 2716 fxp0 618
  • 140.126.111.162 080c8ef4662 UHLW
    0 27 fxp0 1178
  • 140.126.111.255 ffffffffffff
    UHLWb 1 3023 fxp0
  • 140.126.161.23 140.126.111.19 UGHD
    0 3 fxp0
  • 140.126.161.31 140.126.111.19 UGHD
    0 419 fxp0

31
netstat -in (ms)
  • netstat -in
  • Name Mtu Network Address
    Ipkts Ierrs Opkts Oerrs Coll
  • fxp0 1500 ltLinkgt 00.a0.c9.8b.61.e3
    2060401 1 2036174 0 0
  • fxp0 1500 140.126.111/2 140.126.111.3
    2060401 1 2036174 0 0
  • lp0 1500 ltLinkgt
    0 0 0 0
    0
  • tun0 1500 ltLinkgt
    0 0 0 0
    0
  • sl0 552 ltLinkgt
    0 0 0
    0 0
  • ppp0 1500 ltLinkgt
    0 0 0 0
    0
  • lo0 16384 ltLinkgt
    361 0 361 0
    0
  • lo0 16384 127 127.0.0.1
    361 0 361 0 0

32
ifconfig for Checking Interface
  • ifconfig fxp0
  • fxp0 flags8843ltUP,BROADCAST,RUNNING,SIMPLEX,MULT
    ICASTgt mtu 1500
  • inet 140.126.111.3 netmask 0xffffff00
    broadcast 140.126.111.255
  • ether 00a0c98b61e3
  • media autoselect (100baseTX
    ltfull-duplexgt) status active
  • supported media autoselect 100baseTX
    ltfull-duplexgt 100baseTX 10baseT/UP
  • ifconfig lp0
  • lp0 flags8810ltPOINTOPOINT,SIMPLEX,MULTICASTgt
    mtu 1500
  • Note winipcfg used in Windows
  • ipconfig used in MSDOS

33
Part 3Address Resolution
-- ????? IP ??? (1/2)
34
Binding Protocol Addresses
  • Protocol addresses (or logical addresses) are
    abstractions provided by software in the upper
    layer.
  • ExampleIP address is protocol address
  • Physical network hardware does not know how to
    locate the next hop from its protocol address.
  • The Protocol address of the next hop must be
    translated to its hardware address (or physical
    address) before a packet is sent.

35
Address Resolution
  • A host or router uses address resolution when it
    needs to send a packet to another computer on the
    same physical network.
  • Mapping between a protocol address and a hardware
    address is called address resolution.

36
Address Resolution and Binding Address
IP Addresses for TCP/IP
MAC Addresses for Ethernet
37
Address Resolution Protocol (ARP)
  • Network Access Layer calls ARP and translate IP
    address into Ethernet MAC.
  • ARP software creates an address resolution table.
  • Whenever ARP software receives a translation
    request, it checks the table.
  • Existreply the Ethernet address
  • Not existARP broadcasts a query with an IP.
    Then the host owned this IP will reply its MAC
    address. ARP will save the information into the
    table.

38
Address Resolution Table
  • Display and modify the IP-to-Physical address
    translation tables used by address resolution
    protocol (ARP)
  • arp peanut
  • peanut (172.16.12.2) at 80200ec8
  • Refer to ARP.ppt

39
arp for peanut network
  • Net to Media Table
  • Device IP Address Mask
    Flags Phys Addr
  • ------- ----------------------------
    ---------------------- ------
    ----------------------
  • le0 peanut.nuts.com
    255.255.255.255 080020000ec8
  • le0 acorn.nuts.com
    255.255.255.255 080002052133
  • le0 almond.nuts.com
    255.255.255.255 SP 08002022fd51
  • le0 pecan.nuts.com
    255.255.255.255 0020af1e7e5f
  • le0 base-address.mcast.net 240.0.0.0
    SM 01005e000000

40
Part 4Encapsulation
-- ????? IP ??? (2/2)
41
IP Encapsulation
  • For delivery of IP datagram on physical networks,
    IP datagram must be encapsulated in a frame.
  • Different physical networks can deliver frames
    with different size.
  • IP module need to perform the fragmentation and
    reassembly of IP datagrams whenever the frame
    size of the next physical network is smaller than
    the one of current physical network.

42
Maximum Transmission Unit (MTU)
  • Network links have MTU - largest possible
    link-level frame.
  • Different link types, different MTUs
  • ExampleFDDI 4352 bytes?Ethernet 1500 bytes?x.25
    576 bytes?PPP 296 bytes
  • Large IP datagram divided
  • Fragment one datagram to several datagrams
  • Reassembled only at final destination
  • IP header bits used to identify, order related
    fragments

43
Sending Data on Internet
MTU 5000
MTU 1500
MTU 800
44
Fragmentation
45
Reassembly
46
Fragment and Reassemble IP Datagram
  • How to reassemble fragments
  • Sender gives a unique IDENTIFICATION and saves it
    in the IP header. Whenever routers separate an
    original IP datagram, routers copy IDENTIFICATION
    to all new IP datagrams (called as fragment.)
  • Receiver uses IDENTIFICATION and source IP
    address to resemble the original datagram? In
    addition, by using FRAGMENT OFFSET, the data is
    combined together with correct order?

47
Detailed Fragmentation Example
Note length length of (data header )
48
Part 5Protocol Number
-- ?? header ?? protocol ?? ???????????
49
TCP/IP Layers
Port numbers
Protocol numbers
50
Multiplexing
  • Network system collects data from many APs, puts
    them into some transport layer protocols, and
    then combined all into an IP datagram.
  • It is called as multiplexing.
  • On the contrary, the data in IP datagram must be
    de-multiplexed to APs.
  • IP module use protocol number to indicate the
    upper transport layer.
  • Transport layer uses port number to indicate the
    upper AP.

51
Multiplexing and Demultiplexing
port number
TCP
UDP
TCP
UDP
ICMP
ICMP
protocol number
IP
IP
demultiplexer
multiplexer
52
Protocol Number
  • There is an 8-bit field in the IP datagram for
    the protocol number.
  • For Unix, /etc/protocols is a table which maps
    protocol numbers and protocol names.
  • Well-known Protocol Numbers is recorded in
    Assigned Numbers RFC.
  • Example1 for ICMP, 6 for TCP, 17 for UDP.

53
cat /etc/protocols (mis)
mis cat /etc/protocols protocols This
file describes the various protocols that are
available from the TCP/IP subsystem.
It should be consulted instead of
using the numbers in the ARPA
include files, or, worse, just guessing
them. ip 0 IP internet
protocol, pseudo protocol number icmp 1
ICMP internet control message protocol igmp
2 IGMP internet group multicast
protocol ggp 3 GGP
gateway-gateway protocol tcp 6 TCP
transmission control protocol pup 12
PUP PARC universal packet protocol udp
17 UDP user datagram protocol idp
22 IDP WhatsThis? raw 255
RAW RAW IP interface End.
54
cat /etc/protocols (ms)
  • Internet protocols
  • FreeBSD src/etc/protocols,v 1.10.2.3
    1999/08/29 141853 peter Exp
  • from _at_()protocols 5.1 (Berkeley)
    4/17/89
  • See also http//www.isi.edu/in-notes/iana/assign
    ments/protocol-numbers
  • ip 0 IP
    internet protocol, pseudo protocol number
  • hopopt 0 HOPOPT hop-by-hop options
    for ipv6
  • icmp 1 ICMP internet
    control message protocol
  • igmp 2 IGMP internet
    group management protocol
  • ggp 3 GGP
    gateway-gateway protocol
  • ipencap 4 IP-ENCAP IP encapsulated in
    IP (officially IP'')
  • st2 5 ST2 ST2
    datagram mode (RFC 1819)
  • tcp 6 TCP
    transmission control protocol
  • cbt 7 CBT CBT, Tony
    Ballardie ltA.Ballardie_at_cs.ucl.ac.ukgt

55
Part 6Port Number
-- ?????? port ???????????????
56
Port Number
  • The server computer may be running several
    processes at the same time.
  • When the message arrives at the server, it must
    be directed to the correct process.
  • Transport layer needs an address for each server
    process identification, called a port number.
  • Source Port and Destination Port
  • Port number has 16 bits.

57
Telnet(in Destination)
IP datagram
58
Assignment of Port Numbers
  • To make sure each connection is unique, OS
    assigns port number to processes
  • Source host (usually being a client) uses
    dynamically allocated port number?
  • Destination port (usually being a server) uses
    well-known port number(0-1023)?
  • ExampleSource Port Number is 3044Destination
    Port Number is 23 for telnet

59
TCP handshaking
  • Example of TCP handshaking to create a telnet
    connection

Destination 092.168.16.2 Port Number 23
Source 172.16.12.2 Port Number 3044
60
2 Telnet Connections
  • Even through there are two telnet connections on
    a PC, their port number pairs are not the same.

telnet server
telnet client
Source 172.16.12.2 Port Number 3044
Source 172.16.12.2 Port Number 3555
Destination 092.168.16.2 Port Number 23
61
Some Port Numbers
  • Different transport protocols define their
    corresponding port numbers.
  • It is meaningful Port Number Protocol Number
  • The port numbers on Unix are saved in
    /etc/services.
  • The numbers below 256 are used for common
    services.
  • Exampleftp 21?telnet 23?smtp 25

62
cat /etc/services (ms) (1/2)
  • head -40 /etc/services
  • Network services, Internet style
  • Note that it is presently the policy of IANA to
    assign a single well-known
  • port number for both TCP and UDP hence, most
    entries here have two entries
  • even if the protocol doesn't support UDP
    operations.
  • Updated from RFC 1700, Assigned Numbers''
    (October 1994). All ports
  • are included.
  • The latest IANA port assignments can be gotten
    from
  • http//www.isi.edu/in-notes/iana/assignmen
    ts/port-numbers
  • The Well Known Ports are those from 0 through
    1023.
  • The Registered Ports are those from 1024
    through 49151
  • The Dynamic and/or Private Ports are those from
    49152 through 65535
  • Kerberos services are for Kerberos v4, and are
    unofficial. Sites running
  • v5 should uncomment v5 entries and comment v4
    entries.
  • FreeBSD src/etc/services,v 1.55.2.6
    1999/08/29 141901 peter Exp
  • From _at_()services 5.8 (Berkeley)
    5/9/91
  • WELL KNOWN PORT NUMBERS

63
cat /etc/services (ms) (2/2)
  • rtmp 1/ddp Routing Table
    Maintenance Protocol
  • tcpmux 1/tcp TCP Port Service
    Multiplexer
  • tcpmux 1/udp TCP Port Service
    Multiplexer
  • nbp 2/ddp Name Binding
    Protocol
  • compressnet 2/tcp Management Utility
  • compressnet 2/udp Management Utility
  • compressnet 3/tcp Compression Process
  • compressnet 3/udp Compression Process
  • echo 4/ddp AppleTalk Echo
    Protocol
  • rje 5/tcp Remote Job
    Entry
  • rje 5/udp Remote Job
    Entry
  • zip 6/ddp Zone
    Information Protocol
  • echo 7/tcp
  • echo 7/udp
  • discard 9/tcp sink null
  • discard 9/udp sink null
  • systat 11/tcp users
    Active Users

64
cat /etc/services (mis) (1/2)
  • mis head -20 /etc/services
  • Network services, Internet style
  • Note that it is presently the policy of IANA to
    assign a single well-known
  • port number for both TCP and UDP hence, most
    entries here have two entries
  • even if the protocol doesn't support UDP
    operations.
  • Updated from RFC 1340, Assigned Numbers''
    (July 1992). Not all ports
  • are included, only the more common ones.
  • from _at_()services 5.8 (Berkeley)
    5/9/91
  • Id services,v 1.9 1993/11/08 194915
    cgd Exp

65
cat /etc/services (mis) (2/2)
  • tcpmux 1/tcp TCP port
    service multiplexer
  • echo 7/tcp
  • echo 7/udp
  • discard 9/tcp sink null
  • discard 9/udp sink null
  • systat 11/tcp users
  • daytime 13/tcp
  • daytime 13/udp

66
Socket Pairs
  • IP addressPort number Socket address
  • Socket pairs define a unique Internet connection.
  • Example (172.16.12.2,3044) and (092.168.16.2,23)
    is a socket pair for this connection.

67
Summary
  • We have learned the process to deliver an IP
    datagram.
  • Now, you should
  • know to set
  • IP address
  • Protocol number
  • port number
  • socket address
  • socket pair
  • ???? IP ?? ???????
  • ????? IP ????
  • ??header???????????????
  • ????????????????
  • ?????? port ????????????????
Write a Comment
User Comments (0)
About PowerShow.com