cs 145a implementation issues netlab.caltech.edu/course
TRANSCRIPT
![Page 1: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/1.jpg)
CS 145ACS 145AImplementation Implementation
IssuesIssuesNetlab.caltech.edu/courseNetlab.caltech.edu/course
![Page 2: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/2.jpg)
Topics of this threadTopics of this thread
How does the TCP/IP work? How does the TCP/IP work? (roughly)(roughly)
(Very) Simple & basic tools on (Very) Simple & basic tools on network engineeringnetwork engineering
Design and implementation of Design and implementation of protocolsprotocols
![Page 3: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/3.jpg)
Mail listsMail lists
CS145class.cs.caltech.eduCS145class.cs.caltech.edu CS145ta.cs.caltech.eduCS145ta.cs.caltech.edu
![Page 4: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/4.jpg)
TodayToday
The topology of InternetThe topology of Internet NamingNaming Packet transmissionPacket transmission Stream ConnectionStream Connection
![Page 5: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/5.jpg)
What does the Internet What does the Internet look like?look like?
Example: (/sbin/traceroute) Example: (/sbin/traceroute) C:\>tracert cwis.usc.eduC:\>tracert cwis.usc.eduTracing route to cwis.usc.edu [128.125.253.146]Tracing route to cwis.usc.edu [128.125.253.146]1 <1 ms Jorgensen-RSM-44.caltech.edu [131.215.44.253]1 <1 ms Jorgensen-RSM-44.caltech.edu [131.215.44.253]2 <1 ms Booth-border.ilan.caltech.edu [131.215.254.254]2 <1 ms Booth-border.ilan.caltech.edu [131.215.254.254]3 <1 ms CalREN-Caltech.caltech.edu [192.41.208.49]3 <1 ms CalREN-Caltech.caltech.edu [192.41.208.49]4 <1 ms JPL--CIT.POS.calren2.net [198.32.248.5]4 <1 ms JPL--CIT.POS.calren2.net [198.32.248.5]5 1 ms UCLA--JPL.POS.calren2.net [198.32.248.1]5 1 ms UCLA--JPL.POS.calren2.net [198.32.248.1]6 1 ms ISI--UCLA.POS.calren2.net [198.32.248.29]6 1 ms ISI--UCLA.POS.calren2.net [198.32.248.29]7 2 ms USC--ISI.POS.calren2.net [198.32.248.25]7 2 ms USC--ISI.POS.calren2.net [198.32.248.25]8 3 ms rtr43-c2-gw.usc.edu [128.125.251.66]8 3 ms rtr43-c2-gw.usc.edu [128.125.251.66]9 2 ms rtr-gw-1.usc.edu [128.125.254.1]9 2 ms rtr-gw-1.usc.edu [128.125.254.1]10 2 ms cwis.usc.edu [128.125.253.146]10 2 ms cwis.usc.edu [128.125.253.146]
![Page 6: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/6.jpg)
Topology of the NetworkTopology of the Network
131.215.44.214
131.215.44.253
131.215.254.254
192.41.
208.49
198.32.
248.5198.32.
248.1198.32.
248.29
198.32.
248.25
128.125.251.66
128.125.253.146
128.125.254.1
![Page 7: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/7.jpg)
Global Network (From Global Network (From Quest)Quest)
![Page 8: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/8.jpg)
Get your “IDs” on-lineGet your “IDs” on-line
Example: (/sbin/ifconfig)Example: (/sbin/ifconfig)C:\>ipconfig –allC:\>ipconfig –allPhysical Address. . . . . . . . . : 00-10-A4-7Physical Address. . . . . . . . . : 00-10-A4-7
9-F0-329-F0-32IP Address. . . . . . . . . . . . : 131.215.44.214IP Address. . . . . . . . . . . . : 131.215.44.214Subnet Mask . . . . . . . . . . . : 255.255.255.Subnet Mask . . . . . . . . . . . : 255.255.255.
00
![Page 9: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/9.jpg)
Use of the IDsUse of the IDs
ApplicationApplication
TCP/UDPTCP/UDP
IPIP
MACMAC
PhysicPhysic
Physical Address00-10-A4-79-F0-32
I P Address131.215.44.214
ARP
Port Number80 / 23 / ...
![Page 10: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/10.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214131.215.44.214
ApplicatioApplicationn
131.215.44.214:131.215.44.214:
Send [MSG] to “128.125.253.146 Send [MSG] to “128.125.253.146 : 5001”: 5001”
UDPUDP
IPIP
MACMAC
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 11: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/11.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214131.215.44.214
ApplicatioApplicationn
131.215.44.214:131.215.44.214:
Send [MSG] to “128.125.253.146 Send [MSG] to “128.125.253.146 : 5001”: 5001”
UDPUDP UDP header + [MSG]UDP header + [MSG]
Send to 128.125.253.146Send to 128.125.253.146
IPIP
MACMAC
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 12: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/12.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214131.215.44.214
ApplicatioApplicationn
131.215.44.214:131.215.44.214:
Send [MSG] to “128.125.253.146 Send [MSG] to “128.125.253.146 : 5001”: 5001”
UDPUDP UDP header + [MSG]UDP header + [MSG]
Send to 128.125.253.146Send to 128.125.253.146
IPIP IP header + UDP header + IP header + UDP header + [MSG][MSG]
Send to 131.215.44.253 (from Send to 131.215.44.253 (from routing table)routing table)
Send to 00:90:6D:E7:D4:00 Send to 00:90:6D:E7:D4:00 (from ARP)(from ARP)
MACMAC
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 13: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/13.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214131.215.44.214
ApplicatioApplicationn
131.215.44.214:131.215.44.214:
Send [MSG] to “128.125.253.146 Send [MSG] to “128.125.253.146 : 5001”: 5001”
UDPUDP UDP header + [MSG]UDP header + [MSG]
Send to 128.125.253.146Send to 128.125.253.146
IPIP IP header + UDP header + IP header + UDP header + [MSG][MSG]
Send to 131.215.44.253 (from Send to 131.215.44.253 (from routing table)routing table)
Send to 00:90:6D:E7:D4:00 Send to 00:90:6D:E7:D4:00 (from ARP)(from ARP)
MACMAC MAC header + IP + UDP + MAC header + IP + UDP + [MSG][MSG]
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 14: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/14.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214131.215.44.214
ApplicatioApplicationn
131.215.44.214:131.215.44.214:
Send [MSG] to “128.125.253.146 Send [MSG] to “128.125.253.146 : 5001”: 5001”
UDPUDP UDP header + [MSG]UDP header + [MSG]
Send to 128.125.253.146Send to 128.125.253.146
IPIP IP header + UDP header + IP header + UDP header + [MSG][MSG]
Send to 131.215.44.253 (from Send to 131.215.44.253 (from routing table)routing table)
Send to 00:90:6D:E7:D4:00 Send to 00:90:6D:E7:D4:00 (from ARP)(from ARP)
MACMAC MAC header + IP + UDP + MAC header + IP + UDP + [MSG][MSG]
PhysicPhysic Send to the EthernetSend to the Ethernet
131.215.44.214
131.215.44.253
131.215.254.254
![Page 15: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/15.jpg)
The Journey of a packet (1)The Journey of a packet (1)131.215.44.214-131.215.44.214->131.215.44.253>131.215.44.253
131.215.44.214
131.215.44.253
131.215.254.254
192.41.
208.49
198.32.
248.5198.32.
248.1198.32.
248.29
198.32.
248.25
128.125.251.66
128.125.253.146
128.125.254.1
![Page 16: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/16.jpg)
The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253
IPIP
MACMAC
PhysicPhysic Get a packet From EthernetGet a packet From Ethernet
It’s for 00:90:6D:E7:D4:00. It’s for 00:90:6D:E7:D4:00.
That’s me. I should accept it.That’s me. I should accept it.
131.215.44.214
131.215.44.253
131.215.254.254
![Page 17: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/17.jpg)
The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253
IPIP
MACMAC ““OK, I am 00:90:6D:E7:D4:00”OK, I am 00:90:6D:E7:D4:00”
Pass the packet to IPPass the packet to IP
PhysicPhysic Get a packet from ethernet for : 00:Get a packet from ethernet for : 00:90:6D:E7:D4:0090:6D:E7:D4:00
131.215.44.214
131.215.44.253
131.215.254.254
![Page 18: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/18.jpg)
The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253
IPIP [IP] Header: [IP] Header:
From 131.215.44.214 to From 131.215.44.214 to “128.125.253.146”“128.125.253.146”
““Should go to next router: Should go to next router: 131.215.254.254”131.215.254.254”
MACMAC ““OK, I am 00:90:6D:E7:D4:00”OK, I am 00:90:6D:E7:D4:00”
Pass the packet to IPPass the packet to IP
PhysicPhysic Get a packet from ethernet for: 00:Get a packet from ethernet for: 00:90:6D:E7:D4:0090:6D:E7:D4:00
131.215.44.214
131.215.44.253
131.215.254.254
![Page 19: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/19.jpg)
The Journey of a packet (2)The Journey of a packet (2) 131.215.44.253 131.215.44.253
IPIP [IP] Header: [IP] Header: From 131.215.44.214 to “128.125.2From 131.215.44.214 to “128.125.2
53.146”53.146”““Should go to next router: 131.215.Should go to next router: 131.215.
254.254”254.254”Send to zz:zz:zz:zz:zz:zz (from ARSend to zz:zz:zz:zz:zz:zz (from AR
P)P)MACMAC
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 20: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/20.jpg)
The Journey of a packet (2)The Journey of a packet (2) 131.215.44.253 131.215.44.253
IPIP [IP] Header: [IP] Header: From 131.215.44.214 to “128.125.2From 131.215.44.214 to “128.125.2
53.146”53.146”““Should go to next router: 131.215.Should go to next router: 131.215.
254.254”254.254”Send to zz:zz:zz:zz:zz:zz (from ARSend to zz:zz:zz:zz:zz:zz (from AR
P)P)MACMAC MAC header + IP + UDP + MAC header + IP + UDP +
[MSG][MSG]
PhysicPhysic
131.215.44.214
131.215.44.253
131.215.254.254
![Page 21: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/21.jpg)
The Journey of a packet (2)The Journey of a packet (2) 131.215.44.253 131.215.44.253
IPIP [IP] Header: [IP] Header: From 131.215.44.214 to “128.125.2From 131.215.44.214 to “128.125.2
53.146”53.146”““Should go to next router: 131.215.Should go to next router: 131.215.
254.254”254.254”Send to zz:zz:zz:zz:zz:zz (from ARSend to zz:zz:zz:zz:zz:zz (from AR
P)P)MACMAC MAC header + IP + UDP + MAC header + IP + UDP +
[MSG][MSG]
PhysicPhysic Send to zz:zz:zz:zz:zz:zzSend to zz:zz:zz:zz:zz:zz
131.215.44.214
131.215.44.253
131.215.254.254
![Page 22: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/22.jpg)
The Journey of a packet (2)The Journey of a packet (2)131.215.44.253-131.215.44.253-
>131.215.254.254>131.215.254.254131.215.44.214
131.215.44.253
131.215.254.254
192.41.
208.49
198.32.
248.5198.32.
248.1198.32.
248.29
198.32.
248.25
128.125.251.66
128.125.253.146
128.125.254.1
![Page 23: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/23.jpg)
The Journey of a packet (n) The Journey of a packet (n) 128.125.254.1-128.125.254.1-
>128.125.253.146>128.125.253.146131.215.44.214
131.215.44.253
131.215.254.254
192.41.
208.49
198.32.
248.5198.32.
248.1198.32.
248.29
198.32.
248.25
128.125.251.66
128.125.253.146
128.125.254.1
![Page 24: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/24.jpg)
The Journey of a packet (n)The Journey of a packet (n) 128.125.253.146 128.125.253.146
ApplicatiApplicationon
““I want to receive something on port 5I want to receive something on port 5001”001”
UDPUDP Listening to the port 5001Listening to the port 5001
IPIP
MACMAC
PhysicPhysic
![Page 25: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/25.jpg)
The Journey of a packet (n)The Journey of a packet (n) 128.125.253.146 128.125.253.146
ApplicatiApplicationon
UDPUDP Listening to the Port 5001Listening to the Port 5001
IPIP
MACMAC
PhysicPhysic Get a packet from ethernetGet a packet from ethernetfor yy:yy:yy:yy:yy:yyfor yy:yy:yy:yy:yy:yy
![Page 26: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/26.jpg)
The Journey of a packet (n)The Journey of a packet (n) 128.125.253.146 128.125.253.146
ApplicatiApplicationon
UDPUDP Listening to the Port 5001Listening to the Port 5001
IPIP
MACMAC ““Yes, I am yy:yy:yy:yy:yy:yy”Yes, I am yy:yy:yy:yy:yy:yy”Pass the packet to IPPass the packet to IP
PhysicPhysic Get a packet From ethernet forGet a packet From ethernet foryy:yy:yy:yy:yy:yyyy:yy:yy:yy:yy:yy
![Page 27: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/27.jpg)
The Journey of a packet (n)The Journey of a packet (n) 128.125.253.146 128.125.253.146
ApplicatiApplicationon
UDPUDP Listening to port 5001Listening to port 5001
IPIP From 131.215.44.214 to From 131.215.44.214 to 128.125.253.146:5001128.125.253.146:5001
““Yes, I am 128.125.253.146. ”Yes, I am 128.125.253.146. ”
““Is there any program listening to Is there any program listening to this port?”this port?”
““Yes. One UDP is waiting. Pass it to Yes. One UDP is waiting. Pass it to UDP”UDP”
MACMAC ““Yes, I am yy:yy:yy:yy:yy:yy”Yes, I am yy:yy:yy:yy:yy:yy”Pass the packet to IPPass the packet to IP
PhysicPhysic Get a packet From ethernet forGet a packet From ethernet foryy:yy:yy:yy:yy:yyyy:yy:yy:yy:yy:yy
![Page 28: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/28.jpg)
The Journey of a packet (n)The Journey of a packet (n) 128.125.253.146 128.125.253.146
ApplicatiApplicationon
Receive message from Receive message from 131.215.44.214131.215.44.214
UDPUDP Pass to ApplicationPass to Application
IPIP From 131.215.44.214 to From 131.215.44.214 to 128.125.253.146128.125.253.146
““Yes, I am 128.125.253.146. ”Yes, I am 128.125.253.146. ”
““Is there any program waiting for it?”Is there any program waiting for it?”
““Yes. One application is waiting. Pass Yes. One application is waiting. Pass it to UDP”it to UDP”
MACMAC ““Yes, I am yy:yy:yy:yy:yy:yy”Yes, I am yy:yy:yy:yy:yy:yy”Pass the packet to IPPass the packet to IP
PhysicPhysic Get a packet From EthernetGet a packet From EthernetFor yy:yy:yy:yy:yy:yyFor yy:yy:yy:yy:yy:yy
![Page 29: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/29.jpg)
OverviewOverview
DirectLink
NetCardDriver
TCP 1
I P
TCP 2 UDP 1 UDP 2
NetCardDriver
TCP 1
I P
UDP 1
Directlink
NetCardDriver
NetCardDriver
TCP 1
I P
TCP 2 UDP 1 UDP 2
![Page 30: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/30.jpg)
Necessary Information Necessary Information (1)(1)
Where shall I pass the packet, for a given Where shall I pass the packet, for a given destination IP address? – Routing Tabledestination IP address? – Routing Table
Exmaple:Exmaple:[weixl@orchestra:~]> route[weixl@orchestra:~]> route
DestinatiDestinationon
GatewayGateway Gen-maskGen-mask FlaFlagsgs
InterfaInterfacece
131.215.131.215.44.044.0
** 255.255.2255.255.255.055.0
UU Eth0Eth0
127.0.0.0 127.0.0.0 ** 255.0.0.0255.0.0.0 UU lolo
default default 131.215.44131.215.44.254.254
0.0.0.00.0.0.0 UFUF Eth0Eth0
![Page 31: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/31.jpg)
Necessary Information Necessary Information (2)(2)
Where shall I pass the packet, for a given Where shall I pass the packet, for a given destination IP address? -- Arpdestination IP address? -- Arp
Exmaple:Exmaple:[weixl@orchestra:~]> arp -a[weixl@orchestra:~]> arp -a131.215.44.227 at 00:06:5B:DE:C5:72 on eth0131.215.44.227 at 00:06:5B:DE:C5:72 on eth0131.215.44.142 at 00:60:B0:7C:E8:02 on eth0131.215.44.142 at 00:60:B0:7C:E8:02 on eth0131.215.44.113 at 00:A0:C9:5A:26:6D on eth0131.215.44.113 at 00:A0:C9:5A:26:6D on eth0131.215.44.80 at 00:E0:81:02:7F:7B on eth0131.215.44.80 at 00:E0:81:02:7F:7B on eth0131.215.44.254 at 00:00:0C:07:AC:01 on eth0131.215.44.254 at 00:00:0C:07:AC:01 on eth0131.215.44.253 at 00:90:6D:E7:D4:00 on eth0131.215.44.253 at 00:90:6D:E7:D4:00 on eth0131.215.44.12 at 00:20:78:1B:13:2C on eth0131.215.44.12 at 00:20:78:1B:13:2C on eth0131.215.44.14 at 00:A0:C9:06:2F:2A on eth0131.215.44.14 at 00:A0:C9:06:2F:2A on eth0
![Page 32: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/32.jpg)
More Information More Information (Bonus)(Bonus)
Get your phone book (Domain Name ServicGet your phone book (Domain Name Service).e).
Example:Example:[weixl@orchestra:~]> ping login.cs.caltech.e[weixl@orchestra:~]> ping login.cs.caltech.e
duduPING orchestra.cs.caltech.edu (131.215.44.2PING orchestra.cs.caltech.edu (131.215.44.2
0) from 131.215.44.20 : 56(84) bytes of data.0) from 131.215.44.20 : 56(84) bytes of data.[weixl@orchestra:~]> freebsd-login.cs.caltec[weixl@orchestra:~]> freebsd-login.cs.caltec
h.edu (131.215.44.14)h.edu (131.215.44.14) API:API:gethostbyname()gethostbyname()
![Page 33: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/33.jpg)
How does DNS work?How does DNS work?
www.mit.eduwww.mit.edu??
18.181.0.3118.181.0.31
131.215.44.214
www.mit.edu?
131.215.44.113
131.215.44.227
HigherDNS
Server
![Page 34: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/34.jpg)
ConnectionConnection
![Page 35: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/35.jpg)
Streamless ConnectionStreamless ConnectionApplicationApplication Socket_send/receiveSocket_send/receive
DNSDNSUDPUDP UDP send/receiveUDP send/receive
IPIP Routing (IP / ARP)Routing (IP / ARP)
MACMAC Ethernet or other Ethernet or other LANLAN
PhysicPhysic Electronic/Optical Electronic/Optical signalssignals
![Page 36: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/36.jpg)
Stream ConnectionStream Connection
ApplicationApplication Socket_send/receiveSocket_send/receiveDNSDNS
TCPTCP How to How to establish/maintain a establish/maintain a
connection?connection?
IPIP Routing (IP / ARP)Routing (IP / ARP)
MACMAC Ethernet/Token RingEthernet/Token Ring or other direct linksor other direct links
PhysicPhysic Electronic/Optical Electronic/Optical signalssignals
![Page 37: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/37.jpg)
Stream ConnectionStream Connection
An Example: At: 1-626-395-3555 An Example: At: 1-626-395-3555 Call: DMVCall: DMV
Prerequisite: Prerequisite: You know the number of DMV (1-You know the number of DMV (1-
800-777-0133)800-777-0133) The service is now open at DMV.The service is now open at DMV. There is a link between the two There is a link between the two
phones.phones.
![Page 38: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/38.jpg)
Stream ConnectionStream Connection
Steps at your site:Steps at your site:• Establish the phoneEstablish the phone• Dial the numberDial the number• Select the serviceSelect the service• TalkTalk• Hang upHang up
Steps at DMV:Steps at DMV:• Establish the phone Establish the phone • Establish the service on Establish the service on
phonephone• Accept your requestAccept your request• TalkTalk• Hang UpHang Up
An Example: At: 1-626-395-3555 Call: DMVAn Example: At: 1-626-395-3555 Call: DMV
![Page 39: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/39.jpg)
Stream ConnectionStream Connection
Steps at DMV:Steps at DMV:• Establish the phoneEstablish the phone• Establish the service on Establish the service on
phonephone• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
Steps at your site:Steps at your site:• Establish the phoneEstablish the phone• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
![Page 40: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/40.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Establish the serviceEstablish the service• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
Steps at DMV:Steps at DMV:• Establish the phoneEstablish the phone• Establish the service on Establish the service on
phonephone• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
Steps at your site:Steps at your site:• Establish the phoneEstablish the phone• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
![Page 41: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/41.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• BindBind socket to port socket to port & &
ListenListen• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
Steps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Establish the service on Establish the service on
phonephone• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
![Page 42: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/42.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
Steps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• Dial the numberDial the number• Select the serviceSelect the service• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
![Page 43: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/43.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• TalkTalk• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• AcceptAccept the request from the request from
clientclient• Talk to youTalk to you• Hang UpHang Up
Steps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• Talk to the Talk to the
representativerepresentative• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• Accept your requestAccept your request• Talk to youTalk to you• Hang UpHang Up
![Page 44: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/44.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• Send/Receive DataSend/Receive Data• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• AcceptAccept the request from the request from
clientclient• Send/Receive DataSend/Receive Data• Hang UpHang Up
Steps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• TalkTalk• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• AcceptAccept the request from the request from
clientclient• Talk to youTalk to you• Hang UpHang Up
![Page 45: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/45.jpg)
Stream ConnectionStream ConnectionSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• Send/Receive DataSend/Receive Data• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• AcceptAccept the request from the request from
clientclient• Send/Receive DataSend/Receive Data• Hang UpHang Up
Steps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• connectconnect the address ( the address ( IPIP
+ + port port ))• Send/Receive DataSend/Receive Data• Hang upHang up
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a port & port &
ListenListen• AcceptAccept the request from the request from
clientclient• Send/Receive DataSend/Receive Data• Hang UpHang Up
![Page 46: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/46.jpg)
InsightInsight (from
LinuxFo (from
LinuxForum
)rum
)
![Page 47: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/47.jpg)
CS 145A Lab 1CS 145A Lab 1ConnectionConnection
Netlab.caltech.edu/courseNetlab.caltech.edu/course
![Page 48: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/48.jpg)
How to establish a How to establish a connection?connection?
UDPUDPSteps at Steps at client’sclient’s site: site:• Establish the Establish the socketsocket• Send Data to Send Data to the the
address ( address ( IPIP
+ + port port ))• Close the socketClose the socket
Steps at Steps at server’s server’s site:site:• Establish the Establish the socketsocket• Bind socket to a Bind socket to a portport• Receive DataReceive Data• Close the socketClose the socket
![Page 49: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/49.jpg)
How to establish a How to establish a connection?connection?
TCPTCPSteps at Steps at client’sclient’s site: site:• Establish the socketEstablish the socket• connect the address connect the address
( IP( IP
+ port )+ port )• Send/Receive DataSend/Receive Data• Close the socketClose the socket
Steps at Steps at server’s server’s site:site:• Establish the socketEstablish the socket• Bind socket to a port & Bind socket to a port &
ListenListen• Accept the request from Accept the request from
client and client and create a new create a new socket for socket for communicationcommunication
• Send/Receive Data Send/Receive Data on on the new socketthe new socket
• Close the socketClose the socket
![Page 50: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/50.jpg)
Tasks for Lab 1Tasks for Lab 1
Be familiar with the basic commands tBe familiar with the basic commands that we talked about in class (see those hat we talked about in class (see those examples in the lecture).examples in the lecture).
Write a program (“server”) that can Write a program (“server”) that can act as a Serveract as a Server
Write a program (“udp client”) that cWrite a program (“udp client”) that can send UDP packetsan send UDP packets
Write a program (“tcp client”) that cWrite a program (“tcp client”) that can send TCP packetsan send TCP packets
![Page 51: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/51.jpg)
ServerServer accept TCP connections in one portaccept TCP connections in one port The server should “talk” with the clients. The server should “talk” with the clients.
That is, the server return the same That is, the server return the same contents as the client sends to it. If the contents as the client sends to it. If the client does not send anything in 10 client does not send anything in 10 seconds, the server should actively seconds, the server should actively disconnect the connection. disconnect the connection.
The server is able to “talk” with 5 The server is able to “talk” with 5 different clients at the same time. The different clients at the same time. The server should not keep more than 5 server should not keep more than 5 clients at the same time.clients at the same time.
![Page 52: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/52.jpg)
Server Server
accept UDP packets in one port (may accept UDP packets in one port (may be different from the TCP) be different from the TCP)
The server should talk to the clients.The server should talk to the clients.
The input format:The input format:Server <port 1> <port2>Server <port 1> <port2>(port 1 is for TCP, port2 is for UDP)(port 1 is for TCP, port2 is for UDP)
![Page 53: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/53.jpg)
Tcp clientTcp client send a message to the server, wait for ssend a message to the server, wait for s
everal seconds, then disconnect.everal seconds, then disconnect.Input format:Input format:tcpclient <host> <port> <message> <timtcpclient <host> <port> <message> <tim
e>e><time> is a number indicating the <time> is a number indicating the
seconds the client should wait before dseconds the client should wait before disconnection.isconnection.
![Page 54: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/54.jpg)
Udp clientUdp client send a message to the serversend a message to the server
Input format:Input format:udpclient <host> <port> <message>udpclient <host> <port> <message>
![Page 55: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/55.jpg)
TipsTips For the unknown commands, use For the unknown commands, use
“man”/ “info”/Richard Stevens’ book“man”/ “info”/Richard Stevens’ book Testing: you can use “telnet” to test Testing: you can use “telnet” to test
the server, use the server to test the the server, use the server to test the clients. clients.
How to implement the “disconnection How to implement the “disconnection after 10-sec?”after 10-sec?”
1.1. Child-processChild-process2.2. ““select”select”3.3. ……
![Page 56: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/56.jpg)
Submission (due Submission (due Oct Oct 1818thth))
Task 1: route.txt arp.txt ifconfig.txt traceroute.txtTask 1: route.txt arp.txt ifconfig.txt traceroute.txtTask 2: server.c; server.txtTask 2: server.c; server.txtTask 3: udpclient.c; udpclient.txtTask 3: udpclient.c; udpclient.txtTask 4: tcpclient.c; tcpclient.txtTask 4: tcpclient.c; tcpclient.txtMailto: Mailto: [email protected]@cs.caltech.edu (Do NOT send to (Do NOT send to [email protected]@cs.caltech.edu ) )Documents:Documents: How to use the program: compile, run… How to use the program: compile, run… Your design, your testing, the problems you mYour design, your testing, the problems you m
etet Any other commentsAny other comments
![Page 57: CS 145A Implementation Issues Netlab.caltech.edu/course](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f315503460f94c4c4ea/html5/thumbnails/57.jpg)
GradingGrading
Correctness (70%) Correctness (70%) Documentation and comments (20%)Documentation and comments (20%) Program style (10%)Program style (10%)
TA HoursTA Hours
Tue: 20:00 ~22:00 JRG 154 / 170Tue: 20:00 ~22:00 JRG 154 / 170 Thu: 20:00 ~22:00 JRG 154 / 170Thu: 20:00 ~22:00 JRG 154 / 170