0% found this document useful (0 votes)
67 views6 pages

A Client Server Transaction: Instructors

The document discusses the client-server model and computer networks at a high level: 1. The client-server model involves client processes sending requests to server processes which manage resources. The server processes provide services by manipulating resources for clients in response to their requests. 2. A computer network is a hierarchical system of connected boxes and wires organized by proximity. Examples include data center networks within a building, local area networks (LANs) within a campus, and wide area networks (WANs) spanning countries. 3. An internet is an interconnected set of networks. The global Internet is the most well-known example, built from the ground up by connecting local networks via bridges, switches, routers, and
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views6 pages

A Client Server Transaction: Instructors

The document discusses the client-server model and computer networks at a high level: 1. The client-server model involves client processes sending requests to server processes which manage resources. The server processes provide services by manipulating resources for clients in response to their requests. 2. A computer network is a hierarchical system of connected boxes and wires organized by proximity. Examples include data center networks within a building, local area networks (LANs) within a campus, and wide area networks (WANs) spanning countries. 3. An internet is an interconnected set of networks. The global Internet is the most well-known example, built from the ground up by connecting local networks via bridges, switches, routers, and
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Carnegie Mellon Carnegie Mellon

A Client‐Server Transaction
1. Client sends request
Client Server
Resource
Introduction to Computer Systems 4. Client 
process
3. Server sends response
process
2. Server 
15‐213/18‐243, fall 2009 handles handles
18th Lecture, Nov. 3rd response request

Note: clients and servers are processes running on hosts 
(can be the same or different hosts)
Instructors:
Roger Dannenberg and Greg Ganger „ Most network applications are based on the client‐server 
model:
ƒ A server process and one or more client processes
ƒ Server manages some resource
ƒ Server provides service by manipulating resource for clients
ƒ Server activated by request from client (vending machine analogy)

Carnegie Mellon Carnegie Mellon

Hardware Organization of a Network Host Computer Networks
CPU chip
register file „ A network is a hierarchical system of boxes and wires 
organized by geographical proximity
ALU
ƒ Data center networks: spans cluster or machine room
system bus memory bus ƒ Switched Ethernet, Infiniband, …
ƒ LAN (Local Area Network)  spans a building or campus
I/O  main ƒ Ethernet is most prominent example
MI
bridge memory
ƒ WAN (Wide Area Network) spans country or world
ƒ Typically high‐speed point‐to‐point phone lines
Expansion slots
„ An internetwork (internet) is an interconnected set of 
I/O bus
networks
USB graphics disk  network ƒ The Global IP Internet (uppercase “I”) is the most famous example 
controller adapter controller adapter of an internet (lowercase “i”)

mouse keyboard monitor „ Let’s see how an internet is built from the ground up


disk network

Carnegie Mellon Carnegie Mellon

Lowest Level: Ethernet Segment Next Level: Bridged Ethernet Segment
host host host A B
host host host host host
100 Mb/s 100 Mb/s
hub X
hub 100 Mb/s bridge 100 Mb/s hub

port
1 Gb/s
host host
„ Ethernet segment consists of a collection of hosts connected 
by wires (twisted pairs) to a hub 100 Mb/s 100 Mb/s
hub bridge hub
„ Spans room or floor in a building Y
host host host host host
„ Operation C
ƒ Each Ethernet adapter has a unique 48‐bit address (MAC address)
ƒ Hosts send bits to any other host in chunks called frames „ Spans building or campus
ƒ Hub slavishly copies each bit from each port to every other port
ƒ Every host sees every bit „ Bridges cleverly learn which hosts are reachable from which 
ƒ Note: Hubs are on their way out. Bridges (switches, routers) became cheap enough 
to replace them (means no more broadcasting)
ports and then selectively copy frames from port to port
Carnegie Mellon Carnegie Mellon

Conceptual View of LANs Next Level: internets
„ For simplicity, hubs, bridges, and wires are often shown as a  „ Multiple incompatible LANs can be physically connected by 
collection of hosts attached to a single wire: specialized computers called routers
„ The connected networks are called an internet

host host ... host


host host ... host host host ... host

LAN LAN
router router router
WAN WAN

