1 00:00:00,005 --> 00:00:03,005 - [Instructor] Layer 4 of the OSI model, transport, 2 00:00:03,005 --> 00:00:06,006 uses a 16-bit number, known as a port, 3 00:00:06,006 --> 00:00:09,004 to facilitate endpoint communication. 4 00:00:09,004 --> 00:00:14,003 TCP and UDP both open lines of communication using ports. 5 00:00:14,003 --> 00:00:16,002 Applications will open up a port 6 00:00:16,002 --> 00:00:18,008 and wait for an incoming connection. 7 00:00:18,008 --> 00:00:21,009 This is also referred to as listening. 8 00:00:21,009 --> 00:00:23,004 For well-known applications, 9 00:00:23,004 --> 00:00:25,003 these will be well-known port numbers 10 00:00:25,003 --> 00:00:30,007 like port 80 for HTTP and 443 for HTTPS. 11 00:00:30,007 --> 00:00:32,003 Once the client application 12 00:00:32,003 --> 00:00:34,001 connects to the well-known ports, 13 00:00:34,001 --> 00:00:36,002 the server will sometimes shift the client 14 00:00:36,002 --> 00:00:39,003 to a different port to complete the transaction. 15 00:00:39,003 --> 00:00:43,003 Well-known ports are generally less than 1024. 16 00:00:43,003 --> 00:00:47,000 Ephemeral ports are those above 1024 and are usually used 17 00:00:47,000 --> 00:00:50,002 for short-term communications by clients. 18 00:00:50,002 --> 00:00:52,006 Whenever a packet is created and sent, 19 00:00:52,006 --> 00:00:54,004 the header in that packet will specify 20 00:00:54,004 --> 00:00:57,002 both a source and destination port. 21 00:00:57,002 --> 00:00:59,003 Since the port number is 16-bit, 22 00:00:59,003 --> 00:01:03,005 it can be zero to 65,535. 23 00:01:03,005 --> 00:01:06,008 TCP can't use port zero as it's reserved. 24 00:01:06,008 --> 00:01:09,004 With UDP, the source port number is optional 25 00:01:09,004 --> 00:01:12,008 and a value of zero means no port is used. 26 00:01:12,008 --> 00:01:16,005 An internet socket is created using a transport protocol, 27 00:01:16,005 --> 00:01:19,000 a port number, and an IP address. 28 00:01:19,000 --> 00:01:22,001 This process is known as binding. 29 00:01:22,001 --> 00:01:24,007 Per host, only a single binding is allowed 30 00:01:24,007 --> 00:01:27,001 on a port and IP combination. 31 00:01:27,001 --> 00:01:29,007 Otherwise, conflicts can occur. 32 00:01:29,007 --> 00:01:32,007 When troubleshooting server software that won't start, 33 00:01:32,007 --> 00:01:37,000 an admin may run into the port already in use issue. 34 00:01:37,000 --> 00:01:39,001 This generally stems from another instance 35 00:01:39,001 --> 00:01:40,009 of the software already running 36 00:01:40,009 --> 00:01:44,008 or perhaps another application consuming the same port. 37 00:01:44,008 --> 00:01:48,001 It's not only end hosts and servers that use ports. 38 00:01:48,001 --> 00:01:52,002 Firewalls, routers, and switches also examine port numbers. 39 00:01:52,002 --> 00:01:54,007 Firewalls use port numbers to allow connections 40 00:01:54,007 --> 00:01:56,008 through to various services. 41 00:01:56,008 --> 00:01:58,007 They also use these port numbers 42 00:01:58,007 --> 00:02:01,006 to recognize what types of traffic to expect 43 00:02:01,006 --> 00:02:03,007 and can do additional packet scrutiny 44 00:02:03,007 --> 00:02:05,006 to ensure they conform. 45 00:02:05,006 --> 00:02:08,002 Routers and switches can also use port numbers 46 00:02:08,002 --> 00:02:10,001 for quality of service. 47 00:02:10,001 --> 00:02:11,009 They can use these port designations 48 00:02:11,009 --> 00:02:13,009 to identify certain types of traffic 49 00:02:13,009 --> 00:02:17,000 and elevate their priority as they move through the network. 50 00:02:17,000 --> 00:02:20,003 This can, for example, ensure that VoIP traffic 51 00:02:20,003 --> 00:02:22,009 has a higher priority than web surfing. 52 00:02:22,009 --> 00:02:25,000 Ports are integral to the network 53 00:02:25,000 --> 00:02:27,000 and server's functionality.