WEBVTT
Kind: captions
Language: en

1
00:00:00.000 --> 00:00:06.534
Welcome to lesson six, where we start objective 1.4: common ports and protocols.

2
00:00:06.534 --> 00:00:12.415
Our online store's server has one IP address, but it runs many services,

3
00:00:12.415 --> 00:00:19.766
and port numbers tell it which service each message is for. Today we'll cover ten of them,

4
00:00:19.766 --> 00:00:26.300
from FTP on ports 20 and 21 up to NTP on 123. Lesson seven covers the other ten.

5
00:00:26.700 --> 00:00:33.833
Every TCP or UDP message carries two port numbers. The destination port names the service,

6
00:00:33.833 --> 00:00:41.125
like 80 for a web server. The source port is picked by the client, usually from the dynamic,

7
00:00:41.125 --> 00:00:46.753
or ephemeral, range of 49152 to 65535, so the reply finds its way back.

8
00:00:46.753 --> 00:00:54.679
Servers listen on the well-known, or system, ports, zero to 1023. Ports 1024 to 49151 are registered

9
00:00:54.679 --> 00:00:58.800
ports. An IP address plus a port is called a socket.

10
00:00:59.200 --> 00:01:06.524
FTP, the File Transfer Protocol, uses two TCP connections. The login and commands go over port

11
00:01:06.524 --> 00:01:12.367
21, the control connection, and in active mode the files come over port 20,

12
00:01:12.367 --> 00:01:18.133
the data connection. But FTP sends the username and password in cleartext.

13
00:01:18.133 --> 00:01:24.444
SFTP fixes that. It's a file transfer that runs inside an SSH session on port 22,

14
00:01:24.444 --> 00:01:31.300
so the login and files are encrypted. Don't confuse it with FTPS, which is FTP over TLS.

15
00:01:31.700 --> 00:01:37.404
To manage the store's routers and servers, admins open a remote command line.

16
00:01:37.404 --> 00:01:42.737
Telnet does this on TCP port 23, but everything, including the password,

17
00:01:42.737 --> 00:01:48.219
crosses the network in cleartext, so anyone capturing traffic can read it.

18
00:01:48.219 --> 00:01:55.552
SSH, the Secure Shell, on TCP port 22, does the same job with encryption and strong authentication.

19
00:01:55.552 --> 00:01:59.700
SSH replaces it. Notice that SSH and SFTP share port 22.

20
00:02:00.100 --> 00:02:05.485
When the store emails an order confirmation, its mail server uses SMTP,

21
00:02:05.485 --> 00:02:12.994
the Simple Mail Transfer Protocol, on TCP port 25. SMTP sends and relays mail between mail servers.

22
00:02:12.994 --> 00:02:20.123
The sending server looks up the recipient domain's MX record in DNS, then delivers the message

23
00:02:20.123 --> 00:02:27.176
to that server. Encryption on port 25 is optional, and mail apps submit messages on port 587,

24
00:02:27.176 --> 00:02:29.300
which is in the next lesson.

25
00:02:29.700 --> 00:02:36.055
DNS, the Domain Name System, uses port 53. A browser asks for shop.example.com,

26
00:02:36.055 --> 00:02:42.732
and a DNS resolver answers with the store's IP address. Everyday lookups are small,

27
00:02:42.732 --> 00:02:50.455
so they use UDP. TCP port 53 is used for zone transfers, when one DNS server copies a whole zone

28
00:02:50.455 --> 00:02:58.178
from another, and for responses too large for UDP. So DNS is the classic answer for both TCP and

29
00:02:58.178 --> 00:02:58.978
UDP.

30
00:02:58.900 --> 00:03:05.876
How does a new laptop get an IP address? With DHCP, the Dynamic Host Configuration Protocol,

31
00:03:05.876 --> 00:03:12.777
over UDP. The server listens on port 67, and the client on port 68. It takes four messages,

32
00:03:12.777 --> 00:03:19.450
known as DORA. The laptop broadcasts a Discover, because it doesn't know any server yet.

33
00:03:19.450 --> 00:03:25.214
A server answers with an Offer. The laptop sends a Request for that address,

34
00:03:25.214 --> 00:03:32.493
and the server confirms the lease with an Acknowledgment, along with the default gateway and DNS

35
00:03:32.493 --> 00:03:33.293
servers.

36
00:03:33.500 --> 00:03:40.697
TFTP, the Trivial File Transfer Protocol, uses UDP port 69. It has no login and no encryption.

37
00:03:40.697 --> 00:03:47.818
Network devices use it to load configurations and firmware, and computers use it to boot over

38
00:03:47.818 --> 00:03:54.326
the network with PXE, so keep it on trusted networks. NTP, the Network Time Protocol,

39
00:03:54.326 --> 00:04:01.447
uses UDP port 123 to keep clocks in sync. That matters: logs from different devices only line

40
00:04:01.447 --> 00:04:06.500
up, and certificates and logins only work, when the time is right.

41
00:04:06.900 --> 00:04:14.074
Finally, HTTP, the Hypertext Transfer Protocol, on TCP port 80. It's how browsers request web

42
00:04:14.074 --> 00:04:20.013
pages, but plain HTTP isn't encrypted. Anyone on the path can read the pages,

43
00:04:20.013 --> 00:04:27.418
form data and session cookies, or even change them. That's why our store answers on port 80 only

44
00:04:27.418 --> 00:04:34.900
to redirect visitors to HTTPS on port 443. HTTPS and the remaining ports come in the next lesson.

45
00:04:35.300 --> 00:04:43.703
Here are all ten together, with three patterns to remember. First, only SSH and SFTP are encrypted,

46
00:04:43.703 --> 00:04:49.730
and both use port 22. Telnet, FTP, TFTP and HTTP are cleartext. Second,

47
00:04:49.730 --> 00:04:55.757
DHCP, TFTP and NTP use UDP, DNS uses both, and the rest use TCP. Third,

48
00:04:55.757 --> 00:05:03.906
the pairs: FTP has 20 for data and 21 for control, and DHCP has 67 for the server and 68 for the

49
00:05:03.906 --> 00:05:04.706
client.

50
00:05:04.900 --> 00:05:10.786
Exam questions often describe a need. A secure replacement for Telnet is SSH,

51
00:05:10.786 --> 00:05:17.513
port 22. Encrypted file transfer over SSH is SFTP. Allowing zone transfers needs TCP 53.

52
00:05:17.513 --> 00:05:24.774
Clients that can't get an address point to DHCP, UDP 67 and 68. Log timestamps that don't match

53
00:05:24.774 --> 00:05:30.278
point to NTP, port 123. Loading firmware with no login is TFTP, port 69.

54
00:05:30.278 --> 00:05:34.100
And server-to-server email relay is SMTP, port 25.

55
00:05:34.500 --> 00:05:42.776
To recap: a port number tells a server which service a message is for. SSH and SFTP share port

56
00:05:42.776 --> 00:05:49.467
22 and are encrypted, while Telnet on 23 and FTP on 20 and 21 are cleartext.

57
00:05:49.467 --> 00:05:57.215
SMTP relays mail on 25, DNS resolves names on 53, DHCP hands out addresses on 67 and 68,

58
00:05:57.215 --> 00:06:04.346
TFTP moves files on 69, HTTP serves web pages on 80, and NTP syncs clocks on 123.

59
00:06:04.346 --> 00:06:09.100
Next: HTTPS, SNMP, LDAP, RDP and the rest of the list.