LAN 1 and LAN 2 might be completely different, totally incompatible 
(e.g., Ethernet and Wifi, 802.11*, T1‐links, DSL, …)

Carnegie Mellon Carnegie Mellon

Logical Structure of an internet The Notion of an internet Protocol
host „ How is it possible to send bits across incompatible LANs 
router
host router router
and WANs?
router

„ Solution: 
router
router ƒ protocol software running on each host and router 
ƒ smooths out the differences between the different networks

„ Ad hoc interconnection of networks
„ Implements an internet protocol (i.e., set of rules)
ƒ No particular topology
ƒ governs how hosts and routers should cooperate when they 
ƒ Vastly different router & link capacities transfer data from network to network
„ Send packets from source to destination by hopping through  ƒ TCP/IP is the protocol for the global IP Internet
networks
ƒ Router forms bridge from one network to another
ƒ Different packets may take different routes

Carnegie Mellon Carnegie Mellon

What Does an internet Protocol Do? Transferring Data Over an internet
LAN1 Host A Host B LAN2
„ Provides a naming scheme client server
ƒ An internet protocol defines a uniform format for host addresses
ƒ Each host (and router) is assigned at least one of these internet  (1) data (8) data

addresses that uniquely identifies it protocol protocol


internet packet software software
(2) data PH FH1 (7) data PH FH2
„ Provides a delivery mechanism
LAN1 frame
ƒ An internet protocol defines a standard transfer unit (packet) LAN1 LAN2
adapter adapter
ƒ Packet consists of header and payload Router
(3) data PH FH1 (6) data PH FH2
ƒ Header: contains info such as packet size, source and destination  LAN1 LAN2
addresses adapter adapter
LAN2 frame
ƒ Payload: contains data bits sent from source host
(4) data PH FH1 data PH FH2 (5)

protocol
PH: Internet packet header software
FH: LAN frame header
Carnegie Mellon Carnegie Mellon

Other Issues Global IP Internet
„ We are glossing over a number of important questions: „ Most famous example of an internet
ƒ What if different networks have different maximum frame sizes? 
(segmentation) „ Based on the TCP/IP protocol family
ƒ How do routers know where to forward frames? ƒ IP (Internet protocol) : 
ƒ How are routers informed when the network topology changes? ƒProvides basic naming scheme and unreliable delivery capability
ƒ What if packets get lost? of packets (datagrams) from host‐to‐host
ƒ UDP (Unreliable Datagram Protocol)
ƒ Uses IP to provide unreliable datagram delivery from 
„ These (and other) questions are addressed by the area of   process‐to‐process
systems known as computer networking ƒ TCP (Transmission Control Protocol)
ƒ Uses IP to provide reliable byte streams from process‐to‐process 
over connections

„ Accessed via a mix of Unix file I/O and functions from the 
sockets interface

Carnegie Mellon Carnegie Mellon

Hardware and Software Organization  Naming and Communicating on the Internet
of an Internet Application „ Original Idea
ƒ Every node on Internet would have unique IP address
ƒ Everyone would be able to talk directly to everyone
Internet client host Internet server host ƒ No secrecy or authentication
Client User code Server ƒ Messages visible to routers and hosts on same LAN
Sockets interface ƒ Possible to forge source field in packet header
(system calls)
TCP/IP Kernel code TCP/IP
„ Doesn’t always work this way
Hardware interface
(interrupts) ƒ We may talk about some evolution, if time allows
Network Hardware Network ƒ See slides at end (for fun), if not
adapter and firmware adapter

Global IP Internet

Carnegie Mellon Carnegie Mellon

A Programmer’s View of the Internet IP Addresses
„ 32‐bit IP addresses are stored in an IP address struct
„ Hosts are mapped to a set of 32‐bit IP addresses
ƒ IP addresses are always stored in memory in network byte order 
ƒ 128.2.203.179 (big‐endian byte order)
ƒ True in general for any integer transferred in a packet header from one 
„ The set of IP addresses is mapped to a set of identifiers  machine to another.
called Internet domain names ƒ E.g., the port number used to identify an Internet connection.

ƒ 128.2.203.179 is mapped to  www.cs.cmu.edu /* Internet address structure */


