Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 4:
Networking and the Internet
Computer Science: An Overview
Tenth Edition
by
J. Glenn Brookshear
Presentation files modified by Farn Wang
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-2
Chapter 4: Networking and the
Internet
• 4.1 Network Fundamentals
• 4.2 The Internet
• 4.3 The World Wide Web
• 4.4 Internet Protocols
• 4.5 Security
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-3
Network Classifications
• Scope
– Local area network (LAN)
– Metropolitan area (MAN)
– Wide area network (WAN)
• Ownership
– Closed versus open
• Topology (configuration)
– Bus (Ethernet)
– Star (Wireless networks with central Access Point)
– Ring (IBM FDDI)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-4
Network topologies
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-5
Communication over a bus network
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-6
Network topologies (continued)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-7
Protocols
• CSMA/CD (Carrier Sense, Multiple Access with Collision Detection)
– For wired communication.
• CSMA/CA (Carrier Sense, Multiple Access with Collision Avoidance)
– for wireless communication
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-8
Protocols
• CSMA/CD (Carrier Sense, Multiple Access with Collision Detection)
– For wired communication.
– Used in Ethernet
– Silent bus provides right to introduce new
message
– Retry after collection detection.
• CSMA/CA (Carrier Sense, Multiple Access with Collision Avoidance)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Ethernet bus arbitration algorithm
IEEE 802.3
• Optimistic – why pessimistic ?
– Use it and withdraw if bad things happen.
• Collision detection bad things
Bus
2.5km 51.2s
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Ethernet bus arbitration algorithm
IEEE 802.3
Ethernet bus arbitration algorithm
1. If there is some signals in the bus, then stop and try later.
2. Start sending the message and monitoring the bus.
3. If in 52s the message is corrupted, then stop and try
later.
4. At the 808’th s, complete the message.
Bus
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-11
Communication over a bus network
through a hub
computer computer
computer
computer computer hub
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-12
Protocols
• CSMA/CD (Carrier Sense, Multiple Access with Collision Detection)
• CSMA/CA (Carrier Sense, Multiple Access with Collision Avoidance)
– For wireless communication.
– Used in WiFi (IEEE 802.11)
– Hidden terminal problem
• signal drowning or blocking
• difficulties in collision detection.
– Random stream testing before the real frames
• Significantly reduction in retries.
• may need ack from AP
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-13
The hidden terminal problem
May
block
collision
detection.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-14
Connecting Networks
• Repeater: Extends a network
• Bridge: Connects two compatible networks
• Switch: Connect several compatible networks
• Router: Connects two incompatible networks
resulting in a network of networks called an
internet
– forwarding table
• Gateway: connecting a network to Internet
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-15
Building a large bus network from
smaller ones
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-16
Routers connecting two WiFi
networks and an Ethernet network to
form an internet
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-17
Inter-process Communication
• Client-server
• Peer-to-peer (P2P)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-18
Inter-process Communication
• Client-server
– One server, many clients
– Ideal for fast network access
– Server must execute continuously
– Client initiates communication
– For large-scale organization
– Win/NT, Linux, NetWare
• Peer-to-peer (P2P)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-19
Inter-process Communication
• Client-server
• Peer-to-peer (P2P)
– Two processes communicating as equals
– Ideal for sharing resources and applications
– For families and small offices
– Peer processes can be short-lived
– text conversation, interactive games, file
sharing
• could be difficult for copyright enforcing
– Win 98, Win 95, …
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-20
The client/server model compared to the
peer-to-peer model
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-21
Distributed Systems
• Systems with parts that run on different
computers
– Infrastructure can be provided by standardized
toolkits
• Example: Enterprise Java Beans from Sun
Microsystems
• Example: .NET framework from Microsoft
• Example: Cloud computing
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-22
The Internet
• The Internet: An internet that spans the
world
– Original goal was to develop a means of
connecting networks that would not be
disrupted by local disasters.
– Today it has shifted from an academic
research project to a commercial undertaking.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-23
Internet Architecture
• Internet Service Provider (ISP)
– sometimes means the internet.
• Access ISP (intranet)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-24
Internet Architecture
• Internet Service Provider (ISP)
– Tier-1 • very high-speed, high-capacity, international WAN
– Tier-2 • regional, less potent
• Access ISP (intranet): Provides connectivity to the Internet
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-25
Internet Architecture
• Internet Service Provider (ISP)
• Access ISP (intranet): Provides connectivity to the Internet
– is essentially an independent internet.
– is sometimes called intranet.
– provides connectivity to the Internet
– AOL, Microsoft, local cable companies, telephone companies, ….
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-26
Internet Architecture
• Internet Service Provider (ISP)
• Access ISP (intranet): Provides connectivity to the Internet
– hosts (end systems)
– Traditional telephone (dial up connection)
– Cable connections
– DSL (digital subscriber line) through modems
– Dial-up access (old tech)
– fiber-optic cables
– Wireless through AP • hotspot: the range of an AP
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-27
Internet Composition
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-28
Internet Addressing
• IP address: pattern often represented in dotted decimal notation
– from 32 to 128 bits
• Mnemonic address:
– Domain names
– Top-Level Domains (TLD) • edu, com, gov, org, info, net, …
– The dots in Mnemonic addresses are not related to the dots in IP address.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-29
Internet Addressing
• Domain name system (DNS)
– How to translate Mnemonic names to IP addresses ?
– Name servers • basically directories
– DNS is an Internet-wide directory system.
– DNS lookup
– Originally domain names are tied to physical regions
– Now individuals and small firms can also have domain presences.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-30
Internet Corporation for Assigned
Names & Numbers (ICANN)
• Allocates IP address blocks to ISPs who
then assign those addresses within their
regions.
• Oversees the registration of domains and
domain names.
– through companies called registrars
– once registered, the domain organization can extend for identifiers.
• ntu.edu.tw
– subdomains for network in the domain • ee.ntu.edu.tw
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-31
Traditional Internet Applications
• Electronic Mail (email)
– Domain mail server collects incoming mail and
transmits outing mail
– Mail server delivers collected incoming mail to
clients via POP3 or IMAP
– SMTP for text mails
– MIME for non-ASCII mails to SMTP
• File Transfer Protocol (FTP)
• Telnet and SSH
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-32
More Recent Applications
• Voice Over IP (VoIP)
• Internet Radio - webcasting
– streaming audio
– N-unicast
• burden to the sending servers and their immediate
neighbors
– Multicast
• let the routers decide to send copies to destinations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-33
World Wide Web
• Hypertext and HTTP
• Browser gets documents from Web server
• Documents uniquely identified by URLs
– Uniform Resource Locator
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
2013/04/13 stopped here.
4-34
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-35
A typical URL
Uniform Resource Locator
• a subset of the Uniform Resource
Identifier (URI)
• the location of an identified resource
• the mechanism for retrieving it.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-36
Hypertext Document Format
• Encoded as text file
• Contains tags to communicate with browser
– Appearance
• <h1> to start a level one heading
• <p> to start a new paragraph
– Links to other documents and content
• <a href = . . . >
– Insert images
• <img src = . . . >
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-37
A simple Web page
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-38
An enhanced simple Web page
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-39
Extensible Markup Language (XML)
• XML: A language for constructing markup
languages similar to HTML
– A descendant of SGML
• (Standard Generalized ML)
– Opens door to a World Wide Semantic Web
– note HTML does not strictly follow XML.
• XHTML does.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-40
Using XML
<staff clef = “treble”> <key>C minor</key>
<time> 2/4 </time>
<measure> < rest> egth </rest> <notes> egth G,
egth G, egth G </notes></measure>
<measure> <notes> hlf E </notes></measure>
</staff>
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-41
Figure 4.11 The first two bars of
Beethoven’s Fifth Symphony
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-42
WWW
- Client Side Versus Server Side
• Client-side activities
– Examples: java applets, javascript,
Macromedia Flash
• Server-side activities
– Common Gateway Interface (CGI)
– Servlets: a Java class in Java EE
• conforms to the Java Servlet API, a protocol of
Java classes to HTTP requests.
– PHP (personal home page)
• a scripting language for webpages
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-43
Package-shipping example
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-44
Internet Software Layers
• Application: Constructs message with address
• Transport: Chops message into packets
• Network: Handles routing through the Internet
• Link: Handles actual transmission of packets
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-45
The Internet software layers
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-46
Following a message through the
Internet
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-47
TCP/IP Protocol Suite
• Much more than TCP and IP.
• Transport Layer
– built on top of IP networks
– Users can choose from different versions, e.g.:
• TCP (Transmission Control Protocol)
• UDP (User Datagram Protocol)
• Network Layer
– IP (IPv4 and IPv6)
– deals only with packets
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-48
TCP (Transmission Control Protocol)
• connection-oriented.
– deal with streams
• high-quality and reliable.
– enables two hosts to establish a connection
and exchange streams of data.
– guarantees delivery of data
– guarantees that packets will be delivered in
the same order in which they were sent.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-49
UDP (User Datagram Protocol)
• very few error recovery services
• used primarily for broadcasting messages
• minimal overhead
• connectionless
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-50
Choosing between TCP and UDP
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-51
Security
• Attacks
– Malware • viruses: inserting itself into programs already in the
machine.
• worms: replicating and forwarding themselves
• Trojan horses: disguised as useful programs
• spyware: sniffing to collect private infor.
• phishing software
– Denial of service
– Spam: unwanted junk mails
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-52
Security
• Protection
– Firewalls: filtering traffic through a point
– Spam filters: a variation of firewall
– Proxy Servers: • intermediary shielding the clients from suspicious
servers.
• for specific services, elg., FTP, HTTP, telnet, …
– auditing software • for sudden change of system behaviors
– Antivirus software
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-53
Encryption
• FTPS, HTTPS, SSL (secure socket layer)
• Private-key Encryption
• Public-key Encryption
– Public key: Used to encrypt messages
– Private key: Used to decrypt messages
• Certificates and Digital Signatures
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-54
Private-key encryption
• key: k
• affine transformation modulo operand d
• message m1m2 … mn with mi [0,d),
• Encryption:
((m1+k)% d)((m2+k)% d)…((mn+k)%d)
• Decryption: c1c2 … cn with ci [0,d),
((c1-k)% d)((c2-k)% d)…((cn-k)% d)
remainder operator
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Private-key encryption
Example:
• k = 5
• d = 26
Encryption:
S (int(S)+5)%26 = X
T (int(T)+5)%26 = Y
O (int(O)+5)%26 = T
P (int(P)+5)%26 = U
4-55
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Private-key encryption
Drawbacks
• Receivers also must know the private key.
• No authentication
– Once the key is known, messages can be
forged.
• Solution: Need a private key for each
sender-receiver pair.
– Needs a lot of keys.
4-56
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-57
Public-key encryption
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Public key encrytion
RSA encryption method
– Ronald Rivest, Adi Shamir, Leonard
Adleman
• 2 large primes p, q (hundreds of bits
each)
• Ancient Chinese:
n is prime iff 2n-1%n = 1%n
• Fermat’s little theorem: Given a%p0,
ap%p=a%p and ap-1%p = 1%p
4-58
incorrect!
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Public key encrytion
RSA encryption method
– Ronald Rivest, Adi Shamir, Leonard Adleman
• 2 large primes p, q (hundreds of bits each)
• e: relative prime to (p-1)(q-1)
• Private key: pq
• Public key: d with gcd(d,e%(p-1)(q-1))=1
• Encryption: c = (me) % (pq)
• Decryption: cd=((me)%(pq))d
=m1+k(p-1)(q-1) % (pq) = m%(pq)
4-59