Upload
tito
View
215
Download
0
Embed Size (px)
Citation preview
8/8/2019 02 Networking
1/19
A networking primer
SOFTENG 325
Software Architecture
8/8/2019 02 Networking
2/19
SE 325 A Networking Primer 2
The role of a network
End systems (hosts) are connected by a network A network provides a communication service that end systems use
to exchange messages
Amessage is a sequence of bytes
A message is split into chunks called packets; it is packets that are
actually sent across the network
Network
Host Host
Message
MessagePackets
8/8/2019 02 Networking
3/19
SE 325 A Networking Primer 3
Networking fundamentals
In general, end systems are not connected directly, but by one ormore switches
Aswitch takes a packet arriving on one of its incoming links andforwards the packet on one of its outgoing links
Aroute (path) is a sequence of communication links and switchesthat a packet traverses from source to destination hosts
Switch
Link
8/8/2019 02 Networking
4/19
SE 325 A Networking Primer 4
Circuit switched networks
In circuit switched networks, resources along a path arereserved for the duration of a communication session
Host A
Host B
Each link has n circuits.
A dedicated connection between hostsA and B is set up prior to anycommunication between these hosts.
Each circuit provides a bandwidth of 1/n
for the duration of the connection.
8/8/2019 02 Networking
5/19
8/8/2019 02 Networking
6/19
SE 325 A Networking Primer 6
Packet switched networks
With a packet switched network, resources are not reserved, but used ondemand
Packets are transmitted over each link at the links full transmission rate
A packet switch stores a packet in its entirety before forwarding it on an
outbound link Each packet switch along a path incurs a delay of L/R seconds where
L is the length of the packet
R is the transmission rate of the link
Total delay between two hosts is QL/R where Q is the number of links
Assume a path exists between hosts A and B thatinvolves two switches. The transmission rate of each ofthe three links is 1.536Mbps and the maximum permittedsize of a packet is 64,000 bits. How long does it take totransfer the file of size 640,000 bits?
8/8/2019 02 Networking
7/19
SE 325 A Networking Primer 7
Queuing delay with packet
switched networks
If the arrival rate of packets atswitch X exceeds 1.5 Mbps,congestion occurs causing X toqueue packets
Queues are finite in size where a switchs queue is full,incoming packets aredropped
In general, queuing delays are
unpredictable; in practice theyare of the order ofmicroseconds to millisecondsper switch
Queue of
packets at
switch X
10 Mbps links
1.5 Mbps link
8/8/2019 02 Networking
8/19
SE 325 A Networking Primer 8
Delivery order in packet
switched networks
Network structures are self-organising in that routing tables storedin switches are periodically updated to take into account congestionand failed switches E.g. the route packets follow between hosts X and Y might change
from [A,B,D,E] to [A,C,F,E]
When transmitting a large message from X to Y, packets mightarrive at Y in a different order to which they sent by X
A
B
C
D
F
E
Host Y
Host X
Host Z
8/8/2019 02 Networking
9/19
SE 325 A Networking Primer 9
Efficiency
cenario 1 Assume:
A 1Mbps link
Users alternate betweenactive periods, where they
generate data at a rate of100kbps, and inactive periods
Users are active 10% of thetime
With TDM, the link cansupport only 10 users in orderfor each user to send data at
the rate of 100kbps
With packet switching: With 35 users, the probability
that 11+ are activesimultaneously is 0.0004
With up to 10 simultaneouslyactive users (probability0.9996), the aggregatearrival rate of data at the linkis
8/8/2019 02 Networking
10/19
SE 325 A Networking Primer 10
Efficiency Scenario 2
Assume: 10 users One user generates one thousand 1000-bit packets; remaining users remain
quiescent
With TDM and a 1Mbps link with 10 slots per frame, transmission of
the 1M bits takes 10 seconds With packet switching, the full link rate (1Mbps) can be used to send
the 1M bits within 1 second
Circuit switching can underutilise bandwidth.
Give an example of an application where circuit switchingwould be more appropriate than packet switching.
What class of applications would be better served bycircuit switching?
8/8/2019 02 Networking
11/19
SE 325 A Networking Primer 11
The Internet protocol
The Internet protocol (IP) is a network protocol that conforms tothe packet-switching model and which moves packets betweenInternet hosts
Key features ofIP:
Each host on the Internet is uniquely identified by an IP address An IP address is a 32 bit number
Packet switches (routers) are special purpose computers that containrouting tables. On receipt of an IP packet, a router uses its routingtable to forward the packet towards its destination
Source IP address DataDestination IP address
Header
Up to 64 Kilobytes
8/8/2019 02 Networking
12/19
SE 325 A Networking Primer 12
IP as a communication
service
A communication service such as IP can be described by fourproperties: Performance
Link transmission rate and other performance properties are determined by
the underlying link type(s) of a path Reliability two measures:
Validity, a service is valid if a packet that has been sent will eventually bedelivered to the destination host
Integrity, the message received is identical to the one sent, and nomessages are delivered twice
Ordering
A service provides ordered delivery if packets are delivered in the order inwhich they were sent
Synchronicity A synchronous service is one that can guarantee an upper bound on the
transmission time of a packet
IP is an unreliable service that offers no ordering guarantees.
8/8/2019 02 Networking
13/19
SE 325 A Networking Primer 13
Network heterogeneity
Example Range Bandwidth(Mbps)
Latency(ms)
LAN Ethernet 1-2 Km 10-1000 1-10
W AN IProuting Worldwide 0.010-600 100-500
WirelessLAN
WiFi (IEEE802.15.1)
0.15-1.5 Km 2-54 5-20
WirelessWAN
GSM, 3G Worldwide 0.010-2 100-500
8/8/2019 02 Networking
14/19
SE 325 A Networking Primer 14
Network heterogeneity
Network heterogeneity is masked by overlaying differentnetworking technologies and protocols with a virtualnetwork layer, IP
Ethernet
LAN WAN
Wireless
LAN
IP
8/8/2019 02 Networking
15/19
SE 325 A Networking Primer 15
Protocol stacks
Physical
Link
Network
Transport
ApplicationApplication layer protocols, e.g. HTTP, FTP, DNS
Transport protocols (e.g. UDP and TCP) extendthe network layer with a process-to-process
delivery service
Network protocols (e.g. IP) provide a packetdelivery service between hosts
Despite the IP network layer being unreliable, transport layer protocols can be
developed to provide reliable delivery and other value added services.
8/8/2019 02 Networking
16/19
SE 325 A Networking Primer 16
UDP: a simple transport
protocol
UDP (User Datagram Protocol) is a simple Internettransport protocol Beyond basic integrity checking of packets, UDP makes no
attempt to address the (lack of) reliability and ordering ofIP
A UDP packet is sent to a (host/port) pairA host is represented by an IP addressAport at the destination host is used by a process on that host to
listen for incoming packets
A port is a 16 bit number Ports in the range 0 to 1023 are well-known port numbers
Port 80 -- HTTP, port 21 -- FTP, etc.
UDP is an unreliable transport protocol that does not offer ordering guarantees.
A (host, port) pairuniquely identifies
a process on an Internet host.
Source port # Source port # Length Checksum Application data
8/8/2019 02 Networking
17/19
SE 325 A Networking Primer 17
Sockets and ports
Asocket is a programmingabstraction which provides anendpoint for communication
Messages sent to a particularInternet address and portnumber can be received onlyby a process whose socket isbound to thatInternetaddress and port number
A socket is associated with atransport protocol typicallyeither TCP or UDP
browser
138.37.94.248
browser
Web server
IP host
Socket
Port
Process
Socket bound to (138.37.94.248), 80)
Port 80
8/8/2019 02 Networking
18/19
SE 325 A Networking Primer 18
UDP checksum
The UDP checksum is includedfor error detection
Essence of approach The sender:
Sums the 16 bit wordscomprising the UDP packet
Performs 1s complement onthe sum this is thechecksum value added to theUDP packet
Any overflow is wrappedaround
The receiver adds all 16 bitwords, including thechecksum if the total is nota sequence of 16 1s thepacket is corrupt
0110011001100000
0101010101010101
1000111100001100
01100110011000000101010101010101
1011101110110101
1000111100001100
1011101110110101
0100101011000010
1011010100111101
0100101011000010
1011010100111101
1111111111111111
011001100110000001010101010101011000111100001100
Total of words 1 and 2
Total of words 1, 2 and 3
1s complement of total
Word 1Word 2Word 3
Total of words 1, 2 and 3Checksum value
8/8/2019 02 Networking
19/19
SE 325 A Networking Primer 19
UDP
Sender
IP
UDP
Receiver
IP
1. Receiver uses an API to create a UDP
socket, binding it to a particularport.
2. Sender uses an API to create a UDP
socket, binding it to any local port.
3. Sender calls the sockets send( ) operationsupplying the destination IP address,
destination port number and data to send.
4. The UDP layer creates a UDP packet,
filling in the packets fields.
5. The IP layer creates an IP packet and fills
in the source and destination IP address
fields. The IP packet encapsulates the UDP
packet.
6. The IP layer forwards the packet, sending
it to a router.
7. Each router examines the IP packet
header and forwards the packet.
8. On arrival at the destination host, the IPlayer unpacks the IP packet to get the
enclosedUDP packet.
9. The UDP layerplaces the UDP packet in
the queue for the socket associated with the
destination port.
10. The receiver makes a receive( ) call on its
socket and retrieves the packets contents.
IPIP
12 3
4
5
6
7 7 7
8
9
10
Host Host
Router
IP