struct in_addr {
unsigned int s_addr; /* network byte order (big-endian) */
„ A process on one Internet host can communicate with a  };
process on another Internet host over a connection
Useful network byte‐order conversion functions:
htonl: convert long int from host to network byte order
htons: convert short int from host to network byte order
ntohl: convert long int from network to host byte order
ntohs: convert short int from network to host byte order
Carnegie Mellon Carnegie Mellon

Dotted Decimal Notation Dotted Decimal Notation
„ By convention, each byte in a 32‐bit IP address is represented  „ By convention, each byte in a 32‐bit IP address is represented 
by a string: decimal values for bytes, separated by a period by a string: decimal values for bytes, separated by a period
ƒ IP address: 0x8002C2F2 = 128.2.194.242
Blackboard? ƒ IP address: 0x8002C2F2 = 128.2.194.242

„ Functions for converting between binary IP addresses and 
dotted decimal strings:
ƒ inet_aton: dotted decimal string → IP address in network byte order
ƒ inet_ntoa: IP address in network byte order → dotted decimal string

ƒ “n” denotes network representation
ƒ “a” denotes application representation

Carnegie Mellon Carnegie Mellon

IP Address Structure Internet Domain Names
„ IP (V4) Address space divided into classes: unnamed root
0 1 2 3          8                   16                   24     31
Class A 0 Net ID Host ID
Class B .net .edu .gov .com First‐level domain names
10 Net ID Host ID
Class C 110 Net ID Host ID
Class D 1110 Multicast address mit cmu berkeley amazon Second‐level domain names
Class E 1111 Reserved for experiments

„ Network ID written in form w.x.y.z/n cs ece www Third‐level domain names


ƒ n = number of bits in net id (yellow part above) 208.216.181.15
ƒ E.g., CMU written as 128.2.0.0/16
ƒ Which class is that? cmcl pdl
„ Unrouted (private) IP addresses:
ƒ 10.0.0.0/8   172.16.0.0/12   192.168.0.0/16 kittyhawk imperial
128.2.194.242 128.2.189.40 
„ Nowadays: CIDR (Classless interdomain routing)

Carnegie Mellon Carnegie Mellon

Domain Naming System (DNS) Properties of DNS Host Entries
„ The Internet maintains a mapping between IP addresses and  „ Each host entry is an equivalence class of domain names and 
domain names in a huge worldwide distributed DNS database IP addresses
ƒ Conceptually, programmers can view the DNS database as a collection of 
millions of host entry structures: „ Each host has a locally defined domain name localhost
which always maps to the loopback address 127.0.0.1
/* DNS host entry structure */
struct hostent {
char *h_name; /* official domain name of host */
„ Different kinds of mappings are possible:
char **h_aliases; /* null-terminated array of domain names */ ƒ Simple case: one‐to‐one mapping between domain name and IP address:
int h_addrtype; /* host address type (AF_INET) */
int h_length; /* length of an address, in bytes */
ƒ kittyhawk.cmcl.cs.cmu.edu maps to 128.2.194.242
char **h_addr_list; /* null-terminated array of in_addr structs
*/ ƒ Multiple domain names mapped to the same IP address:
}; ƒ eecs.mit.edu and cs.mit.edu both map to 18.62.1.6

ƒ Multiple domain names mapped to multiple IP addresses:
„ Functions for retrieving host entries from DNS: ƒ aol.com and www.aol.com map to multiple IP addresses
ƒ gethostbyname: query key is a DNS domain name
ƒ Some valid domain names don’t map to any IP address:
ƒ gethostbyaddr: query key is an IP address ƒ for example: cmcl.cs.cmu.edu
Carnegie Mellon Carnegie Mellon

A Program That Queries DNS Querying DNS from the Command Line
int main(int argc, char **argv) { /* argv[1] is a domain name */
char **pp; /* or dotted decimal IP addr */ „ Domain Information Groper (dig) provides a scriptable  
struct in_addr addr;
struct hostent *hostp;
command line interface to DNS

if (inet_aton(argv[1], &addr) != 0) linux> dig +short kittyhawk.cmcl.cs.cmu.edu


hostp = Gethostbyaddr((const char *)&addr, sizeof(addr), 128.2.194.242
AF_INET);
linux> dig +short -x 128.2.194.242
else
hostp = Gethostbyname(argv[1]); KITTYHAWK.CMCL.CS.CMU.EDU.
printf("official hostname: %s\n", hostp->h_name); linux> dig +short aol.com
205.188.145.215
for (pp = hostp->h_aliases; *pp != NULL; pp++) 205.188.160.121
printf("alias: %s\n", *pp); 64.12.149.24
64.12.187.25
for (pp = hostp->h_addr_list; *pp != NULL; pp++) { linux> dig +short -x 64.12.187.25
addr.s_addr = ((struct in_addr *)*pp)->s_addr;
aol-v5.websys.aol.com.
printf("address: %s\n", inet_ntoa(addr));
}
}

Carnegie Mellon Carnegie Mellon

Internet Connections Putting it all Together: 
„ Clients and servers communicate by sending streams of bytes  Anatomy of an Internet Connection
over connections:
ƒ Point‐to‐point, full‐duplex (2‐way communication), and reliable.
Client socket address Server socket address
„ A socket is an endpoint of a connection 128.2.194.242:51213 208.216.181.15:80
ƒ Socket address is an IPaddress:port pair
Server
Client
Connection socket pair (port 80)
„ A port is a 16‐bit integer that identifies a process: (128.2.194.242:51213, 208.216.181.15:80)
ƒ Ephemeral port: Assigned automatically on client when client makes a 
Client host address Server host address
connection request
128.2.194.242  208.216.181.15
ƒ Well‐known port: Associated with some service provided by a server 
(e.g., port 80 is associated with Web servers)
51213 is an ephemeral port  80 is a well‐known port
„ A connection is uniquely identified by the socket addresses  allocated by the kernel  associated with Web servers
of its endpoints (socket pair)
ƒ (cliaddr:cliport, servaddr:servport)

Carnegie Mellon Carnegie Mellon

Naming and Communicating on the Internet  Evolution of Internet: Dynamic IP addresses
(again) „ Dynamic address assignment
ƒ Most hosts don't need to have known address
„ Original Idea ƒ Only those functioning as servers
ƒ Every node on Internet would have unique IP address ƒ DHCP (Dynamic Host Configuration Protocol)
ƒ Everyone would be able to talk directly to everyone ƒ Local ISP assigns address for temporary use
ƒ No secrecy or authentication
ƒ Messages visible to routers and hosts on same LAN
„ Example:
ƒ Possible to forge source field in packet header
ƒ My laptop at CMU
IP address 128.2.220.249 (bryant-tp3.cs.cmu.edu)
ƒ
„ Shortcomings Assigned statically
ƒ
ƒ There aren't enough IP addresses available ƒ My laptop at home
ƒ Don't want everyone to have access or knowledge of all other hosts ƒ IP address 205.201.7.7 (dhcp-7-7.dsl.telerama.com)
ƒ Security issues mandate secrecy & authentication ƒ Assigned dynamically by my ISP for my DSL service
Carnegie Mellon Carnegie Mellon

Evolution of Internet: Firewalls Virtual Private Networks

176.3.3.3
1
10.2.2.2 Firewall 2 10.x.x.x Firewall 10.6.6.6 198.3.3.3
4
3
216.99.99.99
Corporation X Corporation X

Internet Internet
„ Firewalls
ƒ Hides organizations nodes from rest of Internet
„ Supporting road warrior
ƒ Use local IP addresses within organization ƒ Employee working remotely with assigned IP address 198.3.3.3
ƒ For external service, provides proxy service ƒ Wants to appear to rest of corporation as if working internally
ƒ From address 10.6.6.6
1. Client request: src=10.2.2.2, dest=216.99.99.99
ƒ Gives access to internal services (e.g., ability to send mail)
2. Firewall forwards: src=176.3.3.3, dest=216.99.99.99
3. Server responds: src=216.99.99.99, dest=176.3.3.3 „ Virtual Private Network (VPN)
4. Firewall forwards response: src=216.99.99.99, dest=10.2.2.2 ƒ Overlays private network on top of regular Internet

You might also like