IT Fundamentals Course – Hardware, Cloud, DevOps, Networking, Security, Databases, DNS, Git, Linux
💬 Chat with this Video
Ask anything about this video…
⏱ Full Transcript — click any timestamp to jump
This course will provide you the essential high-level foundation needed to navigate the modern IT landscape. You will explore a broad range of important topics including networking, IP addressing, DevOps, and site reliability engineering. Asa teaches this course. He is a certified Cisco and AWS instructor. After you learn about basic hardware components, you'll gain hands-on practice within the AWS cloud environment. You'll learn to design, build, and secure virtual data centers while gaining real-world experience with tools like Docker and Kubernetes. Are you aspiring a career in IT? Or maybe you are in IT, a developer for example, but would like to get into cloud and other specialties within the IT, but you are unable to because you lack some fundamentals that are essential. Whether this or that, this course is for you. The course will help you navigate a plethora of different areas in IT at a high level, but will make you understand what are these four and how to work with them. This includes networking, IP addressing, TCP IP, what is DevOps, what is site reliability engineering, what's platform engineering, network and network security, and other stuff as well. My name is Asa Abu Sheriff and I have been in the IT industry for close to three decades right now. I am a certified Cisco instructor and I'm certified AWS instructor as well. And I have been developing career programs to help people like yourself start or upskill into the modern IT roles. While coaching and mentoring a lot of our students, I have noticed that there's always a weakness in the fundamentals. And the first advice anyone would give you for the fundamentals would be take A+, take Network+, take CCNA, and then take MCSA, the Microsoft server administration, and that would be an absolute must. And you spend 6 to 12 months doing that, and you spend a lot of money as well for the certifications, but that is all unnecessary in the modern IT. If you are starting your journey, in my opinion, there has to be three main things that need to be there in any content that you are going to use. Number one, it's going to take you from point A to point B very quickly without fluff. Number two, it should minimize the effort and should minimize the cost as well for you to get into that area or that specific topic. Number three, it should not overwhelm you because that is your first step, and this should be easy to navigate. With a little bit of effort and sweat, and with a fresh mind, you should be able to navigate and break through that and be ready to the next steps. The unique thing about this course is that it blends a lot of things together in one course. It starts from where what is a computer, what is a hardware device, what is a memory, what's a CPU, what's a GPU, what is a network interface card, and then it explains to you what's a PC, what's a server. >> [snorts] >> And then it takes you from there, okay, so why do we use the server? What's the difference between server and the PC? And then takes you into virtualization. Why do we need to use virtualization? Why do we need to have a physical server and then we start splitting or splicing and dicing that in a virtual manner. Then it talks about data centers, and data centers from there it takes you to the cloud, cloud computing. It explains to you the networking devices, routers and switches, cables, types of cables, and speeds. And then it shows you how you can build a network in your home, or what are the components of a network in an office, or maybe in a campus, university, or or school. Takes you from there to explain to you what is IP addressing, why do we need it. And then how do we actually design a network if we are given a block of IP addresses? What are the differences between public and private IP addresses? And then takes you from there in a scaffolding approach and explains to you what can you do with that in a cloud era? How can you build a network in the cloud, virtual data center, VPC? How can you secure it using security groups and network ACLs? So it takes you through network security as well. And from there we delve into practicing on the AWS cloud. So you're not going to build any Cisco routers or any emulation softwares. This is going to be logging into the cloud yourself, creating an account, getting a hundred dollars free credit that you can use to learn throughout the course without paying any penny, and then we'll teach you how to use the cloud. So you're not only learning fundamentals, you're actually learning and touching the cloud as well in the meantime. Then it will give you a feel of the networking in the cloud and also the network security in the cloud. And it doesn't leave you there, but it then explains to you what is DevOps, the development and operation practice that is used for automating software development, and how did that evolve into site reliability engineering and from there on to platform engineering. So you will understand what a network engineer would do, what a cloud engineer would do, and what a DevOps engineer would do, what a site reliability engineer would do, what a DevSecOps specialist would do, what a cloud security specialist would do, all of that. You will understand it as you go. The beautiful thing is you don't have to commit to any career before taking the course. So you're not going to end up a technical support specialist or a network associate or network junior engineer. You're not going to do that. You will go through the course, you will understand and touch and feel a lot of things, and then you can decide if you would like to take it further or if you would like to do something else. If you are a developer struggling with IP addressing and network concepts and network security and cloud and stuff like that, this course is also for you. This course wouldn't be possible without people like you watching it. And if you would like to support more free content like this at the same quality or maybe better, the best way to do that is to consider buying the supplemental material for this course, and you can get that at www.dolphinet.com/courses/itf-course, the IT fundamentals course. You will get free lifetime access to any updates of the course. So any modules that are added, AI, machine learning, ML ops, and so on, are going to be included. You will get also quizzes for the course, and you will get assignments with recorded video answers. So you will pause the video, look at the assignment, understand the requirements, do it, and then come back to watch the video and verify whether you have done it right or not. Also PDF student guide, the entire slides of the course. You will be getting getting also a support channel for question and answers when you get stuck. And you are going to have a career coaching session recorded as well that will guide you at the end of the course as to which career path you should take and what exactly you should learn as next steps. Also you will get an IT primer for a lot of the tools that are used in modern IT like Git, GitHub, Linux, Docker, Kubernetes, Terraform, bash scripting, and more, which will help you understand what are these tools as you cruise through a road map in order to study these, and the road maps are going to be explained in the career coaching as well. So thank you very much for watching, and now it's time to get into the course. All right, let's go ahead and start with module one, which is the important IT concepts. In this module, we are going to introduce terms that you are going to face or you are going to come across frequently when you are working with IT. And these terms are hardware and software. What's the difference? What is hardware? What is software? And do we have different types of software or is it just one software? And for the hardware, does it apply to our phones or tablets or servers or iPads? What does it apply to? So in this module, we are going to look at multiple lectures, and they are going to cover the computing device hardware components, the common components in computing devices that we come across. Then we are going to look at what is software. If we have discussed hardware, let's go ahead and discuss software and what are the types of software that we'll come across. And that will take us to talking about operating systems and applications as well. So let's go ahead and start with our first lecture. So let's discuss now the computing devices hardware components. Before we jump into that, let's define what are computing devices. Computing devices are devices that we use in our daily life including mobile phones, including laptops, whether they are Windows or Mac or Linux, including iPads, and it includes as well tablets, desktop PCs, digital cameras, IP TV set-top boxes, smart TVs, servers, and more. So what are the common components, hardware components to be more specific for these computing devices? We are going to discuss five important components that relate to IT in general, and it's important to understand them at the beginning of IT. So let's start with what is a CPU, the central processing unit. Your phone, your tablet, my laptop, your smart TV, all of them they have a CPU. Even the smart fridges and all that they have a CPU. So, the CPU is the central processing unit. Basically, this is the mediator between the applications and software and programs that run on that computing device and the hardware components of the computing device. Now, we are going to discuss the CPU as the first one in the hardware components. And basically, it is involved in all the operation that happen on that computing device. All right. Let's say you are holding your iPhone and now you are going to open Chrome, the browser, or Firefox, or Safari. Where would that program run? And that will be the random access memory. So, the second component or hardware component it is called the RAM. And the RAM is used to run all software that runs in your computing device. The third one we look at is okay, fine. Once upon a time, I was filming some videos and I took some photos while we were on a trip in a cruise and then my phone died. The battery ran out and when I went home and I charged or recharged my phone, I found that I still have all the videos and all the pictures that I have taken. Was that because of RAM, the memory? And the answer is no. When you run the camera program in order to take the videos and the pictures, this program ran into the RAM. But when you take pictures and all that, they are saved on a persistent or a permanent storage location in your device. And that is called the disk drives or the storage drives available on your phone or on your tablet or on your laptop. And they could be of two types. The older ones are called HDD, hard disk drives, and these are older storage types, slower storage types as well. Or they could be solid state drives, SSDs, and these ones are more modern and they are faster, but they are more expensive as well. So, this is used, the storage, to provide persistent storage. Basically, a storage that is not related to whether your device is turned on or off and whether it has power or it doesn't have power. This is what persistent storage means. That means as long as the device is not defective, you will be able to retrieve the data that you store on these drives. Then we come into the fourth component, the hardware component. And why do we call it hardware? Because we can touch it, we can feel it. If we open the device, we can see it. If you open your laptop, you can identify where is the CPU, where is the memory, where is the storage and and so on. That's why it's called hardware. Hard, something you can touch or see or feel. Then we talk about network interface cards and this is how your devices interact with the surrounding, basically, with the outside world. That's how your iPhone connects to the Wi-Fi and then to the internet. That's how my laptop connects to the Wi-Fi at home and then I can print on my printer or I can connect to the internet or maybe log in to the corporate network. So, these are called network interface cards and they could be wired interface cards or they could be wireless interface cards. Of course, this image is kind of old because it used to be like that, but now it has been integrated within the phone electronics and within the laptop electronics that you don't see it. But it does exist because you can turn on and off the Wi-Fi and you can connect to Wi-Fi networks. So, that connects the computing device to the outside world and it can be wireless, WLAN or Wi-Fi, and it can be wired as well. Then we talk about monitors. In your phone, when you look at the display, that's your monitor. On your laptop, when you look at the screen, that's your monitor. And so on and so forth. TV, when you run your TV, you look at the TV itself, which is the big display or the big monitor. So, this is to read or view the desired data from the device. And monitors can be built into the device like phones or they could be external to it. We still see desktops in offices and all that where they have the compute device itself, but then you have it's connected by cables into a an external monitor. Last but not least is what accelerates graphics. When you are playing games, whether it is FIFA or Call of Duty or whatever the game that you are playing, then the graphics needs to be fast because the game is all about graphics, right? When you are playing movies or when you are rendering videos, you you need to have acceleration for the graphics as well and for the video and so on. And this is where the GPUs or the the graphic processing unit or the G CPUs come into play and they could be built into the device or they could be cards that connect to the device. So, there are other components, hardware components, like the power supply, the the USB ports and so on, the fans and so on. But these are not of relevance now to our career in IT. We can read about this later on if required, but for now and for our discussion and getting into the cloud and DevOps and programming and all that, you don't need to talk about power supplies and fans and USB ports and all that stuff. So, this we are going to exclude from our discussion for now. Okay, great. Now, how can I measure the CPU? Is it by kilograms or pounds or centimeters or meters or yards? How can I identify the strength or the power in the CPU or in the memory or in the storage and so on? And these components, they have units. So, for example, the CPU is measured by speed and the speed is measured in gigahertz. So, the more the number next to gigahertz, 2 gig, 3 gig, 4 gig, the the faster and the more modern the CPU would be. So, if you talk about 1.6 gigahertz, 2.3 gigahertz as examples. Then, when it comes to the memory and the storage, they are measured in what we call gigabytes or gibibytes. And if it is large, 1,000 gigabytes is terabytes or tebibytes. So, for example, if you talk about an SSD drive, the size is 10 terabytes, this is a good size storage device. Network interface card, it's all about the speed. How fast it can transfer data to the outside world and receive data from the outside world. And that's why it's measured by how many bits or bytes per second I can transfer. And the higher the number, the the faster the network interface card is. So, for example, 100 gigabits per second card or NIC card. All right. So, now we understand the hardware. How can we use it? So, if I get the phone, do I just need the hardware? Do I When I get the iPad, do I just need the hardware? When I push the on or the power on button, then I start to see stuff and, you know, like there's there there could be graphics, there could be text, there could be paragraphs, there could be licensing information. It all starts to show up. Where is this coming from? And to use the hardware, we need software. And that will lead us into the next discussion, which is software, software types, and so on. Let's talk about software in general and about operating systems. So, what is software? Anything that is not hardware. We said the hardware is something you can touch, you can feel, or you can see at least. So, software is something the programmers or the developers are going to write in a specific computer language in order to provide instructions that will tell the computer, the CPU, and so on, what to do exactly. For example, I have a software that I installed. It's about Uber. And for Uber, I need to reserve or book a ride, right? There has to be software commands, programming that has been done in that Uber application in order when I try to define where my location is and where I'm I'm going to and what type of a ride I'm looking for. And it is the invisible part that you don't see and you can't feel, but you can use it. If we talk about applications, Uber or else, games, operating systems, websites, all are software and these are all examples. So, now it is the time to dive deeper and find what are the types of software that you are going to interface or act upon when we are in IT. And that will take us to the first type, the system software or the operating systems. So, the operating system on a computing device is the system software. For example, you have a laptop that has Windows on it. So, what is your operating system? It is Microsoft Windows. I have a laptop that is Mac OS. What is my operating system on my laptop, on my computing device? It is Mac OS. You have an iPhone. What's the operating system on the iPhone? It's iOS. I have an I Android phone, a Samsung phone. Then what is the operating system? Android. So, that is what the system software is. So, the system software will manage the hardware resources or the hardware components of the computing device it is installed on. So, the operating system is responsible for running the installed applications and coordinating that with the hardware. So, whatever the application is supposed to do, it needs to run some instructions, it needs to output something through the Wi-Fi to go to the internet, to Uber, to Uber the right, so it will facilitate that to happen and it will handle the files and permissions. Let's say I have saved a video on my laptop, but I don't want you to see it. So, I'm going to put access permissions on that file where only my username on the laptop will be able to use it. So, even if my wife or one of my friends tries to use my laptop, they will not be able to get to that. The operating system is the part on your phone where you can add your face recognition and then if someone else puts the camera in front of their face, it will say that there's no match or the fingerprint or the password. And the operating system will provide you a user interface and that could be a graphical user interface. Like for example, as you can see on the screen, I have the launchpad where I can click on a lot of programs that I have on my Mac MacBook and then it can start. So, for example, I can click on FaceTime and then FaceTime will start. I have multiple screens, so it started on a different screen, but here you go. All right, so this is called a graphical user interface, something you can interact with using your mouse and maybe some clicks or maybe if it is a touch screen, you can touch on the screen on your iPhone and that's it. So, that is a graphical user interface. So, what about the CLI? Here's an example of a CLI. So, this is a terminal program that we have in macOS and you have something similar on your Windows device if you are using Windows called CMD. So, if you go to the search bar and you type CMD then a black window is going to open and then you will be faced also with a cursor like that that is flickering or flashing and you can type commands. So, for example, here I can type make directory IT foundation. And if I do CD IT foundation I have created a folder somewhere to store files into my operating system and that is called ITF and it exists under the path downloads on my user, which is Dolphin net. So, this is dealing with computers using or with computer computing devices using CLI command line interface. So, here if I type date it will tell me that we are on September on this date in this year, for example. So, it How did it understand this? The operating system understands this command and that's how it understood that it needs to show me the date, day and time and hour and so on. Make directory or make dir this it understood the operating system understood that I need to create a folder where I'm going to create some files and this is called ITF. So, reserved a place, a location where I can start to create files. So, for example, I can do touch and then I create file ITF. text and if I do LS, you'll find that LS means list the files that exist in this folder. And you'll find that I have a file called ITF. text. So, as you can see, we can deal with the operating systems using CLI graphical user interface like the screen in front of you or using GUI graphical user interface, which is more common when it comes to Windows and so on. So, the operating system will keep everything working together, the hardware and the applications and everything, they work in harmony because of it. And examples as we mentioned, Windows, Linux and macOS and these are common icons you could be familiar with at least one of them if not all of them. GUI or CLI, which one should I use and which operating systems will give me this one or that one as an option? So, the graphical user interface, you are using icons, windows and mouse. And if you are doing CLI, then it's going to be commands basically as we have seen. So, if we need to compare Windows versus Linux, a lot of people ask that at the beginning of their career and you get the two advices. No, study Microsoft server administrator and others will tell you keep away from Windows, go for Linux. I am an advocate of the second one because the modern IT we whether you're talking about cloud, whether you're talking about machine learning, AI, data analytics and so on, the modern IT, even if you'd like to learn a lot of tools that we're going to discuss later on, containerization, Docker, Kubernetes and so on, it needs a high level of comprehension understanding and familiarity and experience with Linux, not Windows. One would jump and say, "Okay, but Windows also can run this and that." I'm saying what is common, what is more in demand in the industry and that's why I would say go for Linux. But if we compare the two if you compare Windows and Linux from a features perspective and usability perspective Windows will be mostly graphical user interface. People like to use graphical user interface on Windows more than the command line. Linux, although you can run applications like browsers and so on, but it's mostly CLI and that's the power of Linux, although people don't like to memorize commands and all that. It comes with experience. We're going to cover Linux later on in the course. The cost usually is paid on Windows and it's free or open source primarily in Linux. We're going to come to what open source means. Popular use, desktops and laptop, personal use more, even the corporates and all that, they prefer to use on the user side Windows mostly. But on Linux, a lot of people now are shifting into Linux because it doesn't have any licensing and they don't like to use macOS or Windows or maybe because it of affordability but it's very common on servers where we run the applications. We're going to come to what servers are in details. Flexibility, you have limited control on Windows, but it's highly customizable when it comes to Linux. So, what is open source software? That means I build a software and then I allowed for the public where they can download the source code, the code itself, the program that I have written and they can update, they can change and it is all for free. That's what an open source is. Linux is a perfect example of the operating system that is running as an open source. All right, so we have discussed the fact that one type of software is the system software, the operating system. Now, what about the applications that that run on top of it? The Gmail or maybe the Outlook or could be Uber or it could be Uber Eats, DoorDash and so on. There's plenty of applications that we use on our phones or maybe applications we can access through our browsers, banking and so on. Amazon and others. So, what is the other type of software and we mentioned it already, which is the application. So, the other type of software is applications and an application built by a developer is built for a specific purpose, right? Maybe I'm doing an application, personal one because I'm going to track my calories or the steps I'm going to walk or the meals I'm eating. Maybe an accountant is going to build an application to provide it to its customers so they can upload documents about their expenses or so it's easier for them to do the bookkeeping. >> [snorts] >> So, an application is a software program that is built to do a specific task. The task could be online banking. The bank will build the application so customers can download them and they can manage their accounts, they can upload checks and so on from their phones. Examples for applications, we have Chrome, the browser, we have Excel, Microsoft Excel spreadsheets, we have Zoom and we have WhatsApp. These are examples of applications that we are all familiar with and use. So, applications run on top of system software. So, the applications will require the system software and the system software gets the instructions from the application and coordinates that with the hardware. So, that's how it works within a computing device. Are there different types of applications? Yes. So, desktop applications, they run on your laptops, macOS, Linux, Windows. So, they run on PC or Mac and examples are PowerPoint, Word and Excel. Mobile applications run on mobiles and tablets and examples are Google Maps and Uber. One might say, "Okay, but I can run my Google Maps on my laptop." I would say, "Yes, there are web applications that you can access them through their app or through the web, through Firefox or through Safari, for example. So, they are running a browser and examples are Gmail, Canva, your banking online banking, all of that, your school or university account, all of that can be accessed through a web application, through a browser basically. And these applications can be built to run in the cloud. So, cloud applications, that means an application built to run in the cloud. So, Google Docs for example and Zoom, they all run in the cloud. Okay, so let's do a quick recap. We have learned that computing devices have hardware components. Hardware components are things that we can see, we can feel, we can touch maybe. So, this is hardware. Anything that I can hold on to or see or touch, that is a hardware. We agreed that there are plenty of components, but we only looked at five of them. We looked at monitors, we looked at CPU, RAM, storage devices, network interface cards, 605, and we looked also at GPUs. GPUs may or may not exist in devices depending on how complicated and advanced the device is. Then we looked at software. We said that the hardware cannot be used by itself. We have to have programs that will use the hardware and we take advantage of using these programs. And we looked at two types of software. Software that is built by developers as an operating system, so to make that device operate, to make the hardware usable. So, the operating system in itself is not what you are going to use, but it is required and mandatory in order to be able to use the hardware. And the second level or the second type of software that we have looked at is the applications. That's the actual programs used to do a specific task. The developers, when they built the application, they did not think about controlling the hardware. They thought about, "Okay, this application will be for a medical clinic or for a hospital or for a sporting club or maybe for a ship in the sea or maybe for a port that will upload and unload and track what has been shipped, exported and imported." So, the applications can be used on desktops, on mobile applications or through the browser and they're called web applications, all right? So, this is what we have learned so far. We didn't yet do a deep dive into any type of hardware or software, so let's go ahead and look into that in the subsequent sections. So, let's now talk about module number two. And module number two will be about servers and virtualization. So, we learned about hardware and software and applications in the previous section. Now, let's talk about a computing device that is commonly used when we talk about IT in general to deploy applications and software. And this is the servers. And servers, as we will explain, they posed some limitations for scaling, for cost and all that, which had led to the emergence of what we call virtualization or dividing a server into virtual servers. So, let's go ahead and look at these two topics in this section. We'll cover what a server is, physical servers, and then we'll talk about what were the limitations and how did we get into virtualization and what virtualization is. So, let's talk about physical servers. You will come across the concept bare metal servers. Physical or bare metal, they refer to the same thing. So, we knew about hardware components for a laptop as a computing device. Is a server a computing device? And the answer is absolutely. The physical server is nothing more than a muscle computing device. A computing device that has high specifications, basically. And this is an image of how a rack mountable server that can be installed inside a cabinet. Cabinet, we call it a rack. So, the physical server is basically a powerful computer, powerful computing device that has a good size of memory, the RAM, where you can run big applications or many applications, one or more CPUs. Sometimes they have 16 CPUs, 32, 64 and so on. And it has one or more disk drives for persistent storage and that could be in the terabyte size. And one or more network interfaces to connect to the outside world, one or more GPUs. So, the more expensive the server is, the higher the specs or the sizes and specifications of these hardware components would be. So, a physical server is hardware. What do we need to use the hardware? We need to run an operating system. So, an operating system, whether it is Linux, Windows or any sort of an operating system that can be installed on server machines to be able to use the server. So, we have to have one. Of course, the most common one in the cloud is Linux, but also Windows servers are common in the traditional IT more than in the modern IT or the cloud. We can install one or more applications on top of that operating system in order to fix them or install them or use them into that server. And this is how it would look like. So, we have the physical server. It will have one or more CPUs, a good amount of disks size and memory, and it will have one or more network cards, one or more GPUs. Then we install the operating system of choice and then we can run one or more applications on the server. And depending on the specs of the servers, the muscles and the size of the muscles and how hard it can process, how fast it can process, it can support on these applications, they can support tens of users, maybe hundreds of users, maybe thousands of users. All depends on the specification of the servers, how many CPUs, how fast, how much memory and so on. So, the high specifications in a server as a computing device allows it to serve a lot of users concurrently. All right, so here is an example of how we can benefit from using servers with the operating system installed and the application on top of that to build a Dolphin Aid Academy website on the internet. So, this is an e-learning and edtech company on the internet. And we are going to install the website software on the server. And the server will be connected to the internet and then clients are going to be using mobile applications or maybe their desktops and laptops in order to get to it through the browser. In either case, any web application is an application like websites, e-commerce websites or any application accessible over the public internet. So, how would that interaction happen? The user is going to start the application, the mobile application or the browser, and they will send in a request to the server and the request will be for example to open the page and then to log in. And then the server is going to the application on the server, to be more specific, is going to send the the response through the operating system, through the peripheral or the network interface card or cards available on the server back to the internet to the client. So, this is an example of how we can use the hardware and software in the form of operating system and application on a server connected to the internet to provide services through the web to clients, be that client a mobile app or a desktop client through a browser. So, this is all good stuff. Now, is servers the magic solution to everything? And that is what we'll explain next. All right, so now it's time to talk about virtualization. And definitely, if we moved or move from a physical server on top of which we install an operating system and an application to a different solution, a different way of hosting the operating system and applications, that means there should have been some limitations in using physical servers as is. So, let's go ahead and find out about these limitations. So, physical servers, as they are bare metal with an operating system and applications on top, posed or showed limitations when scaling and when installing multiple applications on a server. These include underutilization. If we have only one application on a physical server, a muscle computing device that costs a lot of money, then the average utilization, if it is in the form of 10, 20, 30%, that means underutilization. We have a lot of muscles, but you are only requesting that server to use maybe one muscle of this bunch of muscles. When we install multiple applications, we would we would need to see isolation between them. So, the files will not intermix in the file system such that when someone for application A is trying to troubleshoot, maybe they will remove some files, delete some files or update them, maybe they will impact another application. So, we need isolation. And also, some applications are going to deal with critical data. Others will not deal with critical data. So, we want isolation between them or among these applications on the same server for security reasons as well. So, in order to do that, the only way with physical servers is to have multiple servers, separate servers, and that will be 100% isolation. Also, if we need to build environments for testing and development and production, then we have to multiply or duplicate the environments again and again, which is extra cost. And if we would like to maintain isolation and security and scale, scale means that these applications becoming so popular, a lot of users are coming into Uber Eats for example. So, one server is not enough. We have to add more servers. Adding more servers means it's now going to go through the procurement cycle and lead times for delivery, installation, deployment, and it's going to be more expensive because now we are talking about multiple physical muscle computing devices. So, that will raise the cost if we would like to scale an application that becomes popular. And of course, the lead times for delivery and shipping and procurement and all that is going to make that slow. So, to scale an application, to scale an infrastructure, it will take long time. And also backups, backing up, so taking copies of the application software and the data on the servers in order to retain it in case if we have a hardware problem, then we can restore that application again to a workable situation or status, then that is also hardware dependent depending on what is the hardware configuration, what's the server configuration, how many CPUs, how many this, how many that, and it is then difficult to restore in case if we have a failure. All of these limitations, underutilization, isolation, security, scalability, and the rising costs led to the concept or the emergence of what we call virtualization. So, what is virtualization? Virtualization is a means that would allow us to divide a physical server into virtual servers. So, now we don't have to use the physical server as is, we can split it virtually. So, we're not going to to bring a saw and cut into the server. It's a software that will divide the resources virtually in software only across different virtual servers. That's exactly what it is. So, when we have the physical server, the bare metal, where we have the hardware and then the operating system and the application or applications depending on how many we have, here's how we are going to virtualize it. So, we are going to add a layer called the hypervisor or the virtualization engine. Once you have the hypervisor, multiple virtual machines, virtual servers, will be possible to create and they are going to share the physical hardware resources on the server. So, this is as if we have this server split into three actual servers, but they are not physical, they are virtual. And the good thing about virtualization is it allows you to have a different operating system on each one of the virtual machines. Here, we have to choose either it is Microsoft Windows or Mac or Linux. So, you have an operating system of choice and it's one operating system. On virtual machines, the same physical server will have different virtual servers, each of them you have the option to install a different operating system onto. So, virtualization will enable us to run more than one virtual system, virtual machine, virtual server, and multiple operating systems on a single physical server. And that is magical if you think about it. And of course, when we come to the low utilization or underutilization, now we will have multiple servers with multiple applications isolated, which means we have better utilization of the physical server that we had before that was underutilized, where isolation was difficult to do as well and backups were a challenge. So, each virtual machine is isolated, they are isolated from one another, and the hypervisor, this magical layer that we add here, will use virtual instances of the hardware components on the physical server. So, the memory is going to be split virtually into multiple virtual memories. The CPU or CPUs are going to be split into multiple VCPUs. The disk is going to be distributed or split also into multiple virtual instances of the disk, and then we'll start to assign the hypervisor will start to assign these into the different virtual machines. The backups, we can take a snapshot, a backup, a copy of the entire virtual machine, and then we can move it, upload it into somewhere else, and then we can fix it on another hypervisor, compatible one, and then it will run as if it existed on that hypervisor. So, let's take a closer look at how it would look like when we have multiple virtual machines on a physical server. So, this is our physical server, and these are the physical hardware components on the server. Now, we install the hypervisor. So, that is a software component that will be installed, will be fixed on the physical server, and that's an emulation layer. And then, we can through the hypervisor start to create multiple virtual machines. How many virtual machines? If you are going to split the VCPUs and the memory and the disk among them, then the limitation would be how much CPU, how much memory, how much disk, and how much GCPU and interface cards you have. So, if you have, let's say, 10 TB of disk space, and then you give each one 2 TB, that means you can do five virtual machines. Of course, there are ways called over subscription to do more than five, and then assuming that they are not going to use that allocation all of them at the same time, but that is out of our scope for now. Let's keep in mind now that the physical resources on the physical server is the limitation on how many virtual machines you can create on a physical server. So, you cannot do 1,000 machines each of them with 2 TB if you are talking about a 10 TB disk space available on the physical server. So, the hypervisor is going to allow you to create virtual machines. When you are creating the virtual machine through the hypervisor, you can decide how many virtual CPUs you are going to allocate. How many virtual memory you are going to allocate, how many virtual disks or how much disk space on a virtual disk you are going to allocate, and also on the network cards. Similarly for the second, third, and so on. Once the VM is created, then you will have access to it as if it is a physical server, and you have to have an operating system installed on it, and then you can decide is it one application per VM or multiple applications per VM. So, this is a virtual machine, and then the process is repeated for the second, third, and so on until n virtual machines on the same physical server. Okay? So, a virtual machine must have a full operating system, a full one, and it gets an allocation of the CPU, memory, disk, and GPU, and memory card in the form of virtual instances of these resources. Okay? So, the hypervisor is how we can share the physical server across or among the VMs, and each one of them will get virtual network interface card, virtual disk, virtual memory, and virtual CPU. What are the common vendors or the popular vendors when it comes to virtualization? We have VMware, vSphere as a solution or an engine for as a hypervisor. We have Zen, and then we have Microsoft Hyper-V, and we have Linux KVM, and then we have Oracle VM VirtualBox. So, these are different hypervisors that we can use from different companies as we can see here. And of course, we have the VMware Workstation as well. So, we have a VMware vSphere, which is um industry scale basically, and VMware Workstation is something you can do on your laptop or on your machine. The hypervisors are in two different types. Are you installing that hypervisor on a physical server or are you installing that on your laptop? So, that will define whether it is type one or type two hypervisor. So, a bare-metal hypervisor, this is type one, it's installed directly on the bare-metal hardware without needing a full host operating system. So, basically, the hypervisor will have a mini OS within, so it can deal with the hardware of the physical server, and it doesn't need a full operating system. And this is how it would look like. So, we have the hardware, the physical server, and we are going to install the hypervisor right on the hardware, and as we said, it has a mini OS with it, and then we can start through the hypervisor create different VMs, and then have the operating system on each of them, and they can be up and running. Examples are Microsoft Hyper-V and VMware vSphere and Zen. Type two, when we talk about a full operating system on the physical hardware, and this is common more on the laptop side. So, if you want on your Mac OS or on your Windows laptop to install a virtual machine or a hypervisor, and then you start to create, for example, a VM to practice for a Linux lab or for networking or so on, then you can do multiple VMs, small specifications, and you can run with that if your laptop has enough resources. So, in that case, your laptop will have an operating system. It could be Windows, could be Mac, could be Linux, and then you are going to mount the hypervisor on top. An example is VirtualBox from Oracle, for example, and then you start to create VMs, and you start to install operating system on them, and then it will they will be functional. But of course, this is when we are talking about production grade, this is when we are talking about personal use. So, Oracle VirtualBox and VMware Workstation are examples of what you can do with this. Now the question, we have talked about physical servers, bare metal, and we talked about virtualization and all that. But where is the physical location a company would put these physical servers? So where would that be placed? Would it be placed under a desk in an office or maybe in a storage room in an office or are there locations which are equipped and purposely built and the fit out is to become a place where you can host those physical servers and the application on them? And that is data centers. So our next discussion is going to go around data centers. What are they and how do they look like and so on. All right. Now since we are going to do most of our hands-on lab and practice in AWS, in the cloud, we are going to work extensively in the cloud in this course. And that will be a great opportunity for you to learn the cloud as well while you are learning the IT fundamentals. So what we'll do is we are going to create an AWS account. Free, don't worry, you will not have to pay anything. And that will make it easier if you have an old laptop, if your laptop is busy or not performing, it's full, the disk is full, you don't have to upgrade to another laptop, just continue to use it in the cloud. That's it. So what do we need to do? We need to go to aws.amazon.com, aws.amazon.com. And you will get a page like this one where you click on create account. So we need to open an account. We have to have an account in order to use AWS services. So I'm going to click on create. And this is a free account from here. Get started for free. And this will tell you about the the options you have. You have a free plan, you have a paid plan. What's the difference between the two? The free plan is an account, it doesn't give you access to all AWS services. So there will be some services that you will not be able to use. And scaling of services is going to be capped. So when you are working and you are trying to scale and do like advanced stuff, it will not scale accordingly because there are some thresholds based on the credits. So these are the disadvantages and the account is going to be closed after 6 months from creation. You will receive $100 credits as soon as you open the account. So you can use AWS services worth $100. If you use them in 1 month, that's it. The account is unusable, you cannot add credits unless you change it, upgrade it into a paid plan. And there are some activities that if you do, exploring some AWS services, and if you do them within the 6 months, you will get another $100 credit. So you will have $200 credit and that's a lot of money for someone who's learning AWS. I mean that could easily help you do a lot of AWS stuff that would take a year to to work on. And you you will have free usage of select services and there's no charges whatsoever. So if you are worried about incurring any charges, that will be the account. But of course, you have limitations. You can always upgrade within the 6 months to the paid plan. And in the paid plan, the same thing. You get 100 credits and another 100 if you do the AWS services exploration, includes free usage. You can scale and all that, but you are going to be charged if you go beyond the thresholds. Workloads can scale beyond credit thresholds because it's paid, you will pay for it. And you have access to all AWS services. If you need to know more about the differences, there is a an FAQ. So these are services that are available in both. And you can keep exploring which services and you can always click on show more and it will tell you if this is available in both or not. And you will get an Yeah, this is the FAQs. And in the FAQs, they will tell you about So here the free plan accounts, paid plan accounts, earning additional credits, what you need to do exactly, and what are the activities that you need to do in order to explore that. How do I earn additional free credits? And you go through this. Console home walk-through and dashboard and you can find out what needs to be done. So you have everything you need and you can find it by yourself without having to ask me for any questions regarding these accounts. All right. Let's go back to creating the account. You need to write an email that is going to be the communication between AWS and you for bills and for updates and so on. And a nickname of your choice for the account. So once you have entered the email and the nickname, click on verify email. So what they will do is they will send you a verification email to ensure that this email is an active email and you have access to it. And once you verify, you will be taken to the next step. So once you enter the email and the name, you will get into this CAPTCHA where you have to do the security verification. So go ahead and do it and then click on submit. Once you do the CAPTCHA, enter a code that was sent to the email that you have specified. So you need to get that code from the email and enter it here and then click verify. And as you can see, the email has been verified now. Now now you need to configure the root user password. Basically, the username will be the email that you entered and this will be the password and this is the most powerful user in your account. So you have to be very careful and it's better to use a password phrase, not an easy to guess password. And the conditions are available here. It has to be at least eight eight letters long. At least three of And it includes three of the following. Upper case, lower case, numbers, and non-alphanumeric characters. So go ahead, create your password and confirm it, and click on continue. You have the two options that we talked about. The free and paid. It's up to you. If you don't want to be charged under no circumstances, but you're okay that you you will bump across some services that you are not going to be able to use. And of course, for this course, the free plan is more than enough. I would go with the free plan for now. Now you need to select what will be the use of this account. So I'm going to click on personal. Put all the details. Your personal details. It has to be accurate. The phone number has to be accurate. The country and all that has to be accurate because they are going to send you a code to your phone and you will need to verify it. So now they have verified the email, they will need to verify the phone number as well. So fill this and after you do, then tick this box and click on agree and continue. Now you will need to enter credit card information. You might be wondering why is AWS asking me for a credit card if this is a free plan? Simply, they need to verify your identity in three different ways. Email was one, phone was another, and now credit card information that means they know you, they can verify, and there is no way you can have wrong information entered here because they will check and probably they will hold like a dollar, 1 euro, or a small amount, only hold, they are not going to charge it, and it will be released in a few days. But this makes them sure that there is a payment method just in case in the account. And if you upgrade to a paid plan, then any extra charges are going to be charged to this credit card. If you are on the free plan, they will not charge you. So don't worry about that, but you have to enter this information. There is no way out of that. So fill this information and click on continue and I will see you in the next page. Now is the sign up for AWS. You need to confirm your identity and now they have given you an option. They can either call you and give you a code or you can receive a text message. So both of them are used to verify that this phone is yours. So go ahead, fill in the information, and click on send SMS or you can have a voice call if they want to call you and give you the code. Either way, fill in the number, click on send, and then they will text you or they are going to call you depending on your choice. Go ahead, do this step, and I'll see you in the next page. Now you are faced with another CAPTCHA. And then they will send you the verification. Or the verification code or the text message. So you have to fill this CAPTCHA and then you will get the code. All right. So this is the page and you will get the code, enter it here, and click on continue. Okay. So I got the code. It is 5320. 5320. Continue. Okay. In my case, because my um credit card, my phone number, and all that exist already on AWS, they are refusing to give me a free plan and they will upgrade me to a paid plan. So, anyone who created an account before in the good free tier all times where we could create five 10 accounts and use free tier in all of them for 12 months, this is not the case anymore. You need to use a new credit card, a different phone number if you would like to get around and have another free tier. In your case, this shouldn't be a problem because if if you are a new user to AWS, this page will not appear to you. So, in my case, I'm going to say, "Okay, I agree." I'm not eligible for the free plan anymore. Anyways, I'm going to click on confirm because I want to show you the rest. So, that page will not appear in your case. Now, we come to the support plan. Leave it to the basic and click on complete sign up. All right, so I'm going to click on that. And guess what? Congratulations, you have an AWS account right now. Click on go to AWS management console. All right, so once you log in, that means you're going to the management console. This is the portal. This is the orchestration and automation and management tool in AWS. So, I'm entering my account right now and I'm going to take you through a walk-through quickly, but let's close this video and start a new one to do the walk-through so we don't keep this one for long. All right, so let me take you through a walk-through of the AWS management consoles to help you get familiarized about the AWS management console, how to use it and all that. Let's go ahead. Okay, so this is these are few messages if you'd like to go through them, that's okay. For me, I'm not going to go through them. Let me make this a little bigger. So, this is the console home for a brand new account. So, this is an account which doesn't have any recently visited services or anything. If you click on this side, you'll find the account ID. You can go to billing and cost management where you can look at your bills and find out your consumption and so on. You can sign out. And here, you can see that you have all the AWS regions. So, by default, it has chosen for me this as the default, the one in Stockholm in Sweden, but you can switch to a one closer to you because that will help you with the internet latency. If you want to play with an AWS service, work with an AWS service, then you can click on here and you can see that you have here a list of AWS services. Or if you know the service that you're going to work with, for example, in this course we're going to work a lot with EC2. This is the service that allows you to create virtual machines in AWS, virtual servers in the cloud basically. If you would like to launch your own presence in AWS, you have to create what we call a VPC or virtual private cloud. There are some services under VPC that are created for you by default. You don't have to do anything about them and they are there for you. AWS assumes that this is like um common denominator that most of the people who are learning might need it and they volunteer and they create it for you. We're going to learn more about this later on. If you go into one of these services, I'm just going to show you how it looks like. You don't have to know anything about it right now. So, usually you have the dashboard. So, this tells you where exactly are you right now. So, I'm in the VPC dashboard, virtual private cloud dashboard, and these are the settings that I can choose or the stuff that are under the VPC. When you choose one of them, what you see [clears throat] on the right-hand side will be the details of what you have selected. So, for example, if I click on this, these are the subnets under subnet. VPCs, this is the the existing VPC. Route tables, these are the existing route tables. Now, let's go to EC2, which is the virtual machines in the cloud. And as you can see, this is the service. Here is the EC2 dashboard as it says. Instances means virtual machines and instance types and launch templates and there's a lot of configuration stuff that also fall under the EC2 dashboard. For example, if I wanted to create a virtual machine and you will be amazed at how fast you can do that. So, I click on instances. I don't have any as you can see, but I can choose to launch one. So, this is the page that at the end when you fill in all the information, you can just click on launch instance and boom, you have a virtual machine in the cloud. So, what do I need to do? I'm going to call it first VM, first virtual machine. And here you have the operating system. So, you can do Amazon Linux, you can do Mac OS, Ubuntu Linux, Windows, Red Hat Linux, SUSE Linux and so on. So, there are plenty of operating systems you can run on the virtual machine. Remember that the virtual machine needs a full guest OS. And after that, I'll leave it to the default. So, I'm assuming that I'm going to go with an Amazon Linux one. Any virtual machine has a V neck, virtual memory, virtual disk, virtual CPU and so on. So, if you look here, you'll find that this is T3.micro. That's the size of an instance or a virtual machine. And it comes prepackaged. So, the T3.micro will always have two vCPUs, 1 gigabyte of memory, and here it tells you the price is per hour if you use it. So, in my case, I'm going to choose, let's see if I can get to a smaller one. That's fine. That's the least I can do. So, T3.nano. Key pair, if you would like to access the instance remotely, then you have to create a key pair. Otherwise, I can do proceed without. We're going to explain that later on. Network settings, which VPC or where it's going to land. I'm going to leave everything to the default now because I'm just explaining that to you. Security. And once you are done with all of this, all you can do is launch instance. And congratulations, this is your first virtual machine in the cloud. Successfully initiated launch of this instance. And if you click on that ID, you get to here and you will see that it is running and we have created a virtual machine. Of course, as you learn the the the particulars or the specifics about each one of the attributes that we needed to configure, then probably it will take you another 10 seconds, 15 seconds, but you will have a virtual machine in no time. You don't have to virtualize your laptop. You don't have to learn about new tools like VirtualBox or VMware Workstation and you don't have to do nothing. Your laptop is as is. You don't need to split or partition it to include a a VM. You don't have to do nothing. In the cloud, in your case, if you are new to AWS, it's going to be free. You have $100 credits and you can do some exercises and gain another $100 credits and it's going to be there for you for 6 months. You don't need anything All right. And at the end of the 6 months, as you advance, you can upgrade to the paid plan and then you start controlling your expenses based on your usage basically. You are investing in the environment that would look like the actual environments you are going to work on as you specialize in your career. All right. Hopefully that was clear. What I need to do now is I'm going to terminate the instance because my account is not a free account. And once I click on that, guess what is happening right now? You'll find that it is shutting down and it will be terminated in no time. Let's now start with module three. In module three, we're going to start the discussion about data center. We talked about servers and applications and software and virtualization and we said all of that is hosted in data center. So, now it's time to talk about data centers. And after knowing at a high level what a data center is, we're going to take it one step further and we're going to get into what is cloud computing and why did we get from data centers to the cloud and why cloud is attractive. So, this is what we are going to do in this module. We're going to cover what data centers are, cloud computing and cloud services models. What are the different services that you can hire or rent or lease from the cloud. We'll talk about cloud deployments models and also we're going to talk about if you are going to study or specialize in the cloud or DevOps or AI or ML Ops, any one of the modern IT roles would require you to have sufficient knowledge of the cloud. So, which cloud you should start with? Is it AWS? Is it Azure or is it GCP from Google? This is what we are going to cover in this module. So, let's get started. So, let's start with an overview of what a data center is. In traditional IT, in the pre-cloud era and still ongoing, servers and applications are hosted in client specific purpose designed or purpose built IT data centers. And if we get into a data center, we will see aisles like these ones and you'll see cabinets as you can see. And if you open one of the cabinets and look from the front and the back, you'll see cables on the backside, and you will see the details of the servers that are mounted on the front side. In general, any data center is a considerable space size, real estate size, a building, basically, or a floor in a building, or could be the entire building that is air-conditioned, physically secured, and manned 24/7 to ensure continuous operation. And this is where the servers will be placed. Of course, there has to be power and redundant power and so on, and servers are going to be connected to a network, and this is how they function, basically. We're going to touch on data centers again when we get to the networking component, because we need to talk about what is a data center network or DCNs, but that will come later on. Let's continue with our overview of what a data center is. The image that you see in front of you right now, this is the AWS data center in Mumbai, in India. So, this is how big that is. So, if you look at the size of the trees, for example, compared to the size of the buildings that are available in data center, and the redundant power, and the generators, and all the different utilities that get into the data center, you will you will understand what the size is. So, for example, look at this car, this vehicle, compared to the size of the building, and then you will appreciate how big that would be. So, we talked before about physical servers, and we showed the images of some rack-mountable servers, the one that are flat, basically. They are not high, they are flat. So, the servers that are flat, they have angles or brackets on the side, and that's how they get mounted. So, this is called a rack or a cabinet, and each one of these rows that you see here is a rack-mounted server. And the rails on the side, the silver components here, the rails on the side, is where the server gets fixed or bolted to the rack. So, we can have lots of racks in a data center, and they will be side by side, and usually, they can be physically secured, so they can be locked, and only the responsible or the authorized personnel will be able to open that. If you turn around the rack, so the racks are fixed in aisles, basically, or rows, and the rows will have aisles in between. So, if you move to the back of a row of racks, you will see the cabling part, and this is how they connect into the network. So, the yellow and green and white that you see here, these are cabling that goes from the servers to the network, and then from the network to the outside world, or wherever they need to communicate with. The term on-premises or on-prem is something that you are going to encounter a lot when you deal with cloud or networking or infrastructure and all that. And this is or refers to a location that is owned and controlled by the customer. So, if we are talking about cloud, AWS, Azure, or GCP, these are data centers controlled by these vendors. But if a company, Bank of America, for example, they have their own data center where they host their servers and applications, so that becomes on-prem for Bank of America. So, when they refer to their own data center, they will talk and say on-prem, or they will mention on-prem, on-premises. That means it's our data center, it's our location, it's our space. So, what is so special about on-premises data centers? This is 100% customer controlled, and 100% the customer is responsible for the design, so they will go out, and they will find where is the space. Is it going to be in their building, or maybe they are going to lease it somewhere else. The cost of establishing the data center, if there are any real estate build, or cabling, or false ceiling, or raised floors, all of that is the customer responsibility as well. Who's going to operate that? The customer. Who's going to optimize it? Who's going to upgrade it? Who's going to be responsible for the security, the power, the AC, the cooling, and all of that stuff? The customer. Of course, the customer may hire companies to do that on the customer's behalf, but still, it is the customer who's responsible to find the third parties and sign contracts with them and monitor their work to make sure that they are doing an immaculate job as far as the operations of the data center are concerned. So, what is exactly the customer responsible for in a data center? They are responsible for everything, the real estate, the physical security, the cameras and all that, and then they're responsible for the network. They're responsible for storage solutions to store the data permanently, a persistent storage for the data. They're responsible for the hardware, whatever the hardware is, servers, monitors, storage solutions, so on. This is all the customer's responsibility. Virtualization, if they are going to use virtualization, and definitely in a in a huge data center, virtualization will be used, then who is the vendor of the virtualization or the hypervisor, and what's the licensing required, what's the cost, the maintenance support, and all that, they are responsible for that. They are responsible for deciding on which operating systems are going to be used on the different servers hosting the different applications. Also, if there are any message brokers, components that have to do between the application components, basically, for them to communicate with one another, they call it middleware, or they call it message brokers as well. They are responsible for deciding what that is going to be. If it is Python, for example, so what will be the programs that are required to run Python? We call that the runtime. And what will be the data or the applications, and what will the application communicate and process and store? And also, the actuality or the actual applications is also the responsibility. So, they are responsible for the entire spectrum, from the physical all the way to the data and its storage and security and so on. It's all the customer's responsibility. Who's going to pay for that? It's the customer. And that's why they call it a capex model. This model, the on-premises data center owned by the customer or leased from another company, for them, this is called the capex model, capital expenditure model. That means, Mr. Customer, you want all of this? Yes, you have to pay. So, you have to pay upfront to buy the equipment. You have to pay upfront to rent or own the place. You have to pay for the construction. You have to pay for the cooling. You have to pay for this. You have to pay for that. So, each time you need something new, okay, fine. Please show us your credit card, and we're going to charge you upfront. To establish and build a data center, it could cost up to 50-100 million dollars to establish data center, and then it will be costing a similar cost as well to operate it on an ongoing base. Capex model is very expensive to the customer. Think about a startup, a startup that needs to start, and they have an idea, and they want three, four, five servers or something, and they don't want to spend a lot of money. If they use services, they want to pay for it as a utility bill, and if they don't, then they don't pay anything. As opposed to buying three or four servers, and then hosting them in a room in their office, and they don't have office, they are working remote. So, how can they facilitate the power and the cooling and the storage and all that? They have to buy, buy, buy. So, in that case, this is an obstacle, and this is a showstopper, they can't afford that. And this is where the cloud computing comes into play as a utility service, which provides you everything you need, and you only pay when you use. And this will be our next discussion. So, let's look at what cloud computing is compared to on-premises data centers. And does it really provide us with a financial model other than the capex or the capital expenditure which the on-premises data center require? So, what is the attractiveness of the cloud? And what is the cloud? Why do they call it the cloud? They call it the cloud because they are going to provide you all the services that you need. So, in cloud computing, everything the customer needs is pre-built and ready for use. So, we have everything ready for you, just decide when you want to use it, enroll or sign up, and then start go ahead and use it. So, that includes the infrastructure, network, physical, storage, all the way to the application and database, if you want, passing by storage and security and and and. So, all of that is pre-built. Why do they call it the cloud? Because you don't know where it is. And you shouldn't know, and you are not concerned to know where it is. You need to connect to it, establish your services, not even knowing where that data center is. And someone would would say, "Okay, hold on, hold on. Now you are talking about a data center. So, how is a data center different from the cloud?" In the cloud, the vendor of the cloud, let's say AWS or Microsoft or Google, they have already pre-built the infrastructure. They have already pre-wired the servers, they put them in the racks, they have the 24/7 operations, and they have everything, and it is waiting for customers to come and sign up. Do you have to go to AWS? No, online, on the internet. And the promise is what you use, we'll send you a bill for the usage. And if you don't use anything, even if you are signed up, we're not going to send you anything. You don't have to pay anything up front. It's up to you. If you want in some services to pay a little bit up front to reduce the monthly or the usage bills, that's up to you. But if you don't want to, that's perfectly fine. So, who has spent money or followed the capex model to establish and build that data center? The vendor. AWS or Azure or GCP. For you, that becomes an operational expenditure model. So, as you use, you pay. This is exactly like electricity. When you travel and you switch off everything in your home and you don't use water or electricity, the bill will be zero. If you come back and you start using the AC and the water and showers and all that stuff in the bathrooms, then you will be getting some money in the bill next month, right? So, that's exactly the same like your phone bill, like your utility bill, like your Netflix bill, like your Zoom bill, anything. When you use, we charge you. You don't use, we don't charge you. This is called OPEX model or operational expenditure model and this is where the attractiveness comes from. Think about the startup we were talking about. They don't have a lot of fund. And they would like to build a proof of concept. And they don't want to buy anything and they would like to switch it off as soon as it is done. And stop paying for anything from that point onwards. So, in that case, OPEX model is perfect because they know what they are going to use, they will find out about the prices even before using that and then they can estimate the budget that they'd like to spend and they have the funds for that little budget and they start using, finished, switch it off, life is good. Or build the proof of concept when you go to talk to an investor, turn it on so you can demo that to the investor and then switch it off. That's it. So, OPEX model is the attractiveness of the cloud and that's why when someone tells you that cloud is going to disappear or go away or people are leaving the cloud and companies are walking away from the cloud, tell them I don't think so because even when the economic or the global economic outlook is bad, companies would save money by not investing in building data centers or refreshing data centers or expanding data centers and they will find cloud solutions to suit them so it's easier and faster to build and also it is cheaper to use in the most case if they are used properly. I'm not saying that cloud is cheaper all the way because it turned out in some use cases to be more expensive, not less expensive. So, the message you can respond to those who claim that cloud will go away, that cloud is here to stay and it will stay because of the fact that it depends on an OPEX model and customer doesn't have to pay anything up front. In a lot of the videos that I watch on YouTube and other sources, I'll find a lot of people, especially the ones who are coming from networking background or the ones who teach networking, Cisco and CCNA and all that stuff, they always claim that cloud is just a data center. That's it. So, if you learn networking, you know the cloud. And that's absolutely absolutely wrong. I come from a networking background, I know very well cloud computing as well and it is absolutely an inaccurate statement to say that the cloud is a data center. The cloud is built in a data center, but it has hundreds of services that have nothing to do with networking. Yeah, it functions on a network. I cannot say that the data center is the street because people use the street to get to the data center so the data center becomes the street and that's wrong. 100% the same analogy. I cannot say the cloud is just a data center. Why? Because when we have a customer with the customer's own data center, then I have to go to the data center, I have to get in to start mounting our own servers, mounting our own racks, connecting them and all that. We are building the data center, we have to know where it is, we have to have access to it and all that. That's a data center. But the data center in the cloud computing is just the component, is just the place, is just the network, but that is not everything in the cloud. Okay, so it's a component of the cloud, but it's not a synonym of a cloud. So, this is a wrong statement. Data center is not is not the cloud. It is a component that the cloud uses to provide services to the customers. So, cloud is the data center housing or hosting the equipment and the servers and the applications and the softwares and the teams and all that for the cloud provider. But the automation of services in the cloud and the orchestration, basically when you get to the AWS management console, you can start to use the different services including the network, including the storage, including the security, including AI, including machine learning, including any service you may think of, you consume it through a portal or a management console or online basically and then behind the scenes, whatever you click, it does an action in the background that has been pre-built to do the task that you have clicked. So, you have the icon representing what you need to do, but then in the background, there's a lot of automation programs that have been written and scripts that will execute what you are planning to do by clicking that icon. So, the automation and orchestration on top of the data center housing and hosting all the services and servers and applications, that provides me what is a cloud. So, is it enough for me to learn networking and data center to be expert in the cloud? I would tell you that you are 10-15% of the cloud knowledge that you need to acquire. So, don't fall for those who are telling you you have to start with a networking career, otherwise you will not be a cloud engineer and you can't do cloud without networking. That is all BS and we are going to see that in this course. By the end of this course, you can jump into the cloud. Actually, we are going to start learning the cloud as we learn the fundamentals in this course. All right. So, again, this building for AWS in Mumbai in India, that's the data center, but there is a lot of programs and scripts, the automation, the orchestration of services and how they integrate and how they work together that is done and it is provided to you through a web application, a web browser. You can log in and then you can consume all these services without having to call anyone. You can deploy servers, you can deploy virtual machines, you you can choose the operating systems, the specifications of the virtual machines and you can launch the virtual machines and you can work on them without even having to know where that is and all online and without having to call anyone from AWS. So, that's the beauty of the cloud, that's the attractiveness of the cloud and and that's why the cloud will continue. Okay, let's now discuss cloud service models. When I buy a service from the cloud, what is that called? And there are three main ones and there are plenty of as a service models in the cloud. Okay, so we'll talk about the as a service or the AAS model in the cloud. Before we start talk about the cloud, let's think about the on-premises. What is the customer responsible for and what is the cloud provider responsible for? So, this arrow, if the color is green, that is the span of the customer responsibility and if it is orange, that will be the the vendor responsibility. On-premises, as we mentioned, the customer is responsible for everything from the network all the way to the application. And then there is something called IAS or infrastructure as a service. So, basically you are using infrastructure only from the cloud provider. For example, you are hosting a virtual machine in AWS and that virtual machine, it's up to you to decide its specs, it's up to you to decide the operating system and which data and what you will use it for and so on. So, in that case, if it is infrastructure as a service that you are using from the cloud provider, then the cloud provider will be responsible for the network, for the storage, for the hardware and the actual virtualization engine. But once you launch your virtual machine, then choosing the operating system, what middleware, what runtime, what data, what application is your responsibility. So, this is infrastructure as a service. Now, what if I don't want to be responsible for the operating system and the middleware as well? I I want to ship that and the runtime maybe. I want to have that ready from the cloud providers and I'm going to take it as part of the service I'm getting from them. So, in that case, the runtime, the middleware and the operating system and everything below is going to be part of the platform as a service or pass, PAAS. In this case, the customer will be only responsible for the application and the data. Data in the databases and data in the application. We'll talk about uh databases later on. The third one, which most of us use right now, like Uber and Netflix and similar services, is called software as a service or a SaaS offering, SaaS SaaS services. SaaS. So, all of them they have as a service, as a service, as a service. Basically, like a utility that you are using and you're paying for. So, services in the cloud, majorly they will fall under one of these categories, and that's how we map services to what service models we are using from the cloud. So, these are the three ones, and of course, when it comes to SaaS, Netflix and so on, you're not responsible for anything except for signing up and using the service. Let's talk about cloud deployment models. Is there anything that prevents a company from building their own orchestration in their own data center and making that a private cloud? And the answer is there is nothing to prevent them. They can do that, and that's why there are different deployment models. So, we have public clouds like AWS, Azure and GCP, and we have private clouds that a bank or a corporate or a hospital may decide to build in-house and to manage it using their own teams, and that will be private for them only, for that corporate or that organization or that hospital only. So, in public clouds, what is the criteria or the specs? In public clouds, the resources are publicly shared. So, I could be using a virtual machine on a physical server in AWS, and maybe you are from a different country and you launch a VM and it and by coincidence, it lands next to my VM on the same physical server. Public clouds, by nature, they are shared multi-tenant infrastructures. And internet connectivity is the common way of getting to your virtual machines and applications in the cloud in this case, and it's best suited for less confidential data. So, banks, for example, or hospitals, they will think thrice, not twice, before they are going to move the credit card information for the customers or their bank account details or their confidential information into the cloud. And that's why companies they don't live off the public cloud only, but for whatever data that they can't move to the cloud, they can establish their own private cloud. And as the name implies, the resources available here are going to be for private use. This is only to host the confidential data that they cannot move into the cloud. But they can have orchestration and automation in their own on-premises data center, so they have a private cloud. So, this will be for a single customer, and the customer can have can be a group of companies and they are using their private cloud. It doesn't have to be like a one business unit in a company. It could be multiple business units in Bank of America that are using their private cloud to host different applications and relevant data. Connectivity in this case, how can they connect into their private cloud? They can have high-speed connectivity from service providers. They can have their own fiber optic cables that they can provide them hundreds of gigabits per second speeds into that private cloud. And this is best suited for confidential data client private systems. All right. What if Bank of America has lots of data that can be moved into the cloud, but it also they have sensitive data that they cannot move into the cloud. So, they want to use public cloud, but also they need to use the private cloud. What if we need communication between the two? For example, an application in the public cloud would like to highlight or reference some data from the private cloud or the other way around? Then this brings to us what is called a hybrid cloud. So, a hybrid cloud is a mix of public and on-premises private cloud, and both are orchestrated to run a single task. And that's how it would look like. So, the corporate data center with orchestration becomes a private cloud, and then let's say AWS, and they can have private connectivity between them or connectivity through the internet. Both would work. And of course, orchestrating this and that, and which users will log in here and which user will be able to access the cloud or both of them, this is orchestration. It's going to be more complex because now we need to manage private and hybrid access and security and so on. And this is suitable for so many use cases, and it is proving that hybrid cloud is the direction that most of the companies using the cloud are using right now or they will use. So, that's why we need to be also knowledgeable about hybrid cloud. And in this case, it's up to the customer to decide what runs here and what runs there, and they can optimize application usage, access, cost optimization as well, more control, and they can run applications where they decide. They can use the cloud only for failover when they have a problem in the data center, this is called disaster recovery, for example, or they can just store their data as a backup, as a second copy, in the cloud in case if the main data center fails, then we can launch it from the cloud. Then the trend that is evolving as well, and a lot of companies are deploying. It has proven that cloud providers are not one size that fits all. For example, AI and machine learning, Azure and Google are much better than AWS. So, a company might host their AI in Azure or in Google, for example. Whereas the company will be hosting their e-commerce on AWS because AWS is e-commerce, Amazon is e-commerce. So, now, once they start splitting workloads among the different cloud providers, this also will give them the advantage of avoiding vendor lock-in. So, if I go to AWS and put everything in AWS, now AWS kind of controls me and controls the prices and discounts because if I'm not happy, I will have to move stuff and move it elsewhere, which is not an easy task. And that's why vendor lock-in can be avoided by using multi-cloud, and also give the customer the choice of which one provides me the best features for the lowest cost, and that is what I'm going to follow. So, multi-cloud is very important, and that's why we always advocate for learning at least two of the three major clouds, if not the three of them. And I'm not saying you have to become an expert in all of them, that would be great if you can do it, but what I'm saying is you need to have enough knowledge about them, not at the start as you move on into your career. All right? So, in that case, customers will put some stuff in AWS, for example, and some in Azure, and that will be a single heterogeneous architecture that includes all of that. So, the organization will continue towards the multi-cloud because it is proving that cloud providers are not all good and at the same price point when we compare the same services in each in each one of them. So, what about hybrid multi-cloud to make it even harder? This is when we connect our private cloud or data center into the multi-cloud because we need to consume services from the different cloud vendors that we are using. So, that will become a hybrid multi-cloud solution. And of course, the challenge will always be how will you be able to orchestrate, control security, and define users and access permissions across the different cloud environments that you are using. So, we have learned at a high level what cloud is and what a data center is, and we have learned about public and private clouds, and hybrid cloud and hybrid multi-cloud and what multi-cloud is. Which one should I start with? I love what you said, and I would like after this course to start working towards building my cloud skills. Should I go with AWS? Should I go with Azure or should I go with GCP or all of them? What do I do? And in order to find out, there is something called the Gartner Magic Quadrant. This is a report that is launched annually or sometimes uh multiple times a year by Gartner. And Gartner, what it does is here is the public cloud providers comparison. And the magic quadrant is this part. So, whoever is in this part is one of the top players. So, in 2021, AWS was here, Azure was here, and Google was here. I'm not going to talk about the other players. In 2023, see the distances here and how the the horizontal gap between them was. In 2023, the vertical distance narrowed, and also the horizontal distance narrowed. This axis is called completeness of vision, and this is the ability to execute. So, AWS was always at the top of the ability to execute. But here, the vision, which is the vertical gap, now Microsoft is even better than AWS in a vision perspective. But AWS is more able to execute for the customers and services and all that stuff. But Google is getting very close. In 2025, you can see that the gap between Azure and Google in both the vision and the ability to execute is very narrow. AWS is still behind Microsoft in terms of vision, but they are still able or their ability to execute is better, but now even the vertical ability to execute access is narrowing, the gap is narrowing right now. So, it is a catch-up. They are catching up, but AWS is still the major player across the globe in terms of market share. By all means, if you are going into AI and machine learning, skip AWS and get into Azure or GCP. They are much better in AI and machine learning than AWS is. If you look at the market share percentage, we'll find that AWS has 30% of the public cloud market share, and Azure has 20%, and Google has 13%. So, what's the message? The message is, if you don't know, ask and find the reputable job boards in your country and try to find how many Microsoft, how many AWS cloud, how many GCP jobs are there. And follow that for a 2-weeks, 1-month period to find out which one posts more jobs, that means it's in higher demand. Ask in the forums on the social media in your country, which one should you start with, which one is providing higher salaries, more jobs, more demand, and so on. Start with that one. If you couldn't find a solution, some people told you AWS, some people told you Azure, some people told you Google, and there is no preference, then go with AWS for the infrastructure or for the start, but as soon as you want to shift into machine learning and AI, move to Azure or GCP. Generally speaking, you are you are never go wrong with one of these two. But again, if you know which country which one is the preferred one in your country, then definitely by all means you are doing the right thing. That's it. So, now you know about the cloud providers, about private, public, and hybrid, and multi-cloud, and also you know about the models, and you know about the cloud provider to start with. All right, so let's start with the first module from the networking focused modules. These are These modules will constitute a deep dive into networking fundamentals, and that would be more than enough for you to proceed into the modern IT roles that you are going to cover at the end of the course without having to go through A+, Network+, and CCNA. All right? So, what are we covering in the networking fundamentals module? We are going to cover what is a network. So, let's get to introduce ourselves to what networks are, and we'll look at the network types, LAN, WAN, that that wireless LAN or WLAN, CAN, and we'll talk about these in more details. Also, we'll look at the types of network traffic or network flow that could happen within a network. We'll look also at the wired network devices that we may encounter that basically build the network. We'll look also at the network cabling. How do they connect to each other and to the servers and to users and so on. We'll also look at the data center network or DCN. So, we introduced what data centers are. Now, we are going to dive into what a data center actually looks like. We'll look at the CAN, campus area networks, and we'll also look at what is the internet. I mean, we talked about LAN, WAN, CAN, wireless LAN. What is the internet then? We're going to uh summarize that, and then we'll look at the wireless network devices, which is something that you are used to at your home or maybe at your office or at the airports. You just take your phone and then connect to a Wi-Fi network, enter the password, and you're connected to the internet. All right, so let's start with the first one, which is what is a network. So, a network is nothing but a group of two or more computers, and other devices also can connect to the network. It's not only limited to computers that are connected to that network or to that medium in order to share data. They could be sharing files, they could be sharing images, they could be sharing videos. It could be a server or a website that I'm connected to. Whatever the means or the use case is, they have to connect somehow into the network to be able to communicate. And devices that may connect to the network are not limited only to servers and computers and virtual machines. They could be printers, they could be your laptops, they could be phones, they could be tablets, they could be security cameras. For example, the surveillance cameras, could be your smart TV. If you have a network, then you can choose what devices will be connected into that network to communicate. And here's an example for a home network, but this is a wireless network. So, we have a wireless device, and then I can have my desktops, I can have my phone, my tablet, my printers connect to it. So, I can from my laptop or from iPhone or my tablet, I can, for example, print images or print documents on the printer. That's one use. Or it could be that I would like to connect to the internet, so I'm going to connect wirelessly within my home, but then I need a device that will connect me to the internet. We'll look into that. Each device in a network must be uniquely addressable. So, that means it must have a name or an address of some sort in order to be able to connect to the network and communicate with the other devices and with the internet if required. And that is called an IP address. We're going to cover that later on. So, what are the network types that I may come across in my career for cloud or for networking or security or even development and so on. There is one called LAN or local area network. And as the name implies, it's a network in a local area. And then WLAN, wireless LAN, wireless local area network. And then WAN, wide area network. And CAN, campus area network. We're going to cover all of these one by one as we proceed. So, let's start with the first one, which is local area network, abbreviated LAN. So, a LAN is a network that connects computers and devices in a small area. Like what? It could be a home office, it could be an office business, could be a school, it could be a building, it could be a company. Any of that is called a LAN. Why do we build a LAN? Because we need to connect the servers for the LAN, we need to connect the printers, the users, and use the internet, for example, or share files or print documents. So, examples of a LAN is all the computer servers, printers, and CCTV cameras in a school. So, if I have a school, I would like to have the library connected to the internet. I would like to provide internet access to the students, maybe, or the teachers. It could be wired or wireless. I want to connect the smart boards in the classrooms to the network as well, so they can share documents and files and stuff like that. And this is how it would look like. So, I have the LAN, which will be composed of or consist of network devices. We're going to talk about what these devices are. And then we can connect servers, we tablets, we can connect printers, smart boards, maybe phones that work on IP on networks, printers, maybe uh security cameras, and screens, laptops. All of these are possible connections in a LAN. And of course, I would connect that into the internet, so students or researchers or teachers or assistants, they will be able to send and receive emails and connect maybe to the Ministry of Education and other sites while performing the classes or while presenting the classes. The second type is WLAN or wireless LAN. So, the wireless LAN, it's similar to what a LAN is, so it's a wireless network in a small area. It could be a shopping mall, could be school, could be an airport. I mean, relatively small, but I'm not talking about 2 m. I mean, it can be multiple buildings even attached or maybe a campus building, but that would be a big or a larger wireless LAN. So, it is like a LAN, but it is wireless. So, we don't use cables to connect all the devices into the network. Examples to that, when we use our phone, laptops, or tablets, when we connect to the Wi-Fi network at home or in the office. That is a wireless LAN. And here's how it would theoretically look like if this is what we are talking about. And of course, we need a device. We call it the wireless router. We'll talk about what a router is later on in order to be able to connect to the internet and then provide the Wi-Fi service to the devices. So, basically, what happens is through Wi-Fi, I can connect to the router, and this router is already connected to the internet because you have to subscribe to the internet to connect your home to the internet, right? You have to call AT&T or maybe Bridge Telecom, and then they will provide you with the Wi-Fi router and the connection. They will send in a technician, maybe, or a do-it-yourself kit, and then you fix it, put the username, passwords, all the stuff that they will send you, and you are connected to the internet, and now your computers can connect to the internet, as well. Then we have wide area network. So, wide area network is a network that connects computers and networks over long distances. So, it could be that I have a branch in New York and another branch in California or the corporate in California, and I would like to connect them to each other. It could be across cities, could be across states, across countries, or even across the globe. The WAN can connect many LANs together, so people can communicate and share files and so on. And here is an example. If we have a company LAN branch in Germany, but the headquarters of the company is in the US. How can we connect them? One way would be to do a WAN connection between them. A high-speed WAN connection, of course, is going to be costly because this is across continents. And then the LAN in Germany and the headquarter LAN in the US can now be connected through that WAN. We're going to look at the details of what a LAN or network devices that can build a LAN and what network devices can build a WAN. And since we are talking about WAN, then what is the largest WAN in the world? And that is the internet. So, this is our largest WAN in the world. So, I can have um someone in a home office in Japan, and maybe a branch office that is in Germany or a company that is in Germany, and they are all connected to the internet, and they can exchange data or access data that is hosted in the US, for example, in the corporate office. So, this is the gigantic WAN that we have, and we are all using it and we are used to it. Now, let's look at types of traffic flow. When we are talking about a network and I have devices connected, do they connect one-to-one or one-to-many or one-to-everyone? How do they communicate? What are the different ways to send traffic in a network? And there are three major types: unicast, multicast, and broadcast. There is another one called anycast, but it's not the time to talk about it now. So, when we when we talk about unicast, what do you mean? If I want to connect to my bank account or online banking, that is one-to-one. I am talking to the bank server, and I'm not sharing that data with anyone else. So, this is one-to-one. As if Sarah and Joan are communicating with each other and they are separately in a meeting room, and there is no one else. So, that's one-to-one traffic between them. So, the data goes from one device in the network to a specific device, from a client to a server, from an iPhone to the HR server, for example, in the company. Then we have multicast. Multicast means one to a group. So, it could be that I have an IPTV server in a hospital, for example, and then the patients in the rooms, they can turn on their TVs. It could be a hotel, as well. They can turn on in their TVs, and I could be watching the same movie that you are watching and someone else is watching. So, that would be one-to-many. That would be multicast or streamed to the others. And Netflix is an example of that, as well. A broadcast, on the other hand, is one-to-all. Like if there is a PA system. Think a PA system connected to the network in an airport. So, when the message is presented or the message is run, now we're talking about British Airways flight number such and such is boarding now, and that is in gate such and such. Everyone who is within the reach of that audio system or a PA system will be able to hear it, right? So, in networking, if one is sending a broadcast, that means everyone on that network is going to receive that traffic. Now, let's talk about wired network devices. If I'm talking about a LAN or a WAN, what are common devices that I may come across when I am building a LAN or building a WAN or even investigating, troubleshooting, configuring, or even just looking at a design? What are the common devices that build a WAN or build a LAN? That's what we need to know now. So, networking devices are needed to create LANs and WANs. So, what are they? What is inside this little bubble here, and what is inside that little cloud over there called a WAN? So, the very first one that you may rarely encounter, because that's an old technology, is called a hub. So, what's a hub? It's a network device that connects multiple computing devices in a LAN. So, can I connect a printer? Yes. Can I connect a laptop? Yes. Can I connect a server? Yes. Can I connect a CCTV monitoring or surveillance camera? Yes, you can do all of that. But it is not intelligent. And here's an example of how a local area network, an inexpensive one, may look like. The disadvantages of a hub, it sends data to all connected devices. So, it's like a broadcast. If any device sends Let's Let's say this laptop is trying to print something to the printer. So, the traffic that will be received is going to be sent on all ports of the hub. And these are ports that I'm talking about. These are the hub ports that we connect the devices to. If this is going to the printer, this should not have been sent here and should not have been sent here. So, it wastes the bandwidth. It wastes the media or it occupies the media of the network for unnecessary reasons, for devices that don't need to receive that traffic. And there is no filtering and there is no intelligence. It's just forwards traffic. That's it. All devices will share the same bandwidth. So, these are major disadvantages of hubs. And it is lower and less secure, as well. Another networking device type that we may encounter when we are building LANs is a switch. And that is an intelligent version of the hub. It is much faster, and it is more intelligent and can do isolation, as well. And here's an example of how a switch from a company called D-Link, for example, looks like. So, this one has 8 * 3, so that's 24 ports. I have here LED indicators, LED indicators. When one of the ports is connected and there is traffic on it, it will be flashing lights, showing that this is connected. And the light can be green, can be red, can be orange to indicate whether it Green means normal operation, orange means there might be some errors, red that means uh a major problem, or maybe it's just switched off, so there is no connection into it. And as you can see, this Each one of these is called a port or an interface. So, this is a switch port where we have the cable connect to. So, these are 24 ports. That means I can connect physically 24 devices to this switch. So, that's an example of how a switch in a LAN would look like. Now, if I take that and I start to connect the devices to it, so each one is going to connect through a physical cable. We're going to look at the details of the cables later on, and that occupies one port, that occupies a second port, third port, fourth port. So, now I have 20 ports left for extra devices or for future connectivity. So, a switch can be physical or virtual. So, this is a physical switch. We can see it. And if it is in front of me, I can touch it, as well. I can power it on. I can connect a cable into it. But there are also software switches. These are the virtual switches, and we're going to cover that as we move on. Advantages of switches compared to hubs, it will send data only to the intended device. So, if we have the same scenario where this laptop would like to send traffic into this printer, the the traffic is going to be switched only between this port and this port. So, this will not see it, and this will not see it. Which means I am segmenting the bandwidth. It's not like one common bandwidth. So, at the same time, this is sending to the printer, it could be that someone sitting on this device is displaying the video from the camera on this monitor, for example. And they are completely separate, and they don't see each other. And it is faster and more secure, because now we can do the isolation. It is intelligent, as well. We can have security features configured, and each connection can use its full speed. If this port is 100 megabits per second or maybe 1 gigabit per second, so it has 1 gig speed into the switch. Similarly, the second third and fourth. And it can handle many devices more efficiently compared to hubs. One important feature when we talk about switches is something called virtual local area network or a VLAN. What is that? So, a switch can be configured. So, we can configure the switch or virtualize the switch to have multiple isolated segments, multiple or completely isolated from one another. They cannot talk to each other. So, separate segments, they are called virtual LANs or VLANs, that can be used to group devices logically. So, as we have discussed the concept of virtualization on a physical server level, that we can have virtual machines into that server, we also can have virtual LANs into the switch. And how can we do this? We can create VLANs, the different segments. Let's say VLAN 10, VLAN 20, VLAN 30, for example. That's the idea of the VLAN. And then we map the switch port to VLAN 10 that we needed to connect to VLAN 10. So, the devices that need to connect to VLAN 10, they are going to be configured or their physical ports on the switch, they are going to be mapped into VLAN 10. Similarly, for VLAN 20 and 30, and so on. Why would I do this? Could be that I need the accountants or the accounting team to be on a separate VLAN, and they can communicate with one another and with their server, but this is sensitive information. I don't want guests that will connect to the network to be able to communicate or maybe sniff or copy that traffic between the accountants for some reason. Okay, and that's how it will look like. So, now I decided the the four left most [clears throat] ports are going to be in VLAN I'm just referencing here the color, but it could be VLAN 10. And the next four ports are going to be configured or mapped into VLAN representing it as red, but this could be VLAN 200, for example. So, any devices that will connect into the red ports or the red map ports will not be able to communicate with the ports that are in the blue or VLAN 10. They will never be able to communicate this way without extra configuration or extra devices. Advantages? This is better security. You can have isolation and segmentation into your uh LAN. And isolation also that data will only go to the right VLAN. So, if I send traffic from this device, it will only be with the basic configuration of only segmentation, only VLANs, it will only be able to communicate with other ports in the same VLAN, and that's it. It will never be able to get into the blue port VLANs unless I do something extra. Okay, so we talked about the hub and we talked about the switch and we talked about the fact that the switch can be segmented or configured to have isolated segments, isolated VLANs. Now, let's talk about the third device that we may encounter when we are dealing with LANs and WANs, as well, and that is the router or the router, however you would like to pronounce it. So, the router will connect different networks together. Networks that are not the same, they will be connected together using a router or a group of routers. And these are some examples of physical routers and how they would look like. In essence, it looks like switch in terms of ports, but the device is a router. That means it has more intelligence than just a switch. And it can have bundled a switching function, but we'll talk about that next. So, the router will know how to send data from one network to another. So, that's the connection between separate networks. And the router, as the switch, can be also physical or it can be software, virtual. And here's an example. So, we have the branch that was in Germany and the head office that was in the US. If I need to connect them, what do I need to do? So, they will have to connect because they are far away from each other. This is a LAN and this is a LAN. They need to connect through routers, through the WAN, and the essence of the WAN is routers. So, I have to procure a router at the Germany branch and another at the US branch. I need to connect each one of the routers to the local LAN. It cannot represent the LAN if it's not connected to it because when traffic will leave one of the devices and needs to get to the US, it has to pass through the router, and the only way is to have a physical connection from the router to the same segment or VLAN where these devices connected to. Then, I need to talk to the service providers, AT&T, for example, or um Verizon Wireless or Bell Canada or whatever the company is, and I will ask them, "Okay, here's the address and here's the address in the US, and I would like to connect this address in Berlin or Germany, whatever the city is, and I want to connect it to the US, and this is the speed I want." You will sign some contracts, they will take some time, provide the connection, provide the configuration, and everything works. So, the router can also be used within a LAN to connect the different VLANs. Remember when we mentioned two slides earlier that a VLAN is a completely isolated segment in a LAN from the other VLANs, right? What if there is a need for me to have one device from here or maybe the monitor watch the video streams that are coming from the camera. How can we do this? This is a network and this is a completely separate network. This is a segment and this is a completely separate segment. So, the only way to do that is to do routing between them because the router is the device that connects multiple LANs together. And how can we do this? The router must be connected to the different VLANs in order to be able to forward traffic between them. And how do we do this? I need to have separate interfaces on the router connect to the different VLANs, and then I will configure the router here to be part of this network and the router here to be part of this network, and then the router will be able to forward traffic between the two when there is traffic to be sent across the two networks. As I mentioned earlier, there could be some switches that are intelligent and they have routing function, or it could be a router that has switching function. No matter how it is, these are called intelligent switches or they could be routers with switch functions. Sometimes they are referenced as multi-layer switches. We are going to talk about why where did the multi-layer come from, but for now, intelligent switch or a switch router combo or an multi-layer switch, they are all synonyms for the same thing. So, the switch router combo device can do both switching and routing functions. And we signified the fact that this can do routing as well by the little icon on the switch. So, in that case, if I need communication between this network and this network, I don't have to have an external router. A combo router here, that means there is a software function on the switch that can do routing as well. So, if I configure that properly, I will be able to allow traffic from the red VLAN into the blue VLAN and the other way around. So, no need for external routers to connect the different VLANs in this case. All right? So, we learned about hubs, switches, VLANs in a switch, segmenting a switch, router, and now we learn about switch router combo, and please remember that a router connects different VLANs. Not devices in the same VLAN. The switch connects the devices in the same VLAN, or it could be multiple VLANs. But a router connects the different VLANs or connects a LAN to another LAN through a WAN. So, we learned about types of networks and network devices that we may encounter. So, network cabling, how can I wire the router into the switch? How can I wire my CCTV camera into the switch? How can I use connectivity in the WAN? What type of cabling, physical cabling that I could use? Is it any cable? Can I just bring any wires and connect them or does it have to be of specific type? And what will be the end connectors that will connect into the devices? That's what we need to see right now. So, network cables are physical wires used to connect computers, routers, switches, and other devices. They can carry electrical signals if they are copper cables, or they could be light signals if they are fiber optic cables. So, let's start with the first one, which is the Ethernet cable or the copper cables. Also, we call it twisted pair or TP cables. They could be UTP, they could be STP, different names for them. These cables have standards and they have standard connectors. Maybe they you have come across them when you are connecting uh your TV, for example, to the wall in order to reach the internet. So, this is called an RJ45 connector, RJ 45. So, that's the standard name for this connector. It has eight pins, eight copper pins, and the cable has eight wires. They are twisted pairs, and that's why it's called a twisted pair. The each two wires are twisted together in a pair, so we have four pairs, and then we have the little pin right here, which latches into the switch port. So, if you look at the pin and here, you'll find that there is a groove on the top of the port. So, there is a wide rectangle and then there is a small rectangle. This is where the pin will latch, and the wires on this side are going to touch on wires on this side in the switch, and that's how it connects into the switch. So, this is used in most homes and offices, short distances, not long distances, and common cable types are Cat 5e enhanced, Cat 5, or Cat 6 and Cat 6a. Depending on which one, it can go for higher speeds, and the distance is usually limited. We're talking about 100 m or 90 m, depending on who you talk to. Okay, and it can carry uh speeds from 100 megabits per second to 10 gigabits per second. It could be with the new technologies and all that could be even higher speeds, but it's usually limited in distance, and the data on the cable, the actual traffic, is represented as electrical signals. So, either there is a voltage or there is no voltage, 1 0. That that's it. We're we're going to come into that later on. So, maximum length is around 100 m. Some people will tell you 100, some people will tell you 90, but it's very limited distance as we speak. The second common cable type that we use in our LANs and WANs is the fiber optic cable. Fiber optic cables carry light signals, and they can go for long distance connections. Believe it or not, the internet has underwater, undersea, and under ocean cables to connect the continents together for the internet. These cables are sturdy, they are very uh rugged and very protected, so there is no water leakage and it's not easy for a fish to cut them and all that. And when any incident happens that one of these cables is cut, you will find a lot of countries suffering if they are dependent on that cable. So, when do we use them? We use them when we need long distances and higher speeds that cannot be achieved using the copper cables or the twisted pair cable. And they convey the data, they encode the data, they represent the traffic in light signals and not in electrical signals. And they are much faster than Ethernet and can travel longer distances and often used by internet service providers and data centers and also they are used commonly in WANs, wide area networks. Now, let's talk about data center network or DCN. So, the data center network, abbreviated DCN, it's a type of a local area network that will connect the servers, storage systems, and networking equipment inside a data center. So, they can communicate and they can serve traffic and they can connect to the internet at a very high speed. So, it is very common to use fiber cables within a data center and not UTP cables. The UTP cables can be used at the end with the servers, that is possible, but fiber is much higher speed and specially for the important servers and so on. And as you can see, the data center switch, it has similar ports like in the normal switches, but the capacity is much higher. The ability to process, so the CPU and the memory and all that are much higher as well. It usually has multiple uh power supplies and usually has multiple processor engines as well, so it can have more availability and one failure in a component will not bring the switch down. A data center may have lots of these switches. I'm here just representing one switch, but it can have 8, 10, 16, 20, depending on the scale of a data center. And the data center usually will have one or more internet connections for diversity and high availability. So, one or more routers are going to connect to the different switches into the data center and that's how they can serve traffic to the internet. So, if I have multiples, that means if one of them dies, the other one is available. And that's called high availability or redundancy. All right. So, we learned about LANs and we learned about data centers. What if I need to connect a LAN into a data center? So, for example, the corporate office exists in a building and adjacent to it, we have another building that is the data center of that bank or that corporate. So, in that case, if the LAN that I would like to connect is close in a closer vicinity, 10 m, 20 m, 1 km, 500 m, but not 500 mi away, it is a very close, then what we can do is we can use a fiber cable, we call it an uplink, from the switch into the data center switch. That is, of course, if this switch is capable of providing fiber optic cables. Here we are only representing a port, but if we use copper cables, these are UTP copper ports. So, if I use a copper cable, that will be only 100 m away or less. But if I want longer distance, 1 km, 2 km, 5 km, then I can use fiber uplinks. And then, of course, I can use multiple ones for redundancy. So, if one fails, the other one will still be available. And through this uplink, now this LAN can connect or share the internet connection that is available in the data center. So, that's how we can consolidate one internet connection, high speed, in the data center and then all the scattered buildings nearby, they can use to route or to use the internet instead of having an internet connection out of each building. What if the LAN that I need to connect to the data center is far away? It is 200 mi away, 500 mi away, in a different country. Then in that case, I have to rely on the WAN, wide area network, not the uplinks. So, in that case, I need to get a router connected to this switch and then talk to the service provider to have a wide area network connection served here and another wide area network connection served in the data center and then proper configuration is done and that is how they can communicate. And of course, the same. If I want to have a central internet connection, then through the router, through the other router, the LAN can be using the internet connection. A corporate or a bank has two big data centers and it would like to have some backups between them. Copies of the data will be sent between them, so if we lose one, the other one will have the data available or the applications available or the websites available. So, how can I interconnect two data centers? And in that case, it depends on whether they are in a close by vicinity or are far away from each other, but the common one is that we connect them through routers. That is more common, although connecting them through switches is possible as well, but if we connect them through routers, then what we'll do is again, we need a larger size router that can perform much better under load and it can provide higher speeds. And then the WAN connection and that's how they connect to the two sites and each one of the data centers can have a separate internet connection, so if we lose one of the data centers or one of the connections, the LANs connected, they will be interconnected to this one and to that one. So, the LAN or one of the branches, if I lose one data center connection or I lose the switch in the data center, then they can reach the other data center through this connection instead. All right? So, routers can help me connect data centers, not only connect wide area network branches and local area networks only. The other type of uh networks that we need to talk about is called campus area network. And that as the word implies, campus, so multiple buildings close to each other. It could be a university, it could be a hospital, it could be a ministry. Multiple buildings nearby, they can be connected through campus or a CAN, campus area network or a CAN. And here's an example. I have a data center and nearby, could be 500 m away, I have building B and maybe 1 km away, I have building A. And I have a LAN inside each one of these. And I could have also wireless LAN and a LAN in one of the buildings. So, in that case, and I have the switches connecting all the devices. So, within a building, we are fine. We can connect and we can share and we can print and everything. Within the other building, yes, we can do that as well. But we need to connect to our servers or website or human resources department uh servers on the internet or maybe we need to connect to the internet, generally speaking. Then, in that case, if the decision was made to connect the data center to the internet and have common internet connection for all of them, then we can connect them using uplinks and these will be fiber optic because they can go higher speeds and longer distances, not copper cables in that case or UTP cables. All right? So, that's a CAN. So, it's a private high speed network that links several buildings on one campus or a limited area, like a university, hospital, or company campus. Of course, there is MAN as well, metropolitan area network and so on, but it is enough. We learned about LAN, wireless LAN, WAN, and CAN and that is more than enough for our purpose of this course. Since we talked about the wired parts, let's now talk about the wireless network devices. So, what devices that are wireless that we may encounter as we build networks? So, wireless network devices are needed to create wireless LANs. And as we looked at the example in the home office, I need a wireless device that will broadcast the wireless LAN and will also be able to authenticate or basically check the username and the password when they log in to the wireless network. The first device that we need to talk about is called a WAP or a wireless access point. A wireless access point is a device that provides Wi-Fi signals, broadcasts Wi-Fi or broadcasts wireless LANs into a certain coverage area, for example, at an airport or in a school. And if the area is large, then I may need more than one WAP. One will not be enough. And this is how they look like. Maybe when you are walking down your company or street or school or shopping mall, look at the ceiling, look at the walls, you'll find devices similar to these. These are the wireless access points. In the outside, in the outdoors, they have to be rugged and they have to be industrial grade and that's how they look different on the outdoors. A WAP or a wireless access point is not a router, not necessarily a router. It doesn't have routing function. It only broadcasts the actual wireless signals and then it connects through a cable into the LAN. So, here is a wireless access point. It will broadcast the signal and that's how devices will connect into the wireless LAN. But is that it? How can I connect to the internet? How can I connect to the actual network? Let's find out. So, a WAP extends your network, it doesn't create a new one. So, when it creates a wireless LAN, the wireless access point itself has to connect into your network. At the end of the day, what you need in your devices not to connect to the web. You need to be hooked into the wireless access and then from there you'd like to get to the internet. So, there has to be a LAN backing the wireless network. And it will have a wired connection into that switch. In larger offices, we will also need multiple wireless access points because the coverage area is larger and one web is not enough. All right? So, now we have multiple devices, maybe wing A and wing B in the building. So, wing A will have one or more access points to cover all the area and have provide strong signal. And also for wing B will have one or more depending on the size of the building. So, we have that connected to the LAN. And then, how can we get to the internet? That means we have to have a routing function or a routing device connected to the internet and to that switch in the same VLAN as that connection in order to be able to provide wireless and then wired connection for the traffic to go out to the internet. One would jump now and say, "Okay, now but I don't I don't have that in my in my home and I don't have that in my home. I only have one device and my network is connected to it and everything works fine." I would say, "Yes, absolutely because that's a special case and this is how it looks like. But then, you need not a wireless access point only, but you need a device that can do wireless access point function and routing or routing function as well. So, it would look something like this or maybe something like this. And most of them, they would have a switch built in as well. So, that would the backside would look something like this. So, go check your wireless router right now that you have at your home and you will find that it may have antennas. The modern types, they don't have antennas, they have it built in. And you will have at least two or more ports of connection or physical connections that can hook to the network. So, in that case, what happens? You will have one port that will be connected to the service provider. Usually, it is a special port and you will have either internet or WAN written on that. And then you will have this because if I have a printer, the printer needs a wired connection, not a wireless connection. In this case, we can take advantage of the back ports for wired connections. So, it will serve the wired connection requirements and the wireless through the antennas and that connects to the internet. So, this is a Wi-Fi access point that has routing function as well and it will have a built-in mini switch to connect the wired devices. So, hopefully that's clear. Now, we know about hubs, we know about switches and we know about virtualizing a switch into multiple uh switches or mini switches called VLANs. And then, we learned about routers and routers connect different networks and we learned about data center network and now we we learned also about network devices that are wireless like wireless access point or wireless routers. All right? Hopefully, that was clear and easy to understand. Let's zoom into or have a closer look into the internet. The internet consists of millions of local area networks, data centers, home offices and offices and homes and wide area networks connected through routers and high-speed links creating one global network. That's what the internet is. So, I may have a corporate data center in India and we have that data center switches, we have the router and it's connected to the internet and I have databases and applications and storage and so on. Maybe I have a branch in Germany that needs to connect to that data center. So, that corporate data center is in India, but the company has a branch in Germany. So, I have a LAN in Germany and maybe a wireless LAN as well. I need to connect it to the data center. How can I do it? Have a router connected to the internet. So, there was a possibility to connect it through WAN that we talked about previously, but also we can connect it through the internet. How can we make it secure? We'll talk about that later on. And maybe also one of the employees works in the UK in a home office and they need or he needs or she needs to connect through the internet also to the data center. So, that's all possible and that's what the internet does, the largest global network or global WAN in the world. So, a closer look into that. What does the internet consists of? So, as we mentioned, we have home-based users, we have separate users in a library, we have data centers in other places and that is routers connected via very high-speed links and that is what actually forms the internet. So, high-speed connections interconnecting tens of millions maybe of routers across the globe and that is what the internet is that everyone connects to. And once you are connected to the internet, you can communicate with the rest of the internet. All right, it's time to start module five and this will be about first steps into diving deep into networking fundamentals. So, understanding more about the networks and the first thing we need to understand is why do we need IP addresses and how do they look like and how can we deal with them. And by the end of this module, you will be able not only to spot IP addresses and recognize them and identify the different networks, but also you'll be able to be given a block of IP addresses and design according to requirements an IP scheme breaking down that block into multiple networks and sub networks and assigning them to WANs and LANs and so on. So, we are going to cover what are IP addresses and why do we need them and how do they look like. Numbering systems, we'll get into a little bit of math. I will make it super easy. I promise you. I know a lot of you hate math, but I'm going to give you the analogies where it will make it a lot more easier because you need to understand how computers can comprehend IP addresses and how can distinguish a local IP address from a remote IP address and then send the traffic to the router or not depending on where it is. So, we'll talk about decimal, which is the numbering system we all know, the 10, 20, 15, 32. This is what we are used to. But also, we'll introduce how computers deal with numbers and text and data, which is binary. And we are going to show you how you can convert from decimal to binary, from binary to decimal. We look at the IP address types. There are two versions, IPv4 and IPv6. We'll look at what are the differences between them. We'll also look at hosts and networks. How can we assign to the servers on a specific network IP addresses and how can I tell whether they belong to the same network or to different networks. We'll look at something called the subnet mask and we'll do a lot of practice on that. We'll look at the IP address classes. We have class A, B, and C. We'll look at them and you will be able to distinguish between the different classes when you see an IP address. I will show you how to break down a range or a block of IP addresses the easy way using online tools. And also, we are going to show you the detailed way of how you can do it if you would like to practice doing that. And of course, those of you who are going to dive deeper into networking, they should be able to understand how that is broken down and how it works and how to calculate them and all that stuff. So, that will be the IP subnetting in details. And then, we I'm going to provide you with a table that has subnets ready for your use if you would like to train without going into all that hassle every time calculating what the subnets are and all that. So, these are going to be handy anytime you'd like to create networks in the cloud and practice on addresses and how do they relate to the internet and what are private IP addresses. So, we have a very long module ahead of us, but very interesting and I'll make it super easy. I promise. So, please hang in there. Networking fundamentals are very key to any engineering role in the recent or the modern IT. And also, if you would like to build networks as a developer and you start launching your application and databases and different apps and put security in between, then you need to know also all these IP addresses thing. And this is where a lot of people get stuck in getting into cloud and getting into IT because they would say, "This is above my head. I can't understand it. It involves math. No, no, no, no, not for me." Stay with me and I promise you that it will be super easy by the end. I will make it super easy. All right? The first thing we are going to look at will be the IP addressing and why do we need it. Let's look at analogies from our life and find out if that is relevant or it makes sense or it doesn't make sense. How can people communicate? It's very easy. Even if I don't know you and you don't know me, I can smile and say hi and you're you're going to say hi back and I'm going to ask you, "Uh what do you do here? How's your coffee? How's your day?" This and that. And then we start and we get to know each other, maybe introduce our names and maybe phone numbers later on and then probably a friendship starts or something. And we use names to distinguish each other. So, if we have a group of people standing in a park for example, then George and Ahmed and Sarah and Layla and Sneha, they can be in in a classroom, they can be in a hospital, in a match. And if they know each other, they can call each other by name. Or if they have badges, I'm going to read the badge that you have, and then I'm going to call you by your name. Same thing for mobile phones. Each one has a unique number, and that number is not used by anyone else in the globe. If the number is the same, the country code will be different, and the area code will be different. So, numbers can repeat, but not the area code and the country code. So, there globally, there are no two people using the same phone number if you add the country code and the area code. Why do we have unique numbers? Because when I'm calling you, if you don't have a unique number, I'm going to call the wrong person, or maybe multiple people will pick up the phone. But I want to reach you and nobody else. If I would like to call Sarah Joan, for example, this is her number on my phone, and I'm going to push the screen or click on the screen on that one, and it will start calling Sarah. Same thing, Sarah has my number, and my phone number and my name. So, as soon as the phone rings, she will look and she'll find Ahmed Eid is calling. And depends on how important the call, if she's available, if she's free, and if she's in a meeting, she'll just mute it and call Ahmed back later on. So, each user of a mobile phone has a unique number as well. Individuals have mailing addresses, and that's how they receive Amazon deliveries and food deliveries and so on. So, John Smith lives in 32 University Street in Boston, Massachusetts, and that's the zip code, and it is a house. Similarly, Sarah Halim, she lives in 122 Maidan Street, Dokki, in Cairo, in Egypt. She has a postal or PO box, and she lives in a house as well. So, street number is enough to deliver the package to the house. That's more than enough. So, if John Smith from the US would like to send something to Sarah, then he will write to, so that's the recipient, the other party, and the details of the address of Sarah, and then from, who is the sender, so that is uh John Smith, and of course, there will be a stamp, and that will be sent through United States Postal Service. It will get to Sarah eventually, and it will be delivered using the Egyptian post to her address. She will read the letter, and then maybe she will respond and send it back. The same thing applies to email addresses. I send you an email, you know who sent it to you, and then you reply to my email address. So, if Sarah would like to respond to John through a letter in an envelope, then she will be the sender, and he will be the receiver. And again, the postal services, if the address is correct, they will be able to deliver it back. So, this is all human being stuff, and it's very common to all of us. Now, the question is, if I have a desktop connected to the internet in Germany, and another one in Brazil, and I have a mobile phone user in Egypt connected to the internet, and a laptop user with a browser in India. How can they all get to amazon.com? They want to buy stuff from amazon.com. They would like to get into the e-commerce website of Amazon, and then each one of them is going to look at the products, and then decide what to buy. How can we ensure that the internet will not be confused that if this guy will communicate with Amazon, and and they're looking at watches, the response will not go by mistake into the user in India, or maybe the user in Egypt. And if the user in Brazil is looking at soccer balls, how do we ensure that the response will be addressed properly to the right place? That means we need unique addresses for anything connected to the internet, and that is called an IP address, an Internet Protocol address. So, if we take one of these users that would like to get into Dolphin Ed Academy, which is hosted on the internet, on a server, then how can they approach or address the request sent to the website to sign in? And how would the server know who is the sender, so they can respond to the correct user and provide the sign-in page? So, we need an address. We need a client address, and we need a Dolphin Ed Academy server address. Who's going to do the connection between them two? Because they are different networks, and this could be could be in the US, and the user could be in Egypt. So, that means we have to have routing, because the only way we learned that we can connect two different networks is through routers. So, we have to have routing functionality in between, at least one in the internet, and we said that the internet is a gigantic number of routers or routers connected together with high-speed links, right? So, what is the name of that address? What's the name of this address? And these are called IP addresses. And why are they called IP? Because it stands for Internet Protocol, which is a set of rules that are standardized globally that govern how data is sent and received over the internet or any other network. There used to be other protocols for other ways to build networks, but now IP is the predominant one. So, think of the Internet Protocol as the postal system on the internet or any other network, whether it is in a data center or in a local area network or a wireless LAN. So, now the IP address, or the address of the client, is called the client IP address, and that of the server is called the server IP address. And the routing function is called IP routing as well, because now we are speaking a common global language on the internet called Internet Protocol, the IP language. So, if we extend that and give an example, then the IP will define IP address blocks, of which IP addresses they will get assigned to each device. And if you are on the internet, like the phone system, it has to be a unique IP address to define you on the internet. It has to be. There is no budging on this. It can't be that my home wireless LAN and your home wireless LAN are using exactly the same internet IP address. There is no way this will happen. And we are going to get into how this is guaranteed. Okay. So, we need the client IP address, and we need the IP routing. So, IP Protocol as well will define how routing can happen, and how routers function, and how they understand messages, and how they can forward them. So, all of this is within the IP realm of protocols or functionalities. The messages sent from me to the server, and from the server responses to me, they are called IP packets. Now, let's look at the format of the IP addresses. How would an IP address look like? If we extend that into the client-server web application that we have looked at, then we need an IP address on the client side. Here is an example. This is how it looks like, a number {dot} a number {dot} a number {dot} a number. And we need the IP routing functionality here, and this could be the IP address on the server. Just examples. So, the client, no matter what, must have an IP address, and the server you're trying to get to must have an IP address as well. How can we define or find the device IP address that we are using? How can I confirm that I have an IP address on my computer, for example? Then, if you are using a Windows laptop or a Windows device, then you can open the command CMD, go in the search bar at the bottom, and then click CMD type CMD and click. A black window will open, and then you can go and do IP config. That's That's it. So, you will have a prompt like this, and then you just type IP config and hit enter. You will get the IP configuration on your machine, and you will get either the wired or the wireless will have an IP address for you. If this was on a Linux or a Mac OS device, you can use the IPA command. That is possible. Maybe it will work. If it's not installed, the IP utility on your laptop or on your Mac on your Linux, you can use a different command like the IP config get IF get interface address EN0. And let me show you that on my Mac to prove that I have an IP address. So, here's my terminal, and what I will do is I'm going to do IP config get IF address, and that is EN0, and you'll find that it has an IP address, as you can see here. So, 192.168.68.108. So, that is a number {dot} a number {dot} a number {dot} a number, and that's how an IP address looks like. So, use IP config enter if you are on Windows after you open the CMD, the command, and you will see that. If you are on Linux, try this, and try this. One of them should work. So, the IP address available versions are IPv4 and IPv6. The IPv4 is easy to understand when you look at it. It is 32-bits long. We are going to talk about what a bit means very uh soon in the next slides. And it is four fields separated by {dot}, as you can see here. So, 120 {dot} 130 {dot} 233 {dot} and then 12. It requires a subnet mask. We are going talk about what that is. Can have public or private ranges. We're also going to cover that later on. The IPv6 is written or represented in hexadecimal notation. So, you might see letters A A to F and you might see numbers as well. It's 128 bits long, eight fields, and an example is a number colon number colon number colon. And as I mentioned, you can see numbers and you can see A to F symbols as well. And it requires a subnet mask as well and can have public or private ranges as well. So, how can computers read IP addresses? How can the computer or my device or my phone be able to read this IP and to make sense of it or read that IP and make sense of it? How is that possible? How can we allow computers and computing devices to read this IP address and recognize them and find out which networks they reside on and what are the host identity on that network? This is very important and that's why we will a little bit get into some simple math to explain to you how is that represented inside the computer because the computer does not have eyes to speak or read English and find out the decimal and the hexadecimal and other representation. Everything inside the computer is binary, binary numbering system. So, we need to understand it at a high level to be able to break down IP addresses and explain to you how that happens in a computer. All right. Now, let's introduce a little bit of simple math and we are going to compare that to the decimal numbering system that we all know and deal with every day when we pay money, when you calculate the change and all that because we need to understand how do computing devices understand IP addresses and how can they tell if an IP address belongs to their local network or needs to communicate with an external network or another network. So, to do that, let's refresh our knowledge about the decimal numbering system. Several numbering systems exist. We are used to the decimal one, the one that has the symbols 0 1 2 3 4 5 6 7 8 9. And any number that we use today consists of a combination of these digits, we call them, or these symbols. And there are 10 symbols and that's why we call them decimal because it has five and then another five. So, from 0 to 9, including 0, are 10 symbols, not nine symbols. Computing devices, they use the binary numbering system internally. And this has only two symbols, that's why it's called binary, the 0 and the 1. There also exists other numbering system and as an example, the hexadecimal. Hexadecimal means 16. Hex is 16. And has 16 symbols and they start from 0 all the way to 9 and then A B C D E F. So, from 0 to 9 is 10 and then 2 4 6. That's why it's 16. Example, if we have a number 521, that is decimal. Can we represent that in binary? Of course, we can. And that will be the representation because we can only use 0 and 1 in binary. And in hex, it will look something like this. 0x, which means means hexadecimal, and then 209. Don't worry about the conversion. If you would like to use your calculator to to confirm this, that's fine, but we are going to explain the binary. We are not going to explain the hexadecimal in this course. Computing devices use binary numbering systems internally. Even your calculator, even if it is a handheld calculator and you are typing numbers and doing mathematical equations internally within the calculator, it's zeros and ones. It's converted into binary and represented as binary within the calculator. And that is true for your phone, for your laptop, for your iPad, for your computer, and so on. Decimal numbering system, when we have a number like this, how do we pronounce it? We don't say 3 4 5. We say 345. Why did we say about the three 300? And why we did we say about the four 40? As if we are multiplying by 10 and here we are multiplying by 100 and this is only five, 345. This is because depending on where the digit sits, where it is located in the combination of symbols, that has a weight. Each position has a weight. And this is something we all know. So, let's say if I'm looking from the right-hand side on the first, second, third, and fourth positions, we know that the first one is called the units and this is the tens and this is the hundreds and this is the thousands and so on. And why do we call them like that? Because any number that exists in the first position, its weight is multiplied by one and that will be the weight of the position itself. Then, we have the second position, which is tens, and that is 10 times one. The hundreds is 10 times 10 or 100. That's the weight. And then the thousands is 10 times 10 times 10, which is 1,000. So, if we have the number 345, the reason is this is in the hundreds position, so it is not three, it is 300, three times the weight. Here, it is four times the weight, that's why it's 40. And here, it is five times one and that's why it's only five. And if we have a number like this, we would call it or we would pronounce it as spell it as 5,394, exactly because of the same reason. It's five times the weight of the fourth position and three times the weight of the third position, nine times the weight of the second position, and then four times the weight of the first position. And that's exactly how it looks and the position weight is how it is written in this row. And if we multiply these, we can get each digit what it is exactly. And then if we combine these, we get the total number. So, it's 5,394. So, this is how it looks in decimal. How is it in binary? Let's consider that next. All right. Let's now have a brief overview of the binary numbering system and I promise you it is easy to understand, so don't freak out. The binary numbering system has only two symbols, the 0 and the 1. Each digit in binary number is called a binary digit or bit. Remember when we said that the IPv4 or the IP address is 32-bit long? So, we call it in decimal digit only, here we say it's binary digit abbreviated a bit. So, when we say a digit, we're talking about decimal. When we say a bit, we're talking about binary. For example, this long number or long binary string is a representation of 521. Let's look at something called exponents. That's also in math, we use it. And this is a shortcut for repeated multiplication. We use it a lot in binary and that's why we are bringing that in here. So, for example, if we multiply 2 * 2, that's 4 * 2 is 8 * 2 is 16. Okay? So, this is a two multiplied by itself four times and that's the 16. Is there a way we can shortcut or we we can represent this in a shorter form? And the answer is absolutely, we can do this and it is the base is two and the number of times it's multiplied by itself is the exponent. So, this is the base and this is the exponent. All right? And it's pronounced two to the power four. And it can also be written like this, two control four, and that means two to the power four. That means 2 * 2 * 2 * 2. If I say three to the power two, means what? 3 * 3. 3 to the power five, that means 3 * 3 * 3 * 3 * 3, five times. Any number to the power zero is one. So, 2 to the power zero is one. 10 to the power zero is one. But we are going to focus on binary again. So, what's about the weight of the position when it comes to binary? So, as in the decimal system, each bit position in binary has a weight. As we spoke about the tens and the units, tens, hundreds, and thousands, here, it doesn't spell like tens or hundreds or anything because we don't have 10. We have only 0 and 1. So, let's look at the first position, the first on the right-hand side. So, the first position's weight is one. The second position is weight is two two times one, which is two. And guess what will be the third one? It will be 2 * 2 because in decimal we did one and then time 10 * 1 and then 10 10 * 10 and then 10 * 10 * 10 for the thousands and so on. Here, it's exactly the same, but we replace the 10 by 2. So, 1 * 1 is 1, that's the weight of this position. 2 * 1 is 2, that's the weight of this position. 2 * 2 is 4 and that's the weight of this position. Guess what will be the next one? Yes, two times two times two, which is eight. And then, 2 * 2 * 2 * 2, which is 16. And then 2 to the power 5, which is five times, that's 32, 64, 128, 256, 512, 1024, and so on. We are only going to focus on eight bits long strings because the IPv4 address or the IP address has four eight-bit numbers. So, let's go ahead and look at how we can convert decimal numbers into binary. And all of these strings are going to be eight bits long. So, I'm not going to go to seven or nine. We're going to stick to eight all the time. Because it is relevant to the IP address discussion that we're going to do next. So, if I would like to represent the decimal number zero in an eight-bit string, well, it's obvious. That will be all zeros because I can't take the weight in any one position. If you put one in any one of these positions, you have to account for its weight in the result. And zero has to be all zeros. How about one? We start from the rightmost position, and then that will be a one, and else is going to be zeros. Which means that is the weight is one. 1 * 1 is 1, so it's exactly the same. Two, that will be zero in the first position, and then I'm going to put a one in the second position. Why? Because the weight here is two, and I want a two. What if I want a three? What if I want to convert three? So, I'm going to take the two and the one with me. What if I want to represent four? This one cannot help me. This one cannot help me. The third one, the weight is four. So, that's why I'll take it. Remember that the weights are 1 2 4 8 16, and so on. Five, that means 4 + 1. Six, that means 4 + 2. Seven, that means 4 + 2 + 1. The weight here is 4. The weight here is 2. The weight here is 1. If I add 1 + 2 + 4, that is 7. 8. That is 0 0 0, and then the weight in the fourth position is 8. So, I'm going to put a one there. Nine, it is going to be 8 + 1. 10, it's going to be 8 + 2. 11, that will be 8 + 2 + 1. 12, that will be 8 + 4. And so on. So, I think you get the point, and that is how it works. So, 16, for example, 16 means I'm going to get the position that has 16 within that number, and then the rest is zeros on the left and on the right. Let's pick another number. Let's pick, for example, 31. 31 means 16 + 8, that is 24. + 4, that is 28. + 2, that is 30. And + 1, that is 31. If I need to shift to 32, the next number, that means I cannot have zeros in the very first five positions, and then I'm going to put a one in the position where its weight is 32. 33, that means 32 + 1. And so on until we get to 63. 63 means 32 + This has a mistake here, so it should be one. So, it's 30 32 + 16 + 8 + 4 + 2 + 1. So, that's 48 + 8, that is 56. 56 + 4 is 60, and then 62 63. Okay? And afterwards, if I would like to get to 64, then I have to zero all these ones because I'm going to take the position that has a weight of 64. What if I want 127? What do you think the equivalent numbers are going to be? Can I take the eighth position? And the answer is no, I cannot. Why? Because the weight is 128, and that's larger than the number I want. And then the next one, 64, I'm going to take it. Why? Because it's less than 127. 32, the next one. 32 + 64 is 96. So, that's less than 27. And what's the next one? That is going to be 16. 16 + 96 is 112. So, it's still less than 127. What about the next one? The next one is going to be eight. So, 112 + 8 is 120. So, I'm going to take it with me. How about the next one? The next one is four. So, that's 124. What are we missing? We are missing the two and the one. So, seven ones are going to give me the 127. What will be the 128? That will be one, and then 0 0 0 0 0 0 0. How did I get to that? Because the weight here on the on the eighth position is 128, and that means I don't need anything else. We are going to practice a lot on this one, and you are going to be proficient as you get to it. So, that's 127 128. How about 192? 192 is, if you think about it, that is 128 + 64. If you do the math, you'll find exactly these are what you need, and then you don't need anything else because you have already reached the decimal equivalent that you want. How about if we put all ones in an eight-bit string? What will be the equivalent? The equivalent is going to be 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1. If you combine all of these, you'll end up with 255. So, the largest number you can have in an eight-bit string is 255. And the lowest number is all zeros, which will give you zero. So, the range is from zero to 255 when it comes to an eight-bit string. And these are 256 different numbers. One would tell me, "No, no, no, no, no, hold on. This is 255 only." I would say, "No, that's That's incorrect." Let's take a simpler example. If it is 0 1 2 3, how many symbols do you have? How many numbers do you have? You have four, although you are starting from zero. Similarly, if I start at zero and end at 255, that means I have 256 different numbers that I can represent by an eight-bit string in binary. How about if it is only two bits? Two positions. How many can you represent? Let's see. It's 0 0. 0 1, that's a different number. 1 0 is a different combination. And then 1 1. So, that means in two bits, I can represent four different numbers. And these are 0 1 2 and 3 in decimal. We're going to practice a lot more on this, so you are going to be familiar with it. All right. So, let's do binary to decimal practice. Let's do more examples, and these are going to be random, and I will show you the table of the weights, so it will be much easier to decide on this. All right. So, what if I forget the numbers? I forgot the bit positions. How can I find it? The first one is one. Remember that, and then any other one is 2 to the power one. So, here 2 to the power I'm sorry, n, not one. And n is the the bit position. So, this is the second So, this is the second position. That means 2 * 1, it's it's two. This is the third position. So, you need to multiply two times. So, that is 2 to the power 2, which is four. This will be 2 to the power 3. So, 2 * 2 * 2, that's 8. And then 4 16 32 64 128. And we will always deal with eight-bit long symbols or strings, and that's what relates to the IP addresses that we are going to discuss. So, for networking, for cyber security, for development, for cloud, for anything, all you need to know in binary is the eight-bit string conversion, and you'll be good to go. So, here is a practice. Find the equivalent in decimal for the following binary. So, this is the rightmost, so this is position one, and this is position eight. So, the weight here is 128. And then 64 32 16, and so on. So, let's put it in a table. It will be easier for us to remember it. So, we need to map this binary into this weights and positions. So, this one is going to map to the rightmost, and this one is going to map to the leftmost. So, let's write it in a cleaner way. So, it is 0 0 1 1 0 0 1 1, and then all zeros. We need to look at the positions where the binary or the bit is equivalent to one, and we take the corresponding weights, add them together, and that will be the result. So, here I only have two ones in the four position and in the eight position. So, 8 + 4 is 12. That's the equivalent to this number. Let's do another one. Here's another one. 0 1 1 0 and 1 1 0 0. So, let's map that to our table. And that will be a one in the third position, fourth position, and then sixth and seventh positions. So, I have one one and one and one. So, what are the corresponding weights? 4 8 32 and 64. Why I will not take the 128? Because the corresponding bit is zero. Zero times anything is zero. Similarly, zero times anything is zero. Zero times anything is zero. Zero times anything is zero. That's why I just ignored them. So, I need to add 64 + 32 + 8 + 4. So, these are 96 and these are 12. 96 + 12 that will be 108. Another example. What if I have this binary string 1001 1100? Again, this table should be implanted somehow or it should be stored in your mind after you practice a little bit. So, here is what we have. We have 1 001 and then 1100. So, what are the corresponding weights that we need to add? 8 and 4 and 16 and 128. So, this is this does not count. This does not count. And this does not count and this does not count. So, 128 + 16 that is 144. + 4 that is 148 + 8 that is 156. All right? You can use the calculator if you would like to make it easier for you. I like to do the mind math, but it's up to you. Here is another one. 10100011. So, here's our table and here is the mapping. So, 1010. So, this is uh with us and this is with us as well. And then 11 at the end and all the others are ignored. So, we ignore these completely. 128 + 32. So, that is going to be 160 + 3 that's 163. Next one. 11001100. Although they look the same, but because of the bit positions, they will have different I like these four are going to weigh much heavier than these four because of their positions. So, if you look at this and then we map our table, then we have this one is in, this one is in, and then we have this one is in, and this one is in. And you can see the weight of a one here is four and the weight of a one here is 64. The weight of the left left most one here is 128, whereas this one is only eight. So, that is 12 and then we have 192. That is 204. So, hopefully that is easy to understand and do. Always write down this table if you are not sure about the weights. And the rule is very very simple. Wherever you have zero, ignore the corresponding weight. Wherever you have one, you need to add the weight or the corresponding weight to all the other weights that are accounted for and that is how you get the decimal equivalent. Hopefully that is easy and hopefully you are not bored. I promised you that it's going to be simple and that's the hardest it will get. So, don't worry about it. All right. So, let's do binary to decimal practice. Let's do more examples and these are going to be random and I will show you the table of the weights, so it will be much easier to decide on this. All right. So, what if I forget the numbers? I forgot the bit positions. How can I find it? The first one is one. Remember that and then any other one is two to the power one. So, here two to the power I'm sorry, N not one. And N is the the bit position. So, this is the second position. That means two times one it's it's two. This is the third position. So, you need to multiply two twice. So, that is two to the power two, which is four. This will be two to the power three. Two so, two times two times two. That's eight. And then four 16 32 64 128. And we will always deal with eight bits long symbols or strings and that's what relates to the IP addresses that you are going to discuss. So, for networking, for cyber security, for development, for cloud, for anything, all you need to know in binary is the eight-bit string conversion and you will be good to go. So, here is a practice. Find the equivalent in decimal for the following binary. So, this is the right most. So, this is position one and this is position eight. So, the weight here is 128 and then 64 32 16 and so on. So, let's put it in a table. It will be easier for us to remember it. So, we need to map this binary into this weights and positions. So, this one is going to map to the right most and this one is going to map to the left most. So, let's write it in a cleaner way. So, it is 00110011 and then all zeros. We need to look at the positions where the binary or the bit is equivalent to one and we take the corresponding weights, add them together, and that will be the result. So, here I only have two ones in the fourth position and in the eighth position. So, 8 + 4 is 12. That's the equivalent to this number. Let's do another one. Here is another one. 0110 and 1100. So, let's map that to our table and that will be a one in the third position, fourth position, and then sixth and seventh positions. So, I have one one and one and one. So, what are the corresponding weights? 4 8 32 and 64. Why I will not take the 128? Because the corresponding bit is zero. Zero times anything is zero. Similarly, zero times anything is zero. Zero times anything is zero. Zero times anything is zero. That's why I just ignored them. So, I need to add 64 + 32 + 8 + 4. So, these are 96 and these are 12. 96 + 12 that will be 108. Another example. What if I have this binary string 10011100? Again, this table should be implanted somehow or it should be stored in your mind after you practice a little bit. So, here is what we have. We have 1 001 and then 1100. So, what are the corresponding weights that we need to add? 8 and 4 and 16 and 128. So, this is this does not count. This does not count. And this does not count and this does not count. So, 128 + 16 that is 144. + 4 that is 148 + 8 that is 156. All right? You can use the calculator if you would like to make it easier for you. I like to do the mind math, but it's up to you. Here is another one. 10100011. So, here's our table and here is the mapping. So, 1010. So, this is uh with us and this is with us as well. And then 11 at the end and all the others are ignored. So, we ignore these completely. 128 + 32. So, that is going to be 160 + 3 that's 163. Next one. 11001100. Although they look the same, but because of the bit positions, they will have different I like these four are going to weigh much heavier than these four because of their positions. So, if you look at this and then we map our table, then we have this one is in, this one is in, and then we have this one is in, and this one is in. And you can see the weight of a one here is four and the weight of a one here is 64. The weight of the left left most one here is 128, whereas this one is only eight. So, that is 12 and then we have 192. That is 204. So, hopefully that is easy to understand and do. Always write down this table if you are not sure about the weights. And the rule is very very simple. Wherever you have zero, ignore the corresponding weight. Wherever you have one, you need to add the weight or the corresponding weight to all the other weights that are accounted for and that is how you get the decimal equivalent. Hopefully that is easy and hopefully you are not bored. I promised you that it's going to be simple and that's the hardest it will get. So, don't worry about it. All right. Let's now do the other way around. What if I give you a decimal number and I asked you what is the corresponding binary? So, let's do some practice and see if that is difficult or easy. So, here's a a question. What is the binary equivalent and and we need eight bits string that will be corresponding to 191? Now, how would we do this? Let's go ahead with the bit positions again. Now, we'll do the reverse one. Which of these weights I should write a corresponding one to and which I should ignore? So, let's find out. 191 is larger than 128, right? So, I'm going to take the 128 with me. Do I take the 64? Well, if we put one here, that means it will be 64 + 128, that is already 192. That means I cannot take the 64 with me, so it has to be a zero. Do we take the 32? It all depends. If you add this weight with the previous ones that you accounted for, is it going to be larger than 191? Then don't take it. If it's going to be less than go ahead and take it. 128, we are going to ignore this one as if it does not exist because we put a zero in here. 128 + 32, that is 160. Is it less than 191? Yes, it is. Then take the 32 with you. Fine. Do we take the 16 or not? All depends. If you add 128 and 32 from before and 16, is it less than 191? And the answer is yes because we said 128 + 32 is 160. If we add to them 16, that will be 176. So nothing stops me from taking this one, that's why I'm going to mark it as one to take the corresponding weight. How about the eight? So we have Here we have 176. So we are If we compare 176 to 191, we are 15 short. So we need to represent another 15 by ones and we should be good to go. So do we take the eight? Of course, that is less than 15. I will take it. So now it is 176 + 8, that is 184. Do we take the four? If we take four with 184, that will be 188. I will take it. We are still three short, so I will take these two as well. The corresponding binary for that is going to be Let me just erase this. So what we decided is going to be 1 0 and then all ones, and we are going to compare it to what we have. So if we write this, you'll find that it's exactly what we have reached, which is 1011 and then the rest is ones. All right, so that's the corresponding binary for 191. Find the binary equivalent of 238. Remember, if you are given anything that is less or equal to 255, you can represent by eight bits. Otherwise, you'll have to go to nine or 10 or more bits. And more than eight bits is irrelevant to the IP address study that we need to make. So 238, do we take the 128? Yes. Do we take the 164? Yes, because if you add these two, it's 192. Do we take the 32? Yes, because if you add these three, it's going to be 224, which is less than 238, so I will take it. Do we take the 16? No, I'm sorry, we cannot because if we add 16 to 224, it will become 240 and that is larger than 238. All right, we still have 224 and we are 14 short to get to this number. Do we take the eight? I would say yes because 224 + 8 is 232 and that is less than 238. And we are only six short. So do we take the four? Yes. 232 + 4 is 236 and we are only two left and then I don't take the one. And if you look at the result, it's exactly the same. 11101110. So hopefully that was easy. Now I want you to write any numbers less or equal to 255 and you start the conversion. And how would you find if the answer is correct or not? You can go in ChatGPT, for example. Let's check if 238 maps to 1101110. All right, so let me go here and open ChatGPT. And you can stay logged out if you want and I'm going to ask, what is the binary equivalent of 238 in decimal. As you can see, you are just typing exactly what you are looking for. There is no science to it. And hit enter. And not sure if you can see it clearly or not. So that gives you the math behind it, what's going on, and then it will tell you that the equivalent is 11101110, exactly like what we did. How about 191? What is the binary equivalent 191. See, it gives you the process as well, how you can do it. Equivalent is going to be 1 0 and then all ones, exactly like we did. So you can just put any numbers and you can go into ChatGPT and find out if what you have answered is correct or not correct. I'm going to embed ChatGPT or AI in general. If you want to use Copilot or you need to use Gemini, that's up to you, but I'm going to embed that into the learning, so you would know how you can yourself augment your learning using AI and find answers quickly without doubting or being uncertain about a specific answer. All right, hopefully that's helpful and we're going to use it a lot more as we proceed. All right, now looking at IPv4 addresses and we are going to find out what why it is V4. Let's look at the hosts and networks. Let's revisit what IP addresses are or IPv4 is. The IPv4 is the decimal representation of IP addresses and that's an IP address which is 32 bits long, so that means the length is 32 bits and they are written as four bytes or octets. Every eight-bit string is called a byte or an octet. So it is four numbers, decimal numbers or fields separated by dots. And here is a valid IP address example. What do you mean by valid? Valid means four fields and that's one field, two field, three field, four fields. Any one of them cannot be more than 255. Why? Because this is eight bits long. There is no way I can represent a number in decimal that is more than 255 in eight bits. And we said the IP address is 32 bits long and it's four fields, each one of them is eight bits or one octet. This is less than 255. This is less than 255. This is less than 255. This is less than 255. So if it is from zero to 255, that's a valid field value. On the other hand, if any given IP address has more than 255 in one or more fields, that's an invalid IP address. It cannot exist, cannot be an IPv4 address. This is something else. So an IPv4 address in any one of the fields, the maximum value you would see is 255 and the minimum is zero. Okay, let's get now to find out what are the hosts and networks. Given an IP address, how can I find out what is the network, the main network and what is the host on that network? For example, you have ABC Street, Willow Street, for example. So that is the street, that's the network, but then you have different building numbers, number one, number five, number 20, number 255, that maps in the analogy to a host on the network. So if the street is the network, the numbers in the street of the buildings are the hosts. So we need to identify that. So what is a host? It's any device with an IP address on a given network. That's what a host is. So it can be a router, it can be a switch, it can be a printer, it can be a laptop, it can be an iPhone, it can be anything. So exactly the analogy is street addresses. So each one of these houses will have a different street number, although they are all on the same street. So the host will have different IP addresses, although they are on the same network. So the main street is the network and the house number is the host. All right. So given a host IP address like this, is it a valid one? Let's see. 255, no, it's less. 255, it's less. 255 is less, is less. So that's a valid IP address. We must be able to identify the network, so we need to know the street from the house number. So the network from the host part. Why do we need this? Because maybe we can be told, but when it is in a computing device, a server or a virtual machine or a switch or a router, they should be able themselves to find out what is the network and what is the host in order to be able to deliver it properly. Okay, so computing devices must be able to identify that too, identify the network part from the host part of an IP address. And this is achieved using what we call subnet masks. So we have to discuss what subnet masks are. So let's look at what a subnet mask is. And now we are focusing on IPv4. So IPv4 is the one that is eight bits {dot} eight bits {dot} eight bits {dot} eight bits. IPv6 is 16 bits {colon} 16 bits {colon} 16 bits and it has eight fields. So each one is double the size of the field and they are separated by colons, not dots, and they are eight fields and that is what makes 16 * 8, which is 128 bits. But, we are not going to discuss that here. So, we are going to focus for the rest of this course on IPv4. At some point in your career, you will want you would want to know about IPv6. And if you specialize in the network field, although I discourage that, you will need to know it sooner than the other fields. But, for now, let's skip the IPv6 and the complexity. Let's focus on the easier one, IPv4, and that is what you will start learning, and that would be more than enough for you to learn almost all the technologies and in cloud and in devops and automation and the other fields as well. So, what's a subnet mask? That's what we need to know now. The subnet mask tells the computer which part of the IP address is the network and which part is the host or the device. All right, so the subnet mask is nothing more than a means or a tool through which computing devices can find out what is the network part and what's the host part of an IP address. It can separate the two or it using subnet mask, we can separate the two. Subnet mask can be represented in decimal or inside notation. Let's start with the decimal one first. If I have an IP address like this, 192.168.1.10. Is this a valid IP address? Yes, it is. Why? Because all the four fields are separated by dots, and none of them is more than 255. So, that's a valid IP address. We are given the subnet mask in decimal is 255.255.255.0. The science behind the subnet mask is whichever bits are in the network part, please put a corresponding one bit in the subnet mask. And where it is the host part, then put a zero in that part. I didn't understand anything. Okay, to understand, let me show you this. The subnet mask, if we write this in binary, 255 means what? Means an eight-bit string that is all ones. {dot} 255. So, that's another eight-bit string that is all ones. And then I have a third one that is all ones in an eight-bit string. {dot} zero, that is all zeros in an eight-bit string. All right, so what do I understand from that? The what the computing device will understand is the complete first 24 bits, the first eight and the second eight and the third eight, they are all the network part. So, this is completely the eight-bits field and the eight-bits field and the eight-bits field, this is completely the network part. And what is left is 32 bits for the entire number length minus 24, which is the first three. These are 24, eight and eight and eight. These are all network part. And wherever there are zeros, that will be the host part. So, that means we have occupied 24 bits for the network and only eight bits for the hosts. All right, that's fine. So, the subnet mask binary equivalent has ones in the network part and then zeros in the host part. And that is how computing devices can distinguish where is the network part and where is the host part. So, now by looking into this, then anything that falls within the first 24 bits is the network itself. And that's why the network here is 192.168.1, and then you can put zeros for everything else, that becomes the network itself, the street name itself. And how about the host? That is the {dot} 10 left. Anything that will be in this eight bits will be the host, and that is the {dot} 10. Anything on the left side is network. Now, one might ask, can I have a subnet mask that will have zeros in between the ones? And the the answer is absolutely not. It's always network part and then host part. It cannot be network part and a little bit of host in between and then a little bit of network and a little bit. So, it's contiguous network part and then contiguous host part. It cannot be broken or interweaved. All right, so how did the subnet mask help me? It helped me by telling me which parts of this number are for the network and which parts are for the host. What if I wanted to do the same thing but inside? Remember what we learned from this subnet mask is that there are 24 bits for the network. The remaining eight, because the total is 32, there can't be more than eight left. So, the remaining is for the hosts. That means I can put different combinations here, and these there will be the street numbers or the hosts on the network. And as long as this part did not change, the 192.168.1, it's the same network, and anything on the right of that is going to be a host on the network. So, {dot} one, {dot} 50, {dot} 100, {dot} 200, {dot} 254, {dot} 238, they are all hosts on the same network as long as the network part is common. So, now if the computing device is given that 192.168 {dot} one {dot} 10 would like to speak to communicate with 192.168.1.20, and both have the same subnet mask, that means these are two devices probably on the same network, on the same switch, and they would like to communicate with one another. So, even if I had a router connected to this switch, the router will not intervene because it's the same network. That's not my business. So, let's look at the cider notation. Since the subnet mask gave us the number of bits for the network, then why don't we write it in an easier format? So, it's a shorter way to write the subnet mask. Instead of writing 255.255.255.0, why don't I just write it like this? 192.168.1.10, and then we put a forward slash, and how many bits are there for the network? So, obviously, the remaining of the 32 will be for the hosts. So, the number after the slash tells how many bits are used for the network portion of the IP address. And the only reason for the subnet mask was to tell the device or to tell me or to tell you which portion of the IP address is the network and which portion is for the host. So, 32 is the total number of bits in the IP address minus 24 in our case, which is the network part, that leaves us with eight bits for the host. Exactly the same that we have learned in the previous slide. This way or that way are the same. AWS chose to use the subnet mask this way with the cider notation, not with the decimal notation. It's much easier to understand. So, now if I give you an IP address and tell you it's {slash} 16, what does that mean? That means the first two fields are for the network, and the next two fields are going to be for hosts. So, I can allocate different hosts on the same network by changing the zeros and ones on the 16 bits on the right side. If I tell you it's a {slash} eight, what does that mean? That means the first field only is for the network, and then everything else is going to be for the host. So, I can put different bits and bytes, different combinations here, and these will be different hosts on the same network. So, hopefully you understand it now, and it's easier. So, the meaning is the same. The first 24 bits are for the network, and then the rest will be for the hosts. And the result is the same. The network part is 192.168.1.0, whereas the host is the {dot} 10. And here is a table that it can be handy if you want to use it, or I can just, you know what, go to my friend to the chat GPT, and and I'm going to say, "Okay, fine. What is the binary equivalent if I'm confused of 255.255.0.0, for example?" So, now it will give me the binary equivalent for that. This is how it will look like. 255.255.0.0. Which means this is the network part in any IP address that uses this subnet mask, and this will be the host part. What is the binary equivalent of 255.255.255.0? That's a {slash} 24. And it will give me the same. So, the the first three octets are going to be like this. And now, what is the binary equivalent of the cider {slash} 24? See, the first 24 bits are for the IP of the IP address the for the network, and then eight bits for the hosts. And if you compare this, all ones and then zeros, that's exactly the same 255.255.255.0, which is exactly the same when I asked it, "What's the equivalent of this?" So, whether you write it this way or write it as {slash} 24, it's exactly the same. All right, so this is handy if you would like to use it, or if you can do it on chat GPT, that's also perfectly fine. And this starts from {slash} eight all the way to {slash} 32. And it gives you all the numbers. So, for example, a /9, what would it be? That will be all eight that are going to be ones, and then only one more is going to be one, and the rest will be for the host. So, if you want to write that in decimal, it's going to be 255, and if we have one and all zeros, that is 128. If we have /10, so that will be one more bit taken into the network, and the equivalent of the second octet now is 11000000, which is 192. If you take three bits, that will be what? 224, and then 240, and so on, until you reach this one where you take the first two octets completely. So, if you are at the boundaries, if you take eight into the network only, or 16, or 24, that's easy, because that will be 255 .0.0.0 for /8, like here. Or it will be 255.255.0.0 if you do /16, or it's going to be 255.255.255.0 if you go for a /24. Hopefully, that's easy, and I'm sure with practice, and if you use your best friend ChatGPT or Copilot or Gemini, it's very easy to train on this and to get it. And if you have any questions, definitely let me know. All right, so let's do some subnet mask practicing so we get whatever we have understood and grasped clear or clearer, and if there is anything missing or ambiguous, then hopefully that will make it more comprehendible. So, example number one. Given the below IP and CIDR. So, here is an IP address, and that's forward /24. So, that's a CIDR notation, and that's the representation of how long the network part is. So, this is your subnet mask in CIDR notation. And if it is 24, we mentioned that each one of these fields is eight bits long. So, that means I have eight bits, and then {dot} eight bits long, and then {dot} {dot} eight bits long field, and then {dot} eight bits long field. So, /24 means the first three octets or the first three bytes are for the network, and the remaining one is for the host. One might ask me now, um this is {dot}1, how come this is eight bits? Remember that you can write the one as 0000, and then 0001. So, the one is represented in binary in eight bits long strings like this. Similarly for the two, but it's going to be 0000, then 0010. All right. So, this is what we have. What is the required now? We need to find the network ID, what's the network, what's the host, and what's the subnet mask in decimal. That's what we need to find out right now. All right. So, let's find out. So, let's write the binary equivalent of this IP address, and that would be 192. 192 is very easy. That is 128 + 64, and then everything is zero. So, 128 + 64, and then six zeros. Remember, this is eight bits long. It has to be eight bits long. 168, that is 128 + 32, that is 160, and then we have eight with us. So, we will take the 128, we will ignore the 64, so that will be one, and then zero. We will take the 32, because these two together make 160, and then we'll ignore the 16, and we'll take the eight with us. So, that will be 168, and everything else is zeros. And then {dot}1, 0000, and then 0001. {dot}2, that is all zeros, and then 0010. We put the color of the network bits in purple, and the rest is in blue to signify that we have 24 bits for the network, and then only eight for the host. Okay. What do we need? We need to find out the network ID. Very simple. Zero everything in the host part, and that becomes the network ID. So, take this as is, copy it, and then {dot} 0000 0000. So, that is 192.168.1.0. That becomes your network ID. Okay, so the host part is eight, and /24 is the network part. Here is the network ID, 192.168.1.0, by placing zeros in the host part, and {dot}2 is the host, and then the decimal CIDR block is 24 all ones, so that is 255.255.255.0. All right. And of course, I can go to my friend, which is ChatGPT, and I can ask ChatGPT, what is the network ID, what's the host, and what's the subnet mask in decimal for this range? Let's go ahead and try it. So, what is the network ID, host, and the subnet mask in decimal for 192.168. 1.2/24. So, here is the subnet mask, as you can see, 255.255.255.0, and it explains that /24 means the first 22 bits are for the subnet or the network. So, the network ID becomes the 192.168.1.0, and then the host portion is going to be the {dot}2, or here they write it as 0002, but preferably write it as {dot}2. Oh, uh here you go. The host is two, and here is the subnet mask, 255. 255.255.0, and this is the network ID. So, very easy to come up with any IP address, do it your own hands, write it down, and find out what is the network ID as you think, what's the host, what's the subnet mask in decimal, and come here to verify it or validate it. Okay, let's look at another example, and we are still going to look to do the same. Find the network ID, the host, and the subnet mask in decimal. We're going to repeat exactly the same. This is exactly the same like before, but here it's {dot}12, and it's /26. So, if you look at the binary equivalent, that's the binary equivalent, and then if you notice that we took two more bits from here, and these are in purple as well, because of the 26. So, that's eight + 8 + 8 + 2, that makes 26. And the blue ones are the host, and 8 + 4 is 12. So, where is the network part? All of this. Where is the host part? The remainder. And the network ID, you can calculate it by putting the host part as all zeros. So, as if these two ones don't exist, so this will become a full zero, and this will not change, 192.168.1. 192.168.1.0, and the host part is going to be the 12, the blue one, the value, {dot}12. And the subnet mask, if you want to write the subnet mask for a /26, you guys are the best now. So, it is eight ones, {dot} eight ones, and then another eight ones. This is six, so seven, eight. And then another eight ones. So, that is 255.255.255, and then for the first two bits, I have to put ones, and then zero everything else. So, everything else is zero. So, that's 255. {dot}255.255. This is a bit or an octet that has only two ones at the left, and then everything else is zero. So, the first one is 128 and 64. If you add them, that's 192. That's how we we got to the decimal representation of the subnet mask. Here is another example, exactly the same, but {dot}80 and /26. If you look at it, same thing. The subnet mask is going to be exactly the same, because it's /26. So, 255.255.255.192. If you look at the host, the host here is {dot}80. 80 means 64 + 16. So, this is the host part, and this is the network part. Okay, so what's the host part in the subnet mask? The / 26 or 26 bits, and this is the host part. Put zeros for the host part, and then you will be able to get the subnet or the network ID. So, here, if you put all zeros, and you leave this as is, that becomes 128 is not with us, and then one and all zeros afterwards, so that becomes 64. And that's why the network ID is 64, the host is {dot}80, and the subnet mask is the same like before. The same thing, but {dot}138/26. One might be bored by now, and I say okay, why is the same network? There is no change. We are not tricking us. You should give us other networks. There is a reason why I am using this network now, but we'll do more practice with different networks later on. So the equivalent 138 that is 128 + 10. So 128 + 8 + 2 that is 138. And this are the host part and this is the network part. So what's the network ID? Put zeros in the host part and you will end up with the network ID. So that's 192.168.1 and that will be 128. Okay, because we have all zeros. Forget as if this does not exist and this does not exist, that becomes the network ID. And the 138 is the host and the subnet mask is the same like before. Last but not least, let's look at another one, but the range here is 217 same subnet mask. So 217 that is 128 + 64 that is 192 + 16 that is 208 + 8 so that's 216 + 1 that's 217. Network part, host part. So put all zeros in here. You end up with the network ID. So 192.168.1.192. And the host part is .17 and the subnet mask is the same. Now why did I use the same network all the time? Now let's put them all side by side with the very original one that we have done. So the very original one we have done is 192.168.1.2 /24 and the network ID was .0. Then we looked at .12 and that was the network ID. Again, same network ID but the subnet mask is different so they are not the same. This is actually part of this. This covers the IP addresses until we get to the next subnet which is 64. So this covers from 0 to 63 and this one starts at 64. We're going to explain that further later on. And this one ends before the 128 so at 127. This one starts at 128 and ends at 191 and this one starts at 192 and ends at 255. So as if what I'm trying to say here is if we look at this IP address and the network ID we find 192.168.1 and this is the .2. And this is the subnet mask. If we look at the next ones, we'll find that this was all the hosts, but now the host part has shrunk into six bits only. The network part has been expanded by two bits. And the subnet mask has also been extended by two bits. If you combine these four into one network, believe it or not, you will end up with this one. But this is just to let you know that as if we have divided this into four and we had to borrow two more bits from the host and make it a network in order to have one network divided into four. This is called subnetting, but don't worry about it. Just keep it in your mind because we are going to use it later on. All right, let's now find out what IP address classes are. Actually the IP addresses, whoever invented that, they divided them into classes. And they have class A, the class B and class C. We have also class D and E, but we are not going to discuss that because it's beyond the fundamentals of networking. It has to do with multicast and other stuff. So IP address classes are created to help effectively assign IP addresses to big, medium and small networks without wasting too many addresses. So when they thought about them, they thought about the best and efficient use of these networks. And they started with A, B and C. So A, this is for big corporates. Okay, the CIDR block or the subnet mask, the default is /8. And it starts from 1.0.0.0 all the way and inclusive of everything in between to 126.255.255.255. This has 126 usable networks and 16 million hosts in each. So that's extremely large corporates. An example, 11.0.0.0/8. So notice that the leftmost byte starts at one and ends at 126. What about 127? This is reserved for local hosts and other stuff on the servers. We are going to learn about them as we learn more IT. What about class B? Class B is the default subnet mask in CIDR block is 16. So the first two octets are for the network, the second two are for the hosts. And it starts at 128 on the leftmost decimal value of the octet to 191. And that has 16,384 384 possible networks. In each one of them we have more than 65,000 hosts to be allocated. An example, 148.12.0.0/16. Class C is for small networks. So B is for medium networks, this is for large networks. C is for small networks. The default subnet mask is /24. It starts from 192 and ends at 223. The leftmost byte. It has 2 million plus networks, but each one of them has only 256 IP addresses, but usable are 254. We are going to discuss that later on. So consider that as 256 for now or 254, that's fine. An example is 196.12.108.0/24. So IP address classes, by the look of the leftmost byte, you can tell whether that's a class A or a class B or a class C. So if it is from 1 to 126, that's a class A definitely. 128 to 191, that's a B and 192 to 223, that is a C for sure. So each class has a default subnet mask as we mentioned, /8, /16 and then /24. And there are other specialized classes, but out of scope. All right, so let's now figure out how we can break an IP address block, an IP address range into multiple subnets we call it or multiple segments, multiple chunks. Why do we do this? We do it because if I have, let's say I have a campus building and I have a one big chunk of IP addresses, one block. And now I need to build separate LANs in each one of the buildings and then I will connect them to the data center for example. So how can I do this? I have only one range and I cannot It's not recommended to use the same range across a lot of buildings because it has a lot of technical implications way over our heads now and we shouldn't get into the details why we should avoid that, but it's recommended that you segment or distribute that into multiple subnets and then use one in each building. I'll give you another example. Let's say it's a corporate and it has one office in each one of the 50 states in the United States. And the headquarters is, let's say in India for example. And now they need to connect this. So they have to go across one. We said if the it's not in a close vicinity, it has to be a wide area network. And we talked about that before. So in that case if you want to break it down, the one big range, you will have you must break it down because otherwise you cannot use the one the the right way without breaking that down and isolating a block of IP addresses for each one of these offices. They cannot be in one office. They can't live in one office. Period. So they have to be different or separate IP address ranges, smaller ones, chunks from the big block that you have. And that is called subnetting. So that is why we are going to discuss subnetting, but we will start doing it the easy way without a lot of math and without confusing you with a lot of binaries and all that stuff. If you have understood everything before this and you are good with that, then you can use the easy way and you are good to go. If you want to know more details or if you are planning to be in the engineering side where you are going to do a lot of troubleshooting and you want to minimize your dependence on calculators and online tools, then you can learn the details which will follow this one. But now it's the easy way. So this is for the people who want the easy stuff, the easy way, the faster way to do things, but hopefully also they understand what they will see and what they will get. This is very important to know. All right, so let's see what subnetting is. Subnetting allows us to take one IP address block and then divide it into smaller blocks to be used on different networks. Think of subnetting an IP address range as slicing a pizza. Exactly when you have a pizza and you will have let's say it's a small pizza and you would like to cut it into four slices. So that's exactly the subnetting. So, this will be the block IP address range, the actual pizza, and then the slices, each one of them is being is going to be called a subnet. When we do subnetting, we don't have the liberty to decide how to cut it as we do with the pizza. For example, with the pizza, you may decide to cut it into six pieces or three pieces or 12 pieces. In subnetting, you can't do that. You either divide it into two, or four, or eight, or 16, or 32, or 64. Does this seem familiar to you? Yes, these are the weights of the binaries. So, it's either two or four or eight or 16 or 32 or 64. What if I need five only? Then you have to go for eight, and then you keep three as spare. What if I need 12? Then you have to go for 16, and you keep four as spare. But if you want 20, then you go for 32. So, you divide it by 32, and then you'll use 20, and then 12 are going to be spare. So, this is very important to remember. You cannot divide an IP address block by three or by five or by seven or by 11 or by nine. Given an IP address range to subnet, we need to know What do we need to know? We need to know how many subnets are needed, and how many hosts are needed per subnet. So, if you are given an IP address block, and you are giving the scenario of the 50 offices in the 50 states in the USA, and you are told that we need to break it down, that big block, into enough subnets that we can use in each one of these offices. The very first question that you would want to ask is how many hosts do you need per subnet? So, in each office, how many machines are going to connect to the network? If they are 50, then go for 64. So, maybe go for 128. So, you need to go for a higher number of IP addresses, not exactly 64 if they are 64, because what if a new employee is added tomorrow? So, you always need to design for a little bit bigger than the requirements. Or maybe you can ask, "Okay, how many users are going to connect How many devices are going to connect? How many hosts?" If you are told 64, then you can have a subsequent question is, "What is your anticipated growth rate per year or every couple of years?" Is it going to be 10%? 20%? 30%? And that will help you decide what size you are going to make the subnet. So, this is very important. The second question is, "How many subnets?" So, we have 50 offices in the United States, in each one of the states. Is there a chance you are going to open satellite offices from these offices? If the answer is yes, how many do you anticipate per year? Per two? Per five? Per 10 years? If they know the answer, then you need also to design not 50 subnets. Now, I will go for 128 subnets or maybe 256 subnets. So, I'll have a room to scale, to grow. I don't need to design it and then start using it, and 1 year down the road, I would say, "Oops, okay, I didn't account for that." So, now we have to redo everything and re-address everything, which will be a nightmare. Okay? So, this is very important. The two questions, how many subnets and how many users per subnet. And the third question that will be, and will show that you understand what you are doing, is what is the growth rate for hosts and for subnets as well. So, let's look at how we can have an IP address range and break it down, and we'll do it the easy way. The easy way we mean, we are going to do it using online calculators. So, what we need to identify using the online calculators, the network ID of the IP address range that we have, the usable IP addresses in the range, and also the broadcast address of the subnet. The broadcast address, by the way, is the last IP address in any subnet. So, when you put in the host bits all ones, that is your broadcast address in the subnet. So, we have a range, 192.168.1.0/24 inside the format, and this means we have 24 bits for the network. I'm sorry, 24 bits, so all three bytes. So, this one included, this one included, this one included. And this is going to be for the host. So, this is the network, and this is the host. Okay, we need to divide the range into four equal-sized subnets. So, we're going to do a subnetting exercise using online calculators. And for each subnet, we need the subnet mask, the network ID, the broadcast IP address, and the number of usable IP addresses, and the first and last usable IP addresses. So, that's what we need to know, and online calculators, we have two famous ones and easy ones that I would recommend. This one is very easy, and there is another one from SolarWinds Subnet Calculator. I'm going to use this one, so when you practice, please use that one as well, so we are going to be in line. If you want to use the other one, if you want to try the other one, please feel free to do so. One online tool is more than enough for you to do that, and Calculate Quick is the recommended one or the highest recommended one on the internet. And if you want other calculators, you can go to your friend ChatGPT and ask, "What are the popular IP subnet calculators or IP calculators?" It will give you a list of available ones. All right. So, what do we need to do now? I need to take this one, 192.168.1.0/24, and I'm going to click on this link, and we need to divide it into four equal-sized subnets. And we're going to find this information for each one. Before we go and do anything, equal-sized subnets. One small pizza, you need to cut it into four equal slices, 100% equal. If you think about it, how many IP addresses we have here? How many hosts in this network? So, network ID can tell you the the major one the main one. Network ID is 192. 168. 1.0. That's the network ID. How many bits do I have for the host here? We have 24 for the network, that means we have eight left for the hosts. So, if you if that's the case, we can have up to two to the power eight different combinations in the eight bits. So, that's 256 host IP addresses that are available. A rule, the first one and the last one, you can't use them. They are not usable. So, the 192. 168. 1.0, that's the network ID, so we cannot use it on a host. And the last one is going to be 192. 168. 1. Can you guess what would be the last number? Put all ones in the host field. So, that will be eight ones, which is 255. That's the maximum you can get from eight bits. So, this is the broadcast IP. This is for the original subnet. So, what's the number of usable IP addresses? It will be the total number minus the network ID minus the broadcast. So, minus two, that will give me 254 actual usable IP that I can allocate on hosts on this network. What if this network grows more than 254? Unfortunately, you cannot use the same subnet. So, what do we do? We have other hosts that need to sit on the same subnet. You will have to re-address your subnet and provide for a bigger one. That's That's what you have to do. That's why it is very important to ask the question, the size of the subnet, how many hosts, and the growth. All right, let's go ahead to the online calculator. I'm going to take this range, and I need to divide it into four equal pieces four equal pizza slices. [clears throat] So, let me go ahead and click on this link. And this is how it looks like, IP Subnet Calculator. Here, I'm going to write the range that we have, 168. 1.0, and it is /24. And I would say, "Calculate." If you scroll down, you'll find here Let me just make it a little bit bigger. So, this is a class C, and the IP address, the network ID, and you can always copy the information. The broadcast address, as we calculated it, 192.168.1. 255. The first usable IP, it will be the one after the network ID, which is .1. The last usable IP is the one right before the broadcast address, so that is 254. Here is the CIDR notation, and the total hosts is 256, but the usable ones are 254. And the mask bits are 24, and the subnet mask and all the details that you need to know about this. And here, they give you the binary representation for the IP address, for the subnet mask, and the network ID, and the broadcast address. Everything is included. So, if you look at the network ID and the broadcast address, the only difference is here, it will be zeros in the host field, and here, it will be all ones in the host field. So, they are exactly the same, but the network ID, all zeros, uh the broadcast IP is all ones. Okay, that's all cool. I need to subnet it. So, we have a tool called subnet division tool. Here it will ask you, "How many subnets do you need?" So, I need four subnets. You can here add and So, it allows you to add any number, but at the end if you go for five, if I go for three for example, calculate subnets, it will do four of them. It will do four of them. Yeah, but I asked only for three because you can't divide a block by three. You can divide it by two or four or eight or 16. So, let's say if I tried to do five. Let's see. Calculate subnets. You will find that it has divided that by eight because four is not enough. It goes to the next one. It's up to you to use five of them and then three will be spare. So, let's go back to our example. Four. Let's look at what is done here. So, here you have the first subnet. It was It's going to be 192.168.1.0 and /26. Please note that the subnet mask when you divide a block by a number, so two or four or eight and so on, if you divide by two, you'll find that the subnet mask will be extended by one bit. If you divide by two to get four subnets, then it will be extended by two bits and that's what we have here. So, this is a /26 although the original one was a /24. So, when you have a /24 and you divide it into four subnets, then the resulting subnet mask or the new subnet mask is going to be extended by two. Why? Because two to the power two is four. That's what gives you the four subnets. What if I want to divide by eight? What will happen? So, look at this. This is by four, 26. By eight, it will be 27. Why? Because three bits are needed to distinguish between the eight subnets and that is how it has been converted from /24 into a /27. So, when you do subnetting, the subnet mask or the network part gets extended into the host. How many bits into the host? If you divide by two, it will be only one bit. Let's Let's prove it. So, it's going to be 25. From 24 to 25, that gives you two subnets. From 24 to 26 gives you up to four subnets. From 24 to 27 gives you up to eight subnets. From 24 to 28 gives you up to 16 subnets. Let's prove it. So, let's say I want 16 subnets. You'll find that it has extended by four bits the subnet mask and it is very good that we are having more subnets, more networks you can use separately, but the downside is you are getting less hosts in each one of the networks. That's why it is important to ask how many hosts per subnet and how many subnets do I need? You divide it by 16 and you have a resulting /28. The /28 will only leave 32 minus 28, which is four bits only for the hosts. So, that you can give you a maximum of 16 hosts. And that doesn't help me because I need 60 64. So, if you need 64, you have to divide maximum by four. Why? Because this is /26. /26 for the subnet, that will leave me with six bits for the host and two to the power six, two times two times two times two six times is 64. So, that's exactly the number of hosts that are available in a subnet. You put the subnet, it will give you the details about it and it will give you the first, last and on so on. And if you would like the binary, here it is. And if you would like to go ahead and look at the subnetting, then you can go into the subnetting tool and you can ask for how many subnets and then you can you can do it. If you are not subnetting, it will tell you that the usable host addresses here are 192.168.1.1. You can't take the network ID the .0 and the last one will be .254 and the broadcast IP is here. So, it's very easy to use. It doesn't need magic. It doesn't need a lot of knowledge and you can play with it. And if you do only two exercises, you will be the master of using this tool. All right? So, hopefully that was easy and that is what we needed to do it when you subnet the easy way. Let's do one example on IP address breakdown or IP address range breakdown. We are going to use the calculator, but I also will explain to you how you can do it. Given an IP address range and a subnet mask for a subnet, how can we identify the following? The network ID or the network address and the usable IP addresses in the range. How many are they? What's the first one and what's the last one and what is the broadcast address of that subnet? So, here's an example. 112.168.2.0/24. So, let's go ahead and go to the IP calculator first. So, 112.168. two .0 and / 24. So, if you click on analyze basically or calculate, you'll find that the network address is 112.168.2.0. Here's the one. Let me just make it bigger. And the network address is the same, the network ID. Broadcast address. This is /24. So, in the last octet, I'll put all the bits as one. Eight ones. And where did I get the eight from? Because it is /24. The first 24 bits are for the network and the entire size is 32 bits. So, 32 minus 24 leaves us with eight for the hosts. So, if you put eight ones, that is 255. So, this is your broadcast address. The first host IP address, the the very first one you can use. You cannot use the broadcast and you cannot use the network ID, the very first IP address. So, .1 will be the first one and .254 will be the last one because it is one before the broadcast. So, this is everything we need to know about the subnet and here is the binary equivalent. The subnet mask for 24, so 24 ones and then zeros for the hosts. Here is the network address. Put all zeros in the host field and put all ones to get the broadcast address. Very easy. To find the broadcast broadcast address of a given range, all you need to do is find out what's the length of the subnet mask, decide where the host field bits are and fill them with ones. That will be your broadcast address. So, in our example, here is the host field. Fill it with ones and translate that into decimal and it becomes the broadcast address. So, that is going to be 112.168.2.255. If you want the usable IP addresses, the very first one in which is the network ID and the broadcast ID, they are not usable. They have They are reserved for special purposes and that's why you can have all the hosts in that subnet minus two, which is the network ID and the broadcast IP and that would be the number of usable ones. So, if I have this network and we said that the network ID is .0, that is not usable. And the broadcast IP is .255, so that's not usable. So, I have the ones that are usable, the number of IP addresses is two to the power and the number of host bits. So, that means two times two times two times two eight times or that is 256. Minus two for the network ID and the broadcast IP, that is 254. So, this is These are the usable IP addresses and the very first one to use is going to be .1 and the last one is going to be .254 as we have seen in the calculator IP. So, what I'm trying to show you here is how you can do it yourself or if you understand it well, then just go with the calculator. It will be much faster and much easier. And of course, you can go to our friend ChatGPT and you can get the same results. Let's go ahead and give it a try. And I'm going to ask, "Analyze the subnet 112.168. Let me just make this bigger so you can see what I'm typing. .2.0/24. I need to know the network ID, broadcast IP, first usable IP, last usable IP and number of usable IP addresses." And of course, you can narrate that using voice. So, you can click on voice and instead of chatting, you can just say what you want to do. So, here's the subnet. And that's the IP address. That's the side annotation, subnet mask, first address in the subnet or the network ID, then the broadcast address, and then the first usable IP, the last usable IP, and then how many IPs are usable and it gives you the math on how that was reached. So, in a /24, we have eight host bits, 32 minus 24. And then here is a summary of what you need. So, if you would like to do it on the calculator, that's fine. If you'd like to do it in ChatGPT by narration, that's fine. If you would like to do it to your own hands and verify, that is also fine. All right. Now, let's do a cheat table for you to remember the number of hosts and also the usable IP addresses. If you have a subnet or a network with a /24, that will leave you with eight host bits. Host IP address, the total number including the network ID and the broadcast is going to be 2 to the power n, where n is the number of host bits. It's 32 minus the subnet mask length. If the subnet mask is longer, then you get less hosts and the net usable ones is minus two, so that will be less as well. If you make it longer again, then you get less hosts and less net usable ones and so on until /30, where you'll have four IPs of which two only are usable. So, this is very small. Why would I use this? If you have two routers in a LAN and you would like to connect between them, you have to enable or to provide an IP address to this side of the link and this side of the link from a LAN and they have to be in the same subnet. So, you want only two IP addresses. So, why waste more IP addresses? Allocate a /30 subnet that will have only two usable IP addresses. Allocate one on this side and allocate the other on the other side and that's it. We're going to talk about that later on when we get to IP routing. All right? Now, let's do another practice example for the IP breakdown. But this time we are going to do it ourselves. We're not going to use the calculator. Just to make sure that you understood it right and you are capable of doing it before you standardize on using calculators or ChatGPT all the time. So, here's another example. 112.168.209.33/20. So, now we did not give you one that is eight bits or 16 bits or 24 bits. No. Now, we are giving you one that will end exactly at the half of this octet. The left half is going to be bits for the network and the right half is going to be bits for the host. So, you are more familiar with any subnet mask. It doesn't have to be /24 all the time. So, for this one, if we translate that into a binary equivalent, that is going to be the first octet, second octet, and then 209. Can I take the 128? Yes, you can. That's why we're going to have a one in the 128. And now I'm talking I'm sorry, this one. I'm talking about this one. I'm going to take the 128 with me. All right, can I take the 64? Let's see. 64 + 128 is 192. Is that less than 209? Yes, it is. Then I can take that as well. So, a one and a one. That is 192. We are still 17 short of the 209. Can I take the 32? No, you cannot. So, make it a zero. Can I take the 16? 192 + 16 that is 208. Yes, I can take it. So, that's why we place a one. And then all zeros. We need We are still one short. 208 to 209 is only one. That's why we put one here. So, since it is /20, that is 8 + 8, that's 16 and 4 is 20. So, this is the network part and then the host will be the remainder. So, here we have 12 bits for the host. We have four here plus eight here. So, we have 12 bits for the host. All right. Okay, what do we need? We need to know the network ID. Easy. In the host part, put all zeros. So, put this to zero and put this to zero and put this to zero as well. All right, if I do this, what do I end up with? I end up only with the purple ones and then zeros and here all zeros. So, all zeros is easy. But the purple ones and this is going to be a zero. So, 192 + 16, that is 208. So, 208 + 0 and the 168 will be the same, 168. And the 112 is going to be the same. So, the network ID is 112.168.208.0. Easy. All right. Okay, what do we need? We need the broadcast IP. So, to get the broadcast IP, you have to put all the host bits ones. So, if this is all ones, easy. That is 255. So, where is the tricky part? The tricky part is here. This is 208. Now, if you put four ones here, the four ones are 8 + 4 + 2 + 1. So, 8 + 7, that is 15. 15 added to the 208, that is 223. So, 223 + 255 is the broadcast IP. So, let's look at that. So, that's how it would look like and that translates into 223.255. Now, we know the network ID and we know the broadcast IP. How many usable IP addresses do I have here? Let's find out. We have the host bits 32, which is the total length of an IP address minus 20, which is the network part in the subnet mask as they indicated here. That means I'm left with 12 bits for the host. So, 2 to the power 12, 2 * 2 * 2 * 2 12 times, that is 4,096. Remove from that. Now, we're talking about the usable IPs. Remove from that the network ID and the broadcast IP. So, remove two, that leaves you with 4,094. First usable IP, we put one and all zeros in the host part. That will be the first one. Last usable IP, broadcast IP minus one. So, if the broadcast IP was 223.255, the one before, the 254, that is going to be the last usable IP address. And we have 4,094 IP addresses. So, hopefully the concept is clear and I want you to come up with IP addresses, any IP addresses, any subnet mask length and then try to do it yourself. Try to analyze it and try to find out the host bits, the number of usable IP addresses, the first usable IP, the last usable IP, the broadcast IP, the network ID. I would like you to train and you can validate on ChatGPT or on the calculator and you'll find if your answers are spot-on or if you have missed something. If you missed something, go back and try to find out what did you do wrong, fix it and that's how we cement the knowledge and that's how we retain the understanding and the information we learn as well. All right, thank you. So, let's now discuss the subnetting topic in details. So, we are going to take ranges and we're going to break them down based on requirements and during the process you will understand how subnetting is done in real world. So, why do we do subnetting? Subnetting will allow us to take an IP address block and then divide it into smaller chunks. And why do we do this? Because when we build an infrastructure, usually we have different offices, different networks, different LANs, wide area network, wireless LAN requirements. We have different requirements. Also, when we come to the data center, when we build it, we want to have databases separate from the application, separate from the monitoring, separate from the other tools, separate from the active directory domain where the users log into a Microsoft domain and the corporate network and be able to use the different applications, separate from accounting, separate from finance. So, there are requirements to separate data in your data centers and to build different LANs and to to build wide area network and all of that requires IP addressing and it cannot be one range. It has to be broken down into smaller networks that have boundaries and you don't intermix between the different networks. So, that's why subnetting is a must. It's not a luxury and it's not an option when we have a sizeable network infrastructure that we need to build. Also, the fact that when you build different networks, you can start to put security in between. You can do filtering. Subnetting is a critical component of any network infrastructure. That is given. Even if it is a small company that has two, three offices, they will need to have different networks in each one of these offices. So, let's do a subnetting practice and through the practice I'm going to explain how that is done. So, we have an IP range below, 112.168.240.0 /24. So, from what we know, that means the first 24 bits, because of this 24, is the network part and the last eight bits is the host part. How did we know that? Because it's 32 bits long minus 24, I'm left with eight only. So, what do we need? We need four subnets. We need to divide that into four subnets. And each subnet must have 64 total hosts or total IP addresses. And if we do the analysis, it's easy because how can I get to the network ID? Put zeros in the host part and it's already done. It's already a zero in the host part. So, that's the network ID. The same thing is the network ID and we don't write the subnet mask next to it. If I convert that into binary, it becomes 0111 and then four zeros {dot} 1010 1000 {dot} 1111 0000 and this is the host part. What is the broadcast IP? The process is easy. Put ones in all the host bits and convert that into decimal and that becomes your broadcast IP, which is the last IP in the network. So, put 1 1 1 1 1 1 1 1 and that becomes 255. Total number of IP addresses in the original network. We still did not do any subnetting. We are analyzing the original network. So, how many host IP addresses do I have total? Not the net not the usable ones. So, two to the power n and n is the number of host bits. The number of host bits in our case is eight. So, that's 256 IP addresses including the network ID and the broadcast IP. So, if you want the usable IP addresses, it is 256 minus two, which is 254 and they start at {dot} one and they finish at {dot} 254. The one before the broadcast IP and the one after the network ID are the first and the last ones to be used. All right. So, now let's go ahead and think about what we need to do. We need to divide this into four equal subnets. So, if I have 256 total host IP addresses. Now, if I divide this by four, how much do I get? That will be 64. You can use your calculator if you would like to check. Okay? So, 64 in each one of the subnets. So, each one of the subnets will have a total number of hosts of 64. Why? Because we need four equal in size subnets. All right, that's fine. So, let's try to define the four chunks that we are talking about. So, we'll start from zero to 63. That will be the first one. What's my evidence? If I tell you that, please divide eight by four. Let's say you have eight IP addresses. Divide eight by four and you will start counting from zero. So, that is what 01 23 45 67, right? So, although the result is two, the first one will be zero and one because I start counting from zero. Zero and one are two numbers. That's it. So, if you have a total of 64 and you would like to count from zero, so it will start the first range will start from zero and it will end at 63, not 64. If it ends at 64, that will be 65 in total. What's my evidence? Here, when we do the counting, the eight numbers, they start from zero and they end at seven. And total hosts that we have in the subnet, they start at zero, which is the network ID, and they end at {dot} 255, which is the broadcast IP, right? So, these are 256. So, exactly the same. The first one will be from zero to 63. You can count them on your hand or you can write them down if you want or you can ask ChatGPT if you don't believe me. Okay? So, if we are from zero to 255, the first range, the first 64 is going to be starting from zero and it ends at 63. The next one is going to start from 64 and it will end at 127. The third one is going to start at 128 and it's going to end at 191. The fourth one is going to start from 192 and it will end at 255. If you would [snorts] like to count, you will find that these are 64. These are 64. These are 64. These are 64. And the starting is {dot} zero and the end is {dot} 255, which is exactly what we have here. So, that is the equal four chunks or four subnets that we need. Done. It's solved. Yeah, but how can we allow the computer to understand this? What is the subnet mask? And the subnet mask that we are going to come up with must start the first subnet at zero and end it at 63. So, the host bits, the iterations, the different combinations in the host bits must not exceed 63. Because when we exceed 63, we're going to transition to the next range, which is starting at 64. Same thing. This should end the subnet mask should end at 127 because when I switch to 128, I'm going to get to the third subnet. So, the new subnet mask can never be the same subnet mask. You cannot claim that you're going to cut a pizza into four equal slices and the result is going to be a full pizza and a full pizza and a full pizza and a full pizza. It's going to be a quarter and a quarter and a quarter and a quarter. So, that means the subnet mask must change. That is not an option. It has to change. So, let's think about the subnet masks now. If the number of IP addresses is 64 and we mentioned that the subnet mask must be able to reach the limit, the maximum, the broadcast IP. It will be the last one. It will be the 64th host and then it has to switch. How many bits do I need to get to 64 IP addresses? Think about it. 2 * 2 * 2 * 2, how many times? So, 2 2 * 2 is 4. * 2 is 8. So, that's three. * 2 is 16. * 2 is 32. * 2 is 64. So, I need six bits for the host in order to switch subnets every 64 IP addresses or every 64 hosts. So, that means I need six bits for the host and that leaves me with 32 minus six, which is 26. That is going to be for the new subnets or the new networks. So, the new subnet mask is going to be a {slash} 26. How can I verify? So, let's proceed and find out. So, this is going to be the new subnet mask a {slash} 26. {slash} 26 means eight bits {dot} eight bits {dot} eight bits {dot} two and all of them are going to be ones. So, 255 {dot} 255 {dot} 255 and the last one has only two bits that are one and that is 128 plus 64. So, 192. That's how we came up with this one. So, what are the resulting subnets? They are going to be {dot} zero {slash} 26, which will cover the first range. Then {dot} 64 {slash} 26. Then 128 {slash} 26. Then 192 {slash} 26. If you notice here, the difference is 64. The difference is 64 and the difference is 64. And why is that? Because each subnet has 64 IPs, right? So, every 64, I'm going to switch subnet. And what will confirm this is the new subnet mask. Simply because in any one of these, it's going to be network eight bits, network eight bits, network eight bits. Then I have network. So, here I have two bits, eight eight and eight and I have six left for host. What is the maximum number I can put in six bits? So, let's try. 1 2 3 4 5 6. Let's count them. So, this is one. This is two. The weight This is four. And this is eight. So, these are 15 and this is 16. And 15 is 31. 31 plus 32, that is 63. So, you start from all zeros and you go to 63. If you add one more, you will switch to the next one. The next one is going to be 1000 000, which is 64. So, that means I have switched to another subnet and that's exactly what happens here. In the first subnet, because of the subnet mask, six bits only for the host, I'm going to switch at 63 will be the max, the broadcast IP and the next one is going to be a different subnet. So, now we are satisfying that and the new subnet mask seems to be working. Let's analyze the first subnet. So, it is 240 {dot} zero {slash} 26. Remember, the original one was 24. So, that's the subnet ID. Okay, fine. Binary equivalent is the same 112 168 240, but then we take two bits for the subnet and these six will be for the host. So, what will be the first and last IP? This is the subnet mask in decimal. The first IP is zero and the last one is 63. So, 63 is the broadcast and this is the network ID. So, the usable IP addresses are not 64, they are 64 minus two. They start at dot one and they end at dot 62. All right? So, these are the usable IP addresses. And the broadcast IP is the last one. So, that's easy, right? And what's the subnet mask? As we mentioned, it's going to be 255.255.255.192. Okay. So, the first subnet, all of the numbers from zero from dot zero to dot 63, these two bits are going to be fixed at zero zero. Let's analyze the second subnet. So, that will be 112.168.240 and starts at 64 and the subnet mask is {slash} 26. So, what's the subnet ID? Again, put zeros in the host and you will be good to go, 64. And here is a confirmation that if you put zeros here, then we're going to end up with 64. Now, notice that this is going to be fixed for all the IP addresses from 64 to 127. And it will switch at 128. So, all the IP addresses or the hosts in this subnet are going to have zero one here and the range is from 64 to 127. And here's the subnet mask and it starts at 64, ends at 127. And the usable IP addresses, they will start from 65 to 126. And the last or the broadcast IP is 127. If we go to the next one, 128, then similarly, we can do the same analysis and you will figure out that the ID is 128. Please note that this has switched. So, in the first subnet, the two bits were zero zero. In the second subnet, they were zero one. In the third subnet, they are one zero. And then here, we start from 128 and we end at 191. Subnet mask is the same. The IP addresses or the range is 128 to 191. The usable ones are the next one, 129 and the one before the broadcast, 190. And the broadcast IP is 191. The fourth one is 192 and the ID is the same. And please note that this has switched to a different subnet. So, that's how we distinguish the four subnets from one another. And the first IP is 192, the last is 255. The usable ones is 193 and the last is 254. And the broadcast IP is dot 255. So, now it's very clear that in order to move from the original subnet to get to the entire subnets, so the the original subnet mask was 255.255.255.0, I had eight bits for the host. In order to divide that pizza into four equal slices, I ended up taking up two bits from the host. Why two? Why not three? Because we needed four, four subnets, right? The two bits can give me zero zero, zero one, one zero and one one. So, four different combinations, each one of them will distinguish one subnet from the others. So, that's more than enough for four subnets. If I needed five or six or seven or eight subnets, I would have to take three bits. And the second thing to note is the more subnets you create, the less host bits compared to the original you will end up with. So, the more subnets, the less bits for the host. So, that means less hosts per subnet. So, that's one thing you should keep in mind. The third subnet took the the zero one and that's the 64 subnet. And then the third subnet took one zero and the fourth subnet took the one one. So, as if the rule is if you would like to divide a subnet, a block into two subnets, you will take one bit. If you want to divide it into three or four, then you will take two bits. If you would like to divide it or if you need five or six or seven or eight subnets, then you have to take three bits. Shift into the host side by three bits. If you want anything from nine subnets to 16, you have to take four bits from the host field. And that's how it works. Okay, so at the end, the given IP range into four subnets, the resulting subnets will be {slash} 26, which is two bits longer than the original one. So, we have borrowed two bits from the host field in order to create the four subnets. And each new subnet will only have six host bits, which means 64 IP addresses only. Whereas the original one had 256. One golden rule, please stick that, engrave it in your brain, is once you subnet an IP address range, you can use these as you wish, but you cannot use this anymore. And here is a rule to summarize what we discussed. If you started from {slash} 24, and if you need one subnet, then don't don't do subnetting. If you need two subnets, then you have to borrow one bit. So, the resulting subnet mask is going to be {slash} 25. That will give you two subnets and it will leave you instead of {slash} 24 gives you eight bits for the host, this will leave you with seven because you have already borrowed one. And that will leave you with a total of 128 hosts in each resulting subnet and the usable ones will be 126. So, please notice, the original one, you had 256 and the usable were 254. Here, you have two subnets, each one of them has 128. The usable in each one of them is 126. So, you waste two in the first subnet and you waste another two in the second subnet. So, the total usable hosts are not going to be 254, they are going to be 252. So, subnetting wastes some hosts in the original subnet, but we have to do it because that is best practices for building infrastructures and networks and different lands and different offices and different wide area network links and so on. If you want to subnet to three or four subnets, you have to borrow two bits. If you want to subnet five, six, seven or eight, up to eight, then you have to borrow three bits. And the subnet mask is going to be longer in each one of them. And that means the remaining host bits are going to be lesser and the total number of hosts and the usable ones are going to be lesser as well. So, the more subnets you make, as you notice here, for example, I have more subnets and it's {slash} 30, it only has two usable IP addresses. So, the more subnets, the lesser hosts per subnet. So, you have to ask the questions, how many hosts per subnet, how many subnets do you need and then you can assess and see if the block given to you is enough or not. All right? Hopefully, that was clear. Now, let's cover and identify the public IP addresses. We're going to talk about public IP addresses and then private IP addresses and we're going to distinguish between them. Very important to understand. So, what's a public IP address? A public IP address is an IP address that can be accessed over the internet. Are you saying that there are IP addresses that cannot be accessed over the internet? Yes, and these are the private IP addresses. In your home, internally inside your network, you will have private IP addresses. So, the internet cannot get directly into your machines. They cannot. They have to go through a public IP address and that will be how they get to you and then this router needs to do some magic to send you the traffic. So, if you go on your browser and then you type cnn.com, when you type cnn.com, you are using a private IP address. We're going to talk about this next. And the router is going to convert that into a public IP address before sending that out to the internet. As if it is masking a different identity, telling the internet, "Hey internet, I am defined on the internet. I have an internet approved IP address, a public IP address, and if you want to come back to me with the response, please use this IP address." Any device or network that wants to communicate directly with the internet must use a public IP address. Even if it is your home router, yes, your home router does have a public IP address. And same thing, the router at your office or your company. And the same thing when you go to an airport and you connect to the wireless LAN at the airport, then the airport must have public IP address on the internet. If we reciprocate, that means if I need to get into amazon.com on the internet, amazon.com must have a public IP address. Yes, that's correct. If I want to get into cnn.com, into britishtelecom.com, anything that is available on the internet, that entity must have a public IP address. So, what's the public IP address? Think about the postal system. If you don't have an address registered on the postal system, that means nobody can get to you. If you are living in the middle of the jungle and there is no address and there are no streets and post doesn't deliver into your location, that means you are off the grid. Nobody knows about you. You must have an address in order to be able to send and receive mail. The analogy in the networking is if you would like to be on the internet and known and addressable on the internet, you can send and receive, you You have a public IP address. It doesn't have to be you, but the place where you are in must be connected to the internet. Where would you get that? At your home. The one company or service provider or telecom company that is providing you the internet connection will provide your router with a public IP address. So, that's how it works and there is no deviation from this. Public IP addresses, they are visible on the internet. So, anyone online on the internet can reach it unless you put some security measures to block incoming traffic. There is no two persons or two homes or two entities globally on the internet that would be using the same IP address. So, it is globally unique. So, no two public IPs are the same anywhere in the globe. And it is used for communication, for websites, for servers, for emails. All your computer use on the internet or laptop or iPhone use on the internet needs public IP addresses. And it is routable. The internet wherever you are, as long as you have a unique public IP address, they will be able to get to you and they will be able to send your traffic wherever you want to send it on the internet. The IP addresses, now it's not random. What you are telling me is the service provider, the Telco companies, the governments are the ones that have the blocks of IP addresses and they are in control. Otherwise, it's going to be a mess. So, IP addresses must be assigned and managed globally by official organizations and this is called the IP address hierarchy. And these are existing in the different continents and in different countries as well. So, IP address must be unique. Otherwise, if two entities had the same IP, the internet wouldn't know where to send the data. And this is how the hierarchy looks like. So, IANA and then in Africa, in Europe, in Asia Pacific, in Latin America. And then we have resource allocation hierarchy and then we have the service provider and then the national IP registries in each country. So, in each country, the continent responsible ones are going to deliver blocks to the countries and then the countries are going to deliver deliver the blocks to the ISPs and each one has a record of what is used and what is not used. And that's exactly the analogy with plate numbers. When you go into a country and you get a plate number, the plate number may have the city name or the city code and then a number. The phone system, same thing. You have the country code, area code, and a unique number. The exact same thing happens on the internet. So, IANA is the Internet Assigned Numbers Authority, the top-level body and that's in the US. And then you have the regional internet registries which will manage the different parts of the world. And these are ARIN, North America, RIPE for Europe and Middle East, APNIC for Asia Pacific, LACNIC for Latin America, and AFRINIC in Africa. And then we have the national internet registries inside each country and then the internet service provider. What do you get out of all of this lecture? The message is to be on the internet either you yourself, if you're using your phone in the street, or the place where you are must be connected to the internet. To be connected to the internet, that means you have public IP addresses that are registered and they are assigned to you legally and you are authorized to use them and these are unique. They are They will not exist anywhere else on the globe. What are the private IP addresses if you have already discussed what are the public IP addresses? Private IP address ranges are IP addresses that you can use without having to go and ask for assignment or authorization from anyone. And these are called the RFC 1918, the request for comment. There are private IP address ranges and these IP addresses are not routable on the internet. So, you cannot have your wireless router at home be connected to the ISP using a private IP address. That's how it works. Or that's how the norm is. If you have your home router or your phone configured with a private IP address and you try to connect to the internet, it will not work. So, they are not routable. The private IP ranges, they are not routable on the internet. They are not visible on the internet. So, they have to be hidden behind public IPs. So, they won't work directly on the internet. They have to be using a means that is connected to the public internet to be able to access the internet. They can be used freely within private networks. So, the reason why they came up with the private IP address ranges is because they were afraid they will run out of the available IPv4 public IP address ranges. So, because they were afraid of that, they said, "Okay, we're not We cannot assign an IPv4 public IP for each device." At my home, for example, let's say I have four family members. And each of us has an IP phone and each of us has a laptop. And my younger kids, maybe they have iPads. And then I have the smart TV and maybe my fridge is a smart fridge, IoT, that also has an IP address. So, I need in my home easily about maybe 12, 15 IP addresses. If each one of them would have been requiring a public IP, that means we would have been done with all the available IPv4 public addresses long time ago. They said, "Okay, fine. Let's now assign private IPs. Anyone can use it inside their homes, inside their offices, for printers, for fridges, for smart TV, for whatever." And that is for networking within the place. You don't need the internet. If you need the internet, then you have to put a gateway that will have a public IP and that will be the bridge to the internet. So, here's the example. In my home, I have these devices and these are going to take private IP addresses. One would tell me, "Mm, okay. Can we prove it?" Yes, I can prove it, but just hold on. And the Wi-Fi router coming from the Telcom provider, it will have a public IP and that's how it works on the internet. How does the conversion happen from private to public on the way out? And when the response comes back to the router, this will be addressed to the router public IP. How does that get converted back to the correct IP address, the private IP address? Who does the conversion? That will be your Wi-Fi router in this case. Private ranges, 10.0.0.0/8 and that's a class A. 172.16.0.0/12. So, 10 172.16 and 17 all the way 18, 19, 20, all the way to 31, they are included in this range. This one will give me 16 million IP addresses. This one will give me 1 million IP addresses in each one of these networks. So, I have 172.16.0.0/16 all the way to 172.31.0.0/16. This is for large, medium networks and then this is for homes and small offices, 192.168.0.0/16. Here is the interface IP address that I have on my computer, on my Mac right now, 192.168.68.108. Let's compare that. Contrast this to this and you'll find that I have been assigned through Wi-Fi from my home router, the Wi-Fi router at home, I have been assigned this IP address. And that belongs to RFC 1918. And if you check with IP config or this command, if you have Mac or Linux, try this. Or IPA if you're on on Linux. And then in my case, this is the IP address. Check in your case. If you have Windows, go to CMD and type IP config and hit enter. Of course, here it's not complete because I have to do IP config get interface address and that's how the IP address. So, that proves my theory that I am getting a private IP address, but on the internet I am seen as if I am the IP address on the router. And that's how I communicate with the internet. So, what's the conversion process that happens on the router? This is called network address translation and sometimes it's more specific, it's called port address translation. When we discuss the IP ports later on, we'll come back and revisit and I will explain to you what PAT is. But for now, the IP address that is on my machine, which is a private IP address, when the message which is going, let's say, to cnn.com, when this message reaches the router, the router will will say, "Okay, now. I know it is coming from this IP address." Let's say that's the IP on my machine, 192.168.68.108. I'm going now to remove that as the source, basically, and I'm going to claim that I am the source. Why? Because your IP address cannot go to the internet and the internet will never be able to deliver the response, but my public IP address is a registered one on the internet and the internet knows how to take my traffic forward to cnn.com and knows how to get the response back all the way to here. And I promise you, when I get the response, I'm going to do the opposite and I'm going to deliver the message to you. We're going to talk about this more later on. If a device with a private IP address inside the private networks needs to communicate to the internet, then the router will use network address translation and swaps the device private IP address for the public IP on the router. That's the only way this can work on the internet. Let's do a quick demo using a Windows client or a Windows PC in order to show you how to start the command prompt in Windows and also to see the private IP address that we will have in that machine. So, I'm using a Windows machine in AWS to simulate the client. So, this is the public IP address as you can see here and this is the private IP address. So, this is as if it is your laptop. First of all, how can I get to the command prompt? If I go here and I do a search, and then here in the search criteria, I just type CMD. So, that's the command prompt window that we need to open. So, when you open the command prompt, what you will see is this prompt and we can do from here IP config. That will show what configuration we have and as you can see here, this is the IP address, the private IP address which exists right here. So, that shows you that it is the same. Now, it's time to talk about how do routers actually work? What we have not done yet is configuring or at least understanding how should the router be configured? How should the router be told how to use or find out the best path to a destination. That's what we are going to do in this module. So, we'll know the AWS infrastructure, we'll know what is an AWS VPC or virtual private cloud or virtual data center. We'll know how to create subnets and route tables or configure routing inside a VPC. We'll also know how to connect a virtual private cloud or a virtual data center that you build in the cloud to the internet. And then you can launch applications or websites and it will be accessible from the internet. We will learn what is the difference between a public subnet and a private subnet from the AWS viewpoint. We learned before about public IPs and private IPs. Now, we are going to learn about how to apply that into the AWS cloud inside your virtual data center. We will learn how the address translation happens. So, we're going to discuss network address translation as well. We also we are going to learn more about the IP packet headers and that would be a lot of topics that we are going to look at. The most beautiful thing is it's not going to be designing an IP scheme on a piece of paper. We are going to go on the AWS cloud and we are going to implement that and you are going to build your own virtual data center in the AWS cloud by the end of this module. All right? So, hopefully that makes you excited and let's go ahead and get straight into it. Okay, so IP routing. How does IP routing work? Very important to understand. From what we have learned before, devices on a local area network, if they need to communicate among themselves, and as long as they are in the same VLAN, they don't need a router. But if any device would like to communicate externally with other sites that don't belong to the same IP network, they have to use a router for that. Only routers are capable of forwarding traffic between networks. Also, we learned that if we had two VLANs, red VLAN and a blue VLAN for instance, and we would like to route between them, so in that case also I need to have a router that connects between them. It will have one leg in the red VLAN, one leg in the blue VLAN, and that router will route between them. If the switch has a router or a router functionality, if it is an intelligent switch, sometimes they call it a multi-layer switch, so the intelligent switch will have a built-in router and it can do that internally. But anyways, going from one subnet to another subnet, if they are in the same LAN but on different networks or if it is from a local network to a remote network through wide area network, there has to be a router used. There is no way around this. All right? When one device tries to talk to a different network or subnet, it can't go there on its own, it needs a router. And the routing is done or the routing is done by devices called routers. All right. Routing is the process of selecting paths inside a network to forward traffic between hosts. So, if this camera is trying to send a video footage to be saved somewhere in storage in the data center, for example, then it has to forward that traffic to the router because now it's going outside the LAN, it will cross a subnet in the LAN and another subnet to get here until it makes it to the storage. So, it will cross multiple subnets, so it needs a routing decision to be made here. What is the best path to forward this? When it gets to this router, this router can send it in or can send it to the internet. How would it decide? Based on the routing, it will send it inside to the data center because it knows that the storage IP address is towards the data center switch. The data center switch will know where to send it and it will send it in. So, I have a routing done here, routing done here and a routing done here. Each one of them will do a a decision or will will make a decision based on its knowledge of where that destination could be and the best path to get to that destination. In order to do that decision, the routers will use what we call routing tables. Sometimes they are called forwarding database, forwarding tables, and algorithms in order to determine the most efficient path to forward traffic. So, if it has if the router has multiple ways to get to the data center on the other side, then which one to use? Then there has to be an algorithm that will enable the router to find the best path. When thinking about the routing tables or the forwarding database, the best analogy is think as if we are now configuring a GPS on the router to define directions to destinations. So, the routing table is exactly like a map or a GPS on the router. Each router needs to build a routing table or a database of known destinations and how to reach them. When a router receives an IP packet, it will follow the process below. Based on the existing routing table or the forwarding database on the router, when the packet is received into one of the router ports, one of the router interface, let's say this one is connected to a switch. All right? And then we have a PC on the switch or a laptop that is trying to send something outside the network, so it gets to the router. So, that message is called a packet. That message from the laptop to the router, each one is called a packet. So, packet is received. The router will receive the packet. It will check who is the sender and where is the destination. Now, it would look at the destination and then check the GPS, check the routing table that it has. Do I know where that destination is? If the answer is yes, then where should I forward it? And then it will send it to the IP address or the interface. So, here for example, destination 10.0.0.0/24, if you want to get to it, send it to the IP address 100.2.1.1, which is a connected router or a connected network. If you don't know where it is, then by all means, drop it. Don't guess. The router will never guess. If it knows how to get to the destination, it will send it towards the destination. If it doesn't, it will just drop it. And that's it. And you will not get an error telling you that I have dropped it because of such and such. You will be waiting on your browser trying to get to that website that is hosted and things are not working because you haven't configured your router properly. Routing tables, who's going to be building them? Who is responsible to populate that database or the GPS? Who is responsible to put the data inside it? So, the routing table or the following database can be configured manually and this is called static routing. If your infrastructure is simple, small, you can do static routing and that means you are configuring the routing manually and you are building the router database manually. That is an option when you are talking about a small scale infrastructure. And we are going to do manual configurations, by the way, in our demos in AWS. If it is larger than that, I have two routers. All right? And let's say this router knows about other five route or three routers. And this one knows about another four routers. And each one of these routers knows about multiple routers. I have so many networks now. I mean, this could be like a mini internet. It doesn't make sense to go ahead and build the information in each one of these routers to let it know the possible destinations and how to get to them. It doesn't make sense. You will not be able to maintain it from an operational perspective, it will be a nightmare. And also it will be prone to mistakes. So, what do we do then? There is something called routing protocols, dynamic routing protocols. For example, Border Gateway Protocol is the dynamic routing protocol used on the internet. Any routers on the internet, they communicate especially the big ones, the backbone ones, they they communicate using BGP because the internet table size could be in the multiple gigabytes if not more than that. So, what do they do? We enable BGP here, we enable BGP here, we enable BGP on the routers, and then the routers, each one of them will start to share the networks that it knows about with all the neighbors. So, this will will also share the information and that's how they start to populate their GPS, the routing database, the routing table, their forwarding database dynamically. Either way, a router must have a forwarding database, an accurate one, either manual or dynamic in order to be able to forward traffic properly. The router does not come pre-configured with a route table. The router comes from the manufacturer and then you place it in your infrastructure and you have to configure it and customize it according to your infrastructure needs. So, this is something that you will need to do. So, it requires dynamic routing protocols to be configured. Open shortest path first is an example and Border Gateway Protocol is another example. When you work with AWS, you will need to know about BGP if you'd like to scale connectivity and configure wide area network and enable dynamic routing protocols and all that. But you can live with a static if that is sufficient. All right. So, the routing table will be populated either dynamically or statically, manually. And then the flowchart or the decision-making process will work. Okay, there is a concept called default route or default [snorts] route. What is that? In the previous examples, we looked at this forwarding table and the decision was either I know where the destination is so I can forward it. That's the router decision based on its forwarding table or route table. And if it doesn't know, it will drop it. This is not practical. Let me tell you why. Let's say for example, this router is the one connected to the big eye, to the internet. And this is the LAN that will send the traffic or maybe the wireless LAN in your office that is connected to the router. And then the router has this table. And based on that, it will forward to the internet. So, when it receives your message, it will look at where it is supposed to go and then will check if it has an entry for that destination and then it will send it out. But this is not practical. On the internet, we have millions and millions and millions of networks and websites. Who is going to configure all of this here? I mean, it's my home office. I'm not going to run BGP as the dynamic routing protocol in my small router because it doesn't support it. It cannot process it. It cannot maintain the full internet table that requires gigs and gigs and gigs of storage on the router. So, this mini router cannot store it, the wireless router. And at the same time, I'm not going to go on the router and start configuring the 10 million websites that I may reach out to or try to connect to throughout my life. Nobody does that. So, what's the alternative to avoid having to fill manually a large routing table and even if you try, you will not be able to make it because there are millions and millions of networks. And if you want to run that dynamically, the router does not support the dynamic routing protocols. And even your ISP will not provide you any BGP information because you are just a home user. They would do that if they are connecting to a university, if they are connecting to a corporate like IBM or one of the big companies, they would give you the full internet table. But for you as a home user, of course not and your router cannot support it. Way out of this is we use something called the default route and we are going to stretch the flowchart a little bit. A default route is basically to tell the router, if you don't have a specific entry for this destination, please send it this way. So, it defines a path to the router in case if it doesn't have an explicit entry in its route table for a specific destination, how to deal with it. Don't drop it, please do this instead. So, the default route is a special route table entry that can be used as a last resort, a last choice to forward a packet only if only if there is no other specific entry in the route table to be used. So, this is like your plan B. If you can't find a matching entry in the route table, please go for plan B and use this path. So, how would that look like? So, in a route table, there will be an entry like this and sometimes it's written as /0. And that means to the router, here are the specific entries. If you get anything going to an IP address within this range, please use this entry. If you have anything headed into this range as a destination, then use this entry. If you get a destination IP address in a packet, so it is going to an IP address that does not belong here and does not belong here, do not drop it. Instead, forward it to this IP address. And the flowchart would be, a packet is now received. Is the destination known through a specific entry? If yes, go ahead and forward it according to the entry. If no, do not drop it. Is there a default route, a gateway of last resort in the table? If the answer is no, then go ahead and drop it. There is nothing you can do. But if yes, then please forward it according to the details in the entry. So, this is very important and it helps save effort and minimize the size of the route table immensely. In your home office, you have your own local network that doesn't need the router. But then, if you would like to go to the internet, then the router should send it to the ISP through the link and the ISP should deal with it, right? So, you have only way out to any destination. So, in that case, on that router, it's enough to have only the default route. 0.0.0.0, send it on this interface to the ISP and let them deal with it. Hopefully this is understood. We are going to look at an example of how we populate that and we include the default routes as well in order to cement the knowledge and clarify any ambiguities. Let's have a look at an example, a practice on how routers should be configured and we'll assume we are going to do that manually. How we can configure that or what information we need to prepare in order to configure on the router when given access to that route. So, have we have this example. We have a local area network somewhere. And then we have a data center remote, it's not nearby. And we have already installed router A and router B in the LAN side and in the data center side respectively. And we also work with the telco provider to have a wide area network connection between the two. So, this router, router B, has now a WAN connection to router A and has an internet connection here. Also, we have here a subnet configured, routing subnet configured between the data center switch, the intelligent switch and the router. And this is going to be the 10.0.255.0/30 subnet. Has four usable IP addresses. .1 is on the switch and .2 is on the router. So, this is the IP here and this is the IP here. All right. The cider block on this side is 10.0.0.0/16 out of which we are cutting subnets. So, we're going to provide the application segment, the subnet 10.0.2.0/24. And the database is going to be 10.0.1.0/24. And you have this subnet as well. All right. For the WAN side, we have worked with the telco provider to use the subnet 172.18.0.0/30. .1 is on router A, so this is the IP address right here. And two is the IP address right here. On the LAN side, the cider block is completely different. So, this is 172.18, this is 10.0, and this is 192.168. The 192.168, we are going to allocate one to the router and other IPs for the other devices. So, what's needed now? We need to prepare the routing table. We need to include all the required details on router A and on router B. And that should include all local routing within the data center, from the data center to the LAN, from the LAN to the data center, within the LAN, and from the LAN to the internet, and from the data center to the internet. Oh my goodness. How can I prepare all of this information? Looks tricky. It's not. So, let's look at the router A side first. What do we need to configure on router A? What does router A need to do? What are the possible destinations that it will have to forward traffic to? This is exactly what we need to configure in its routing table. So, router A knows about the local area network, right? So, this is number one. It also knows about the wide area network. And it should know how to get to the data center. Also, it is required that we need to know through the router how we can get to the big eye, to the internet. So, let me just write it as an eye here. So, here we have four entries, or four decisions, or four possible destinations from the local area network to the outside, or from the outside to the local area network. So, how do we define that on the routing table? The routing table usually have at least two entries. One is to define which destination and how to deal with it. Where to send it next? Next hop means what is my target to get to that destination, or what's my next hop? What's the next device, or next IP address uh that I should send it to in order to get closer to the destination? So, first of all, let's do number one. It knows about the local LAN. Through what? Through the LAN interface. So, the interface which is configured here, and it's on the switch. This interface, depending on the router type and model and all that, will have a name. Could be LAN zero, it could be gigabit ethernet zero, it could be gigabit ethernet zero {slash} one {slash} two. Whatever the name is, this is irrelevant now. The LAN interface is how the router A can get to the LAN. Is that right? Yes. So, 192.168.1.0 {slash} 24, which is the LAN IP address range, and that is reachable through the local area interface on the router. All right. So, that's number one. Number two, 172.18.0.0 {slash} 30. How can the router A get to this subnet? This is through the local WAN interface. And this will also have a name. It could be also gigabit ethernet, it could be something else. Whatever the name is, you can get to it through this interface. All right. So, these are the local networks that it's directly connected. How about getting to the data center, and how about getting to the internet? So, getting to the data center, that has to go through the wide area network to router B, right? So, my target, my enabler, my helper to get to 10.0 has to be router B. How can I talk about router B here? I know its IP address on a shared subnet. I have one and the router has two. So, to get to this network, I need to go through 172.18.0.2, which is router B interface. How about if I want to go to cnn.com, or dolphinedacademy.com? How am I going to do that? How can I get to it? Again, through the WAN, through router B, because we don't have a direct connection to the internet from the LAN. So, we have to hop through the wide area network to router B, and then we can go to the internet, right? So, how can I write that? The internet has so many websites and so many IP addresses, and I'm not going to list all of them. Then we can take advantage of the default route. And I can tell the router, "Hey, if there's anything else other than the ones specified, any other destination other than the ones specified, please send it to same thing, to router B." So, now we have everything identified on router A side based on the requirements we have right now. All right. Let's go ahead to the other side, to router B. So, in router B, what do I need to define? I need to define this subnet, which is between the data center switch and the router. That's number one. I need to define the local area range in the data center, the 10.0.0.0 {slash} 16, which is behind the data center switch. So, I have to come through the data center switch in order to reach any one of these subnets. That's number two. So, number two is the range, or let's let's me just write it here. Number two. Number three, I can get to the internet, to the big eye. Through router B, through this interface. And let's assume that the opposite router interface in the ISP, so this is one. Let's assume that it is also 122.54.2 on the other side. What else? The WAN connection, the WAN interface. I know about this subnet, right? How? Through this. So, this is number four. So, we have So, this is three, number four. And also, I need to respond to any requests coming from the local area network. So, this is number five. So, I need to define all of these here. So, we'll have five entries, not four. Let's do it one by one. How can I get into the 10.0.0.0 {slash} 16, which is this cider range? I can get to it through the data center switch IP address that shares with me a subnet. So, I can get to it through 10.0.255.1. All right. How can I know about the 10.0.255.0 subnet {slash} 30, which includes one and two? Well, that is directly connected through my LAN interface. How can I get to the 172.18.0.0 {slash} 30? That's easy. That's through my WAN interface. How can I get to the other side, to the LAN? Oh, okay. In that case, if you would like to get to the LAN, then I have to go through my colleague router A. And by the way, I share with router A a subnet, and he is one, or it is one on that subnet. How can I get to the internet? Okay. Anything else not explicitly defined, then I can get to it through 122.54.2, which is the IP address we assumed that it is on the router at the ISP connecting to our router. So, this needs to be configured manually on the two routers. And here, manually is enough because it's a small network. Or maybe I will enable BGP configuration between the two routers and just enable that, or OSPF, or any dynamic routing protocol. Either way, this is the minimum that I need to see on router A, and this is the minimum that I need to see on router B. All right? Hopefully, this is clear, and it clarifies how do routers take decisions. So, in this case, if there is anything unknown destination on router A, when the traffic comes from the LAN, it will be sent to router B. Router B, please deal with it. If it gets to router B, and if it is not part of these entries, then it will say, "Okay, this is the right entry to use the default route, and I'm going to send it to the internet, and let the ISP deal with it." So, we have two default routes, one in each routing table, and the use is clear. Let's talk about what an IP packet is. Let's get deeper into an IP packet, and understand what information does it carry with it. In order to understand that, the message in IP networks, or networks that use TCP IP, is called a packet. So, let's take a step back and do an analogy first. If John Smith, who lives in 32 University Street in Boston, Massachusetts, in this zip code in the US, would like to send a mail through an envelope and a stamp, like a legacy mail, to Sarah, who lives in this address in Egypt. What would John do? John would write on the envelope, of course, after a stamp is used, John will say, "From my name, my address," as John, "and it's going to" and the details for Sarah. And that's how it gets correctly to the right address, through United States Postal Service, and then through the Egyptian Post. The response will be the other way around. It will be from Sarah, going to John Smith, and this will allow it to be delivered properly. So, this is in postal systems. Now, what about in networks? So, the IP packet is like a sealed envelope as well, carrying the digital mail or the digital message from one end to another, one computer to another. So, if I have a user connecting to the internet, the user's IP address or the user's home router public IP address is 100.2.55.3. It is not 10. And it is not 172.16.31 and it's not 192.168. So, this is a public IP address and this is not a private IP address. So, whether it is on the home wireless router or on on the user's phone and the user is connected to data to the internet, the user would like to get to a website and the website IP address or the server IP address is 205.111.37.86. Again, this is a public IP address. Of course, I'm not allowed to use this these IP addresses because they must have been assigned somewhere on the internet. But, I'm just showing you an example of what might be a public IP address just for the use case. All right? So, I have no right to use these IP addresses in any network that I build because these are public IP addresses and they have to be allocated according to the registry, to the hierarchy of the public IP address control system organization or organization across the globe. What am I trying to get to? Comparing from the postal office example, what if we need to send a digital message from this IP to this IP? What happens? Then an IP packet has to be created and the IP address of the source must be included as a from field and then the destination or two field will carry the destination IP address. So, it will look something like this. I'm just trying to show it as an envelope. It's not an envelope. So, it has to show the source, where it came from, which is this IP address. And it has to show the two or the destination address, which is the other side's address. And since both are public, that means the internet will be able router by router to carry that message until it gets to the server. Great. What about the response? The response, like in the postal and mail system, it's going to be reversed. So, now it's going to be a message from this as the source to this as the destination. And that's why it will be shifted the other way around. So, the from is now the server going back to the user. So, it's exactly the same. Well, this is source IP and and the destination IP. This is not the message. The message is inside the envelope and we call it the payload or the data within the message. So, what is this then? These are like the stamp and the envelope. At the end, when I receive the message, I'm going to discard the envelope. I don't need it. It's not anything that I need except for John's address or the other party's address. And as soon as I write the new envelope, I can discard the old one. So, these are called headers. The IP packet includes the actual message data being sent and which is called the payload inside the the envelope. And the IP packet also includes the IP addresses and other details and these are called the headers. So, the message sent is not only the data you want to send, but also other required information in order for the message to be delivered properly. These are called headers. So, when you hear the term headers, please know that we are talking now about IP addresses and other details necessary in order to deliver the message from node A or host A to host B on an IP network. All right? Since we are going to apply all our hands-on in the AWS cloud, let's find out what is the AWS global infrastructure and what does it consist of. The AWS cloud globally consists of a number of what they call geographic regions. A region is an AWS presence, a group of data centers that are in one country. In some countries, they have more than one region, like the US for example, it has four regions. And a lot of other countries, they have only a single region. When the AWS business grows in one country, they may consider building other regions. At the moment, they have 38 plus geographic regions. How can you find out the details about this? You have this link, aws.amazon.com/about/aws/global-infrastructure/regions-and-availability-zones. And if we go to that link, as you can see here, this one lists the up-to-date information about the AWS regions. So, this is 38 at the moment and 120 availability zones. And you can go continent by continent and then you will be presented with this globe view that will show you the regions in the area or the country or the continent that you have chosen. All right. So, you can acquaint yourself with this, play with it a little bit to find out more information that is not important to memorize because it only shows that AWS globally has multiple regions. As we mentioned, 38 plus geographic regions and each region has three or more availability zones. The availability zone is one or more data centers clustered together and interconnected with very high-speed links. The region may have three availability zones and some regions has six regions like the one in North Virginia. We have 120 availability zones at the moment and increasing. And as I mentioned, the availability zones in one region are interconnected via high-speed links. So, region one for example, availability zone one, two, three and they have high-speed links among them. Same for region two, same for region N. And now we need to understand what is the availability zone. So, an availability zone consists of one or more interconnected data centers. Like this. So, if we look at one of the availability zones and zoom in into it, you'll find that one or more data centers, now we're talking about the data centers that we know, and they are interconnected with very high-speed links. And these data centers, they could be, I don't know, 10 km, 20 km, 50 km away from each other. And the point about having more than one data center in an availability zone and then more than one availability zone in a region, the whole point is high availability. So, now if I create three virtual machines in the same availability zone, chances are they're going to be created in different data centers. So, if one of them gets busted, the other two will be alive. And that's why it's always recommended when you create workloads, applications, databases in AWS, it is recommended by AWS to establish it in multiple availability zones. Not in a single availability zone. If you do this, if you have your workload or application or virtual machines distributed across more than one availability zone, then in the eyes of AWS, you are highly available. Your workload is highly available. All right. So, that's enough about the AWS global infrastructure. Next, we're going to introduce what is an AWS VPC, the virtual private cloud in an AWS region. So, let's now go ahead and discuss what is an AWS VPC, a virtual private cloud. That is your virtual data center that you can create in a minute in cloud computing or in a AWS cloud to be more specific. So, a virtual private cloud, building your own isolated virtual data center in the cloud. So, the VPC is a virtual data center in the cloud, which is isolated from other VPCs by default. The VPC client or the customer who owns the VPC, who created the VPC, has full control over the VPC or the VPCs. You can create more than one if you want. And a VPC is confined to a single AWS region. You will never see a VPC stretching between two regions. It's either in region A or B or C, but it's not going to be half in here and the other half in another region. A default VPC is created automatically in each AWS region when an AWS account is created. And the VPC spans all the availability zones in a region. What does that mean? What does it mean when I say that a VPC stretches across availability zone? That means in that VPC or virtual data center, you can have virtual machines and workloads. We call the applications and the data that you add and all that a workload or an application or a database, whatever that is, you can host it in any of the availability zones in that region. As if we are saying that you can control where in the region to place your workload inside the VPC. It's up to you. You can have a virtual machine for application A in availability zone A and in availability zone two or B and in availability zone C. You can have databases in availability zone A only. That's up to you. You can have some security virtual machines also available in availability zone two and three only but not in one. It's up to you. Creating a VPC means you have the permission to create a workload a virtual machine anywhere in the region in any of the availability zones. Why is that an advantage? Because it allows you to have more availability of your applications. I can now have them or have my e-commerce website in two availability zones in the region. If one gets busted for whatever reason, I have the other one. And remember, we mentioned that the availability zones are far away from each other and each availability zone is a cluster of one or more data centers interconnected with very high speed. The availability zones themselves are also interconnected with very high speed. So, hosting your application or data or website in more than one availability zone gives you an advantage of being more available and the uptime will be higher and your customers are going to be happier. So, what are the components of a VPC? When I build a virtual data center that takes me a minute or less as you will see. What are the components that I can create in a VPC? First of all, you can't have a VPC without a CIDR block. There has to be an IP address block of which you can divide subnets for the VPC. And there is a router configured automatically and it connects to all the subnets that you create it within a VPC and it guarantees that they can all talk to each other. Then you have the route tables which will tell the implied router for each subnet what to do with the traffic coming into the subnet or going out of the subnet. We're going to discuss that in detail. If the VPC needs to connect to the internet, that only happens through the internet gateway or abbreviated the IGW. Now, for security, we are going to discuss that in subsequent modules. We have security groups and network access control lists which are virtual firewalls, but we'll discuss them when we get to them. So, let's start with a CIDR block. You cannot have a VPC without a CIDR block. It's all IP communication inside the VPC, so there has to be an IP address range. And the VPC subnets are created from that CIDR block. So, that's the extra large pizza out of which you can break down slices which are going to be your subnets. And the CIDR block size can be anywhere from as small as /28 to as big as /16. So, this one gives you a total hosts of 65,000 plus and this one gives you only 16 hosts. Of course, this is not something that you would want to do unless if you are testing something for 5 minutes, 10 minutes, half an hour and then you will switch it off. Default size for CIDR blocks in AWS are /16. Can I have /15, /14? No, that's not allowed. All right. So, the VPC stretches across all availability zones in one region and the VPC is confined within one region, cannot stretch beyond the region and I can have one or more CIDR blocks actually, but at least one and the subnets are chunks out of that CIDR block and they can be in different availability zones. Let's now discuss subnets and route tables as far as a VPC goes. So, let's start with subnets. We can configure multiple subnets per VPC. As big as your original size block of IP addresses, the CIDR block, you can create as many subnets as you want. So, I can have one subnet in availability zone one, one subnet in availability zone two, and I can have more than one subnet per availability zone if I want. As we mentioned that the VPC is confined within a region, cannot stretch beyond a region boundary similarly, a subnet cannot stretch outside of an availability zone. So, the subnet and all its hosts must be within the same availability zone. So, the VPC is confined to a region, the subnet is confined to an an availability zone. So, can I configure a virtual machine here and assign an IP address on sub- subnet one in availability zone two? The answer is no. If subnet one is in availability zone one, all the hosts in that subnet must be in availability zone one as well. Can I have more than one subnet per availability zone? By all means, yes. So, now we have the subnets, but we need the implied router. You don't need to configure it. It will be created automatically and it will connect to every single subnet that you created or will create in the future in your VPC. So, nothing needs to be done on that implied router except for if you want, create route tables. The implied router will forward traffic among the subnets in a VPC, but it also will have the traffic or will help the traffic forward the traffic that is going outside the VPC or traffic coming from the outside to one of the subnets in the VPC. So, basically, this is where traffic can roam around within the VPC, go out or traffic can be received through the implied router. Routing between subnets within a VPC is enabled by default and you cannot disable it. We are going to look at that. The implied router by default will have one routing table and the routing table would say all the subnets within the CIDR block are local. I know how to get to them all. So, all the routing among the subnets is enabled by default and you don't need to do anything about it. This router is fully managed by AWS. You cannot access it. You cannot log into the router and you cannot change configuration in the router. All you can do is you can play with the route tables that are available to you. Route tables as I mentioned, each VPC has a default route table. It's called the main route table. That route table can be used by more than one subnet at the same time. So, if I decide to keep only one route table in the VPC, all the subnets in the VPC are going to use it. The router can hold a separate route table if required for each subnet. So, I can have RT1, RT2, RT3. Or you can have one route table and all the subnets are going to use it, so the router will use the same route table for all the subnets. Is that in your control? 100%. You can create custom route tables as required and you can assign them to the subnets that you want and we are going to do this. The subnet can attach to only one route table at a time. So, you can switch the association of a route table from one subnet to another. So, let's say this subnet, now I have it with the green route table. I can decide to switch it to the gray route table or to the blue route table. But at any given moment, it will have only one one route table. That means when traffic is going into the router from the subnet the router will consult the route table for that subnet and find out how to forward it. And we're going to do that in the demo as well. All right. So, how can we provide internet access to the VPC? Through what we call an internet gateway. So, the internet gateway is how a VPC can communicate with the internet. So, I have a VPC with subnets and implied router. I have to add the internet gateway, otherwise the subnet cannot get out to the internet. And I can have only one internet gateway per VPC. So, it is fully managed service. You cannot access it and log on to it and there is only one that you can create and attach to the VPC at a time. I can remove it and attach another one, but this is a fully managed, scalable, highly available service from AWS. You don't need to worry about that. In order for a subnet to use the internet gateway, its routing table must have an entry pointing to the internet gateway like this for example. Any IP address not specifically listed in the route table, please send it to the IGW. So, now it's a good time for us to have a look at all these components in the AWS console. So, now it's a good time to stop and start to show you the different things that we have discussed in a VPC. The VPC, the subnets, how it stretches across availability zones, the route tables, the internet gateway. And the best way to do this is to go ahead and create a custom VPC and create subnets and create the internet gateway, attach it to the uh VPC and look at how we can do all of the stuff that we have talked about, how we can create different route tables and so on. So, first we're going to do a walk-through. I'm going to show you an AWS VPC that is created by default by AWS. And this is true for anyone anywhere in the world when you create an account in AWS, they will voluntarily create a VPC for you with the same specs in all the enabled regions in your account. Usually there are 16 or more regions. So here is what we need to create. So this is going to be a custom AWS VPC. A custom one means that is a VPC that we are going to decide how it will look like. So what do we need to do? We need to create the VPC and the name of the VPC is going to be custom_vpc. As we mentioned before, a VPC must be confined to a region. So here they are requesting that we create it in Ohio in US East 2. This is the code name or the nickname of that region. We need to create four subnets in the designated availability zones as shown below. So we are going to create subnet one in US East 2A. US East 2 is the name of the region and A is availability zone A. The CIDR block provided for the VPC is 172.31.0.0/16. So we are going to use that as well. Subnet one that we are going to create in availability zone A in US East 2 is going to have the block range or the IP address range 172.31.0.0/20. Please note that this is 20 and this is 16, which means this is a subnet from this block. Then we are going to create subnet two in availability zone B in the same region and the IP address range for that is going to be 172.31.16 .0/20. Subnet three and four are going to be .32.0 and .48.0 and both of them are /20 as well. Then we are going to create and associate the route tables as shown. So we have a route table one, the green colored one, and then the gray colored one is going to be route table two, and then route table three four, which is the blue one. Route table one will be associated with subnet one. So subnet one must be associated with route table one. Subnet two will be associated with route table two. Subnet three and four, both of them at the same time, will be associated with table three four. Remember, we mentioned that at any given time a subnet can be associated with only one route table, but nothing stops me from associating two subnets with the same route table at the same time. We are going to reference this again, but let's go ahead and do the walk through in the AWS console for the VPC. We are going to look at a default created one and then we are going to move on and create our own. The AWS management console and I'm in the VPC dashboard. So if I go to console, console home, this is the page that you will see when you log in to the AWS account that you have. Then I'm going to type VPC and click on this. So this is going to take me to the VPC dashboard. Let me maximize that a little bit. And as you can see here, you can select the region that you are going to be in. So if you would like to travel from North Virginia in the US to Mumbai in India in 1 second, all you need to do is to click here. So you are now traveling faster than the speed of light to India from the US. Now, if you are done with what you are doing here and you'd like to go to Germany, why not? There are no airfare tickets and there is no time delays and there are no airports involved. And this is this is the beauty of the cloud that you have a management console, you have a portal, you have an orchestration and management account that can allow you to control your infrastructure and deploy your infrastructure across the globe from one central location, from your office, maybe with your pajamas, and you can monitor all that centrally as well. All right. So Europe Frankfurt, let me use one region that I think I have never used before. So let's try Ireland for example. This is a relatively new account, so I'm sure many of the regions I have not used before. So this is the navigation pane for all the VPC feature and configurations and all that and here you can see that we have VPCs, subnets, route tables, internet gateways and so on. And here you have a summary of what you currently have configured. So VPCs I have one. I have never touched this region before. So where did this come from? This is the automatic VPC that is created on your behalf when you create the account and you get one in every region. Subnets, I have three subnets. And again, because Ireland has three availability zones and that's why it is showing three subnets. If you click here on this side, zones, here you will find the availability zones in each one of the regions. So for example, I am in Ireland, this one, and it shows me that I have three availability zones. If I click on this, it will tell me this is what I have. So I have EU West 1 AZ1, EU West 1 AZ3, EU West 1 AZ2. And opt-in not required, so you are already into that region. You don't need to opt-in to use the region. It's already enabled. Okay, the one that has the most availability zones is the North Virginia one and as you can see it has six. Some have four and this one United States California has two. This is the least I think among all. Yeah, it's the least. The rest as you can see they have So now I understand why I have three subnets. This is because I have three availability zones and what AWS does is it creates the VPC by default automatically and then it will create for you one subnet in each of the availability zones. So let's go ahead and look at this VPC. So what's the name of the VPC? There is no given name. I can click here and I can add a name if I want. So for example, I'm going to call this default. I didn't create it. This is the VPC ID and this is a unique ID allocated for each VPC when it is created and this allocated by AWS. You don't need to worry about it. The VPC is available and if we switch here, you will find that this is the CIDR block 172.31.0.0/16. And if you click to the right, we have a main routing table created by default. I have network ACL and here it shows you that this is a default default VPC. And this is the account that I have. So resource map, if you click on this, it will show you that, let me just drag this a little bit to the to the top. I have the VPC and I have three subnets and all three subnets are attached attached to the same route table and they are connected to the internet gateway. So these subnets are accessible from the internet and the internet can access them. But right now I don't have any virtual machines or anything and that's why I cannot access the internet and nothing can access me as well because there is nothing to connect to. There is nothing to respond to queries or connections coming from the internet. All right, so this is the VPC. How about the subnets? I can click on the subnets. Let me also make that a little bit bigger. So I have three subnets as you can see here and they all belong to the same VPC. How do I know? VPC ID is the same and the name that we assigned. And here are the subnets that have been provided. 172.31.0.0/20, 16, 32 and so on. And these are the usable IP addresses in each subnet. You will find that there is a discrepancy. A /20 should give me 4,096 IP addresses. The first one is the network ID we cannot use. The last one is the broadcast ID we cannot use. So that should have left me with 4,094. The other three are reserved by AWS. So the first IP address, not the network ID, the one after that, the first usable IP address and the second and third are reserved by AWS. You cannot use them. So you can start from the fourth if you want. And here it's showing that this is in 1A, 1B and 1C. And here it shows that all of them are allocated to the same route table. And I think this is the important information about the route tables. All right. What about the VPC itself? What's the CIDR block of the VPC? The CIDR block as we mentioned is here and the subnets we have seen are carved from the same CIDR block. What if I move to, let me see, Sydney, Australia. So, as you can see here, if you click Sydney, this is AP Southeast 2. This is the code for it, and this is the name of the region. I have a different VPC ID, a different one, but the same range. And if we scroll to the right, there you have a main route table. It's a different route table ID, and it's the default, and it's in the same account. And if I do a resource map to find out what resources we have in this VPC, let me drag this a little bit up. You have the VPC, the new one, and then I have three subnets connected to one route table and internet gateway. So, as if AWS is creating the same VPC configuration for you everywhere in all the regions, one per region, but if you are not happy with it, go ahead and create whatever you like. So, if you're not happy with this, you can decide, "No, I don't like it. I'm going to use something else. I'm going to create something else." And that's why there is an ability to create a VPC, a custom VPC, basically. All right? So, now let's check the route table. What route tables do we have? So, we have only one route table available. And if I select it, I will know the configuration in that route table. So, here I have two routes. One is saying that the destination here, as you can see, the destination 172.31.0.0/16 local. Local means what? That means the implied router who holds this route table knows about anything within this range. Now, what if I need to get to the internet? Internet is anything else. As we mentioned before, there is no way anyone would set and write the millions and millions of internet IP ranges in a route table. This is the default route, which is saying anything else not belonging to any of the entries that are explicitly configured, please forward it to the IGW, to the internet gateway. And if we click here on the internet gateway, you will see that we have one internet gateway, and it is attached to our VPC. So, it is attached to this VPC. If we go back to the route tables, that is fine. Here is the route table. These are the routes in the route table. Which subnets is this route table applied to? So, we look at the subnet associations, and we find out we have subnets without explicit associations. So, basically, these are using the route table right now. If you want to change association, you can edit, and you can take one subnet and assign it to another route table if you would like to. So, that's how we switch. We're going to see all of that. So, for now, this is the walk-through for the automatic VPCs that have been created. Let's switch back to US East 2 in Ohio. And this is where we are going to create our stuff. So, if I switch to Ohio, I will find that we have the same VPC, but a different ID. And if I click on that and I do route resource map, you are going to find the same thing. I have three subnets Let me move this one a little bit up. Three subnets in 2A, 2B, and 2C, and then they are associated with a route table, and the route table is associated with an IGW. So, it's exactly the same, but the task we have at hand is to create a new one. All right. So, let's now create the VPC that we have discussed before, the one with the four subnets and the details and the route tables given and so on. So, let's go ahead and create that now, and it will be a custom VPC in US East 2, and these are the subnets. Subnet 1 31.0.0, subnet 2 16.0, and then I have 3 32.0, and 4 48.0. And we're going to create route table 1, route table 2, and route table 3 4. And these labels, we're going to use them, and this is going to be in availability zone A, availability zone B, and availability zone C. All right. Let's go ahead and create the VPC, allocate the CIDR block, and then move on to creating the subnets and the route tables and do the association. All right? So, let's go ahead and do this. Here we are in the console, and I have switched the region to United States Ohio. And if you look here, you will find out that this is US East 2. What do we need to do? I need to create a new VPC. And I can do VPC only, or I can have AWS help me create subnets and create route tables and network connections and so on. That is if you need help from AWS. In my case, I want to show you how you can do it from scratch, so I'm going to choose VPC only. And the name was custom_vpc. The CIDR block given was 172.31.0.0/16. And, and believe it or not, by clicking create VPC, you have now successfully created a virtual data center in AWS. And it's isolated by default from anything else. And let's see what else was created. So, when you look, these are the details of your VPC. So, there is a main routing table that ends the ID of which ends with 833. This is created by default for you. There is a network ACL. We're going to talk about this later on when we get to security. And we don't have any subnets, and we have only one route table. If I look at the CIDRs, I have only one CIDR, and it's associated. And that's it. So, if we want to know the details of the route table, let's go and figure it out by clicking on this link, or I can go here, and from route tables, let me just refresh this page to show the new one. This is the new one. So, I'm going to here give it a tag or a name, custom VPC def, for default. All right. So, what do we have inside this route table? I can scroll up, click on routes, and then we have the range that we have allocated. And if I want to edit the routes, I can always click on edit routes, and I can add, but this one, the default one, I cannot remove it. So, if I click for add a route, for example, and I add a route 0.0.0.0, send it to Let's say local for now. It's meaningless. Don't worry about what I'm trying to to do, but here, as you can see, you can remove the customized ones, but you cannot remove this. So, what does this one mean? It means any subnet within the CIDR block of the VPC, current subnet or future subnet, I know how to get to it locally through the implied route. That is what it means, and you cannot edit that. So, let me go back. I don't need to do any changes now. So, these are the routes available. What subnets are associated? I don't have any subnets in the VPC yet. That's why there is no association. So, this route table is not applied to anything, but it has been created. What do we need to do now? We need to start creating the subnets. So, let's go ahead. Here is the subnets that I have. These are the default ones, and how would I know? They all belong to the same VPC that ends with DE2, but if I check my VPC, DE2 is the default, and I can always highlight it as the default, so it becomes easier when I see it in the different screens. And I have the custom VPC, which is mine. So, let's go ahead and create the subnets now. So, I have three, and they're all in the default VPC. These are the automatically created ones. I'm going to click on create subnet, and which VPC? I'm going to create it in the custom VPC. If by mistake you go and create it here, now you are creating a subnet in a completely different data center, which is not the right one. So, you have to be very careful when you have multiple VPCs, which one are you choosing? So, I'm going to choose the custom VPC. And what is the subnet setting? What's the name? So, this is going to be subnet. We can do _1. You can do it _-1, _ space 1, whatever you like. Which availability zone? If you remember, the assignment was subnet 1 in availability zone A, subnet 2 in availability zone B, and subnet 3 and 4 in availability zone C. And the ranges are 31 0 0 for one, for subnet 1, 31 16 0 for subnet 2, and then 48 and 32.0/20 for 3 and 4. So, I'm going to create this one in US East 2A. And the range, the CIDR block for the subnet, and I'm going to have 172. 31.0.0/20 as the subnet, as given. I I don't need to change anything. And I can create a new subnet, another one, subnet 2. So, this is going to be subnet _2. The availability zone is going to be 2B, and the CIDR of block is going to be 172.31.16.0/20. And we have already put the name and then we have three and four. So this is going to be subnet_3. Availability zone is going to be C. And the range is going to be 172. 31. 32.0/20. And last but not least, I need to have the last one which is subnet four. So subnet_4. And this is going to be in C as well. And the range is 172.31. 48.0/20. Let's say you make a mistake. So for example, let me here go back and say 30 only for example. And I try to create, what will happen? Side is not within the side address from VPC. So they are telling you now you are trying to create a subnet that does not belong to the pizza. You cannot have a pepperoni pizza and you try to get a slice that has seafood. It won't happen. So here they are telling you what we are watching you. Now you are trying to configure a subnet in a range that does not belong to you and to this VPC. So please fix it. When I fix it and create subnets, now as you can see it is creating subnet one, subnet two, subnet three, subnet four. This is the beauty of the cloud. From the dashboard, did some clicks and if you are familiar with this, it wouldn't even take 1/10 of the time that is taking me. And if you know infrastructure as code tools like Terraform, you can have a script ready and it will do it everything that we have done in 1 minute. So the point I'm trying to make is the orchestration and management is now doing things, doing stuff in different data centers, in the AWS different availability zones, in an AWS region, in Ohio and I'm sitting in Dubai right now. And this is all happening without me knowing which devices, which equipment that this will be configured on, is it software or is it hardware, what is the switch, what's the router? I have no clue. So this is the management and orchestration that sits on top of the physical infrastructure of the data center and that is what makes a cloud called a cloud. So let's check the subnets and see if we have what we needed. So now let me just minimize this so we have more working space. Okay. So I have subnet one. All right? And subnet one is assigned a range 00/20. Then 16 is subnet two and each one has an ID that was allocated by AWS. I did not intervene in the selection of the ID. And for the availability zone, the first one is in 2A which is subnet one. Subnet two is in 2B as you can see here. Then I have two other subnets in 2C. So looks like I've done it the right way. Three and four. And as you can see here, they are all attached to a route table. But I haven't created any. Remember that there was a default route table. So this is the custom VPC default. This is the route table that has been assigned to all of them. What do we need to do now? I need to create three route tables. RT_1 will be assigned to subnet one. RT_2 will be assigned to subnet two. And then RT_3 and four assigned to subnet three and four. So let's have a look. RT_1 for subnet one, RT_2 for subnet two, RT_3 for four, three and four. So let's go ahead and do this. See, this is going to teach us how we can create different route tables and how we can associate or change association for a subnet that I can have a new route table as opposed to the old one. For now, all of them associate with the same route table which we need to change now. But we need to create the route tables first. So let's click on route tables. And we have the default one. This is the default for the custom VPC. So if you look at the subnets again, subnet two, three and four, they are attached to the route table. So as you can see here, they are all attached to the route table for the custom VPC default. Which is this one. So what is the this route table? This is the one for the default VPC. How can I confirm? So this is the default VPC. If I select it, you'll find that it has a route table that ends with 037. And if I go to these route tables, you'll have that it ends with 037. To avoid confusion, I can say that this is default VPC. So what do I need to do now? I need to create three more route tables as instructed. So create route table. And this will be RT_1. In which VPC? It's very important to pay attention when you are allocating VPCs. You could create a resource in a completely different VPC. Then you go and check in your VPC and you don't find it. This is because you allocated it to a different VPC. So I need to work with the custom VPC. And this is the route table. Okay, create route table. Oh, hold on, hold on. We didn't configure any routes. Let's check what happened. So any route table created by default will have this entry. Anything in this VPC, I know how to get to and this is local to the router. I don't need the help of anyone. So this is RT1. This is the route table that we just created, RT_1. Let me associate it with the right subnet. So I'm going to click on edit subnet associations and I'm going to take subnet one and I will shift it from the main route table and it will go to the RT_1. Save association. Now if I look at subnet associations again, let's see what we are we are going to find. This RT1 has an explicit subnet association now to subnet one. Whereas two and three and four are still having fun with the other route table which is the default route table. So there's there are available subnets without explicit associations. I don't want to associate any other one with RT1. So now we have three route tables and some association is adjusted. Now we need another one. RT_2. Again, it's going to be in the custom VPC. And I'm going to create it. Believe it or not, same entry has been created automatically and you cannot delete it. Subnet association, this one needs to go with subnet two. So now I have save associations. If I look at subnet associations again, you will see that subnet two is associated with the route table that in question right now which is RT2. And then I have only two that are not associated explicit and available if you want to change association. All right. I need a third route table. And this will be called RT_34. And it's going to be in the custom VPC again. Don't make any mistakes. Create the table. As you can see here, the same entry again. Subnet associations, I'm going to edit and I'm going to select subnet three and subnet four to be connected to this table. And when you click it again to verify, you'll find that three and four are associated explicitly and there are no available subnets without explicit association. Basically, it's it's telling me all subnets have been associated with custom route tables and none is with the main route table. So let's check again route table. Let me look at the default in the main. Click on subnet associations and you'll find that zero is associated with this route table. We have taken them with a different route table. So this confirms that you can switch route tables association to a subnet. But at any given time, a subnet can only be associated with one route table. All right? So by doing this, we have created everything that we needed. Let's do one extra step that was not required. Let's create an internet gateway and attach it to the VPC. So internet gateways, I'm going I have one here, but as you can see, this has been attached to the default VPC. I need one for my custom VPC. So I'm going to call it custom VPC _IGW internet gateway. And believe it or not, now you are assigning a router to a VPC by these two clicks. VPC router is available now, the internet gateway is available now and I can attach it to a VPC or I can click on here and select attach to a VPC. Which VPC? I need to attach it to the custom VPC. And I'm going to do a attach internet gateway. So what you have done now is you have created a virtual data center, you have created four subnets, three route tables, associated the route tables with the right subnets, and you have also created an internet router and you attached that, connected that into the VPC. So you have built a full virtual data center right now in AWS. And by the way, this is not chargeable resources. The VPC, the subnets, the route table, the internet gateway, they are all free. Doesn't mean that all the resources in a VPC are free, but these ones are free. So even if now you are going to go have lunch or have a break and do complete later on the work, you are not being charged anything. That is not the case for every single resource. As we go, I'm going to tell you what is chargeable and what is not chargeable. When you finish work with a chargeable resource, either you stop it or you terminate it and you can always recreate it again when you come back and you'd like to work more. So please keep that in mind if you want to avoid surprise charges while working on AWS. All right? Remember that we can switch the region from here. Now all what I have created is a virtual data center with all its requirements so far given to me in Ohio in the US while I'm completely in a different country. in AWS. Let's see how we can apply the concept of public and private subnets in AWS VPCs. Remember we mentioned that a public IP address is something routable or an IP address routable from the internet, reachable from the internet directly without mediators. And private IP addresses are the ones like that we use at our homes and the internet cannot see us from the outside, cannot reach us from the outside. One might ask, okay, so how come I can connect from my home, from my private IP address through Wi-Fi, can get to the internet and internet can get back to me. Remember there was something called network address translation that is done on the Wi-Fi router and we're going to discuss that shortly. So let's go ahead and see how in AWS we can do public subnets reachable from the internet and private subnets that are not directly reachable from the internet. So a subnet in AWS is considered a public subnet if it satisfies two conditions. Condition number one, the subnet is created in a VPC that has an internet gateway attached. So for example, if you have a subnet 172.31.0.0/20, there's nothing when you are subnet drop down menu to select whether it's public or private. How you configure it makes it public or private. So now we have this public subnet. And implied router is there by default in this VPC with this cider block. The first condition, the VPC must have an internet gateway attached and we have seen in the last demo that the internet gateway in a custom VPC is an option. It's not something that is there by default. So that's one condition. What else? The subnet is attached with a route table. That route table must have a default route entry pointing at the IGW. Basically, the route table of the subnet must have this entry. If you have noticed when we did the demo that all the route tables were created with the cider block of the VPC only. None of them had the 0.0.0.0 pointing at the IGW. Let's prove it. Here are the route tables that we created. Let me select any one of them. Let's say route table two. If I click on the route table and look at the routes available, it's only one route pointing at the subnets within the cider block. If I choose any other one of the route tables, let's say RT1. RT1, look at the routes. Same route. So none of them has any reference to the internet gateway, although we have created an attached internet gateway into the VPC. So having an internet gateway is one thing, but telling your router to use it is a different thing. How can you enforce that the router for a specific subnet is going to send traffic to the internet through the default route? So through this entry that we have seen, 0.0.0.0 pointing at the IGW. All right. So can I make subnet one in the VPC that we created a public subnet? Now it satisfies the first one. The VPC has an IGW. Can I make it a public subnet by satisfying the second condition? And the answer is absolutely. If I go here, subnet one is associated with a route table one, as we know. So let me click on this and look at the route table for this subnet. You will see that it's attached to RT_1. So what I'm going to do is I'm going to do I'm going to go under RT_1 and I'm going to click on routes and then edit routes. And I'm going to add a route and in this route, what I will do is I'm going to say anything else not in the route table, please send it to the IGW. So internet gateway. It will ask me which internet gateway and here is the custom VPC internet gateway. So this integration and AWS knowing the orchestration and management layer, knowing what resources are in my VPC and it's a pull down menu and I can select them and that's how easy it is to configure routers to point at internet gateways and attach the internet gateway to the VPC and create subnets and create route tables. So that's the beauty of the cloud. That's why you need to learn the cloud. This is the modern IT. If you are planning for the future, plan it from now. Don't take transitional careers and in three to five years you realize that I wish I have done like my friends did and I got into cloud and automation and machine learning and AI and all that stuff. So you need to see the difference. You need to appreciate how easy this is becoming compared to traditional IT. All right. So let me choose the internet gateway and save changes. So now let's look at the routes and now we have two routes, 0000 default route pointing at the IGW and the entry, the first one. So now we have managed to make subnet one a public subnet. So let me go back here and what I will do just to make my life easier is I'm going to put here an underscore and I can say public. It becomes much easier for me when I'm creating to identify my subnets as opposed to if I don't have any tags. These are called tags, name tags, location tags, building tags, production, development, testing and so on. So now I have done I have managed to create subnet one as a public subnet. All right. So this is clear on the public subnet. How about the private subnet? A private subnet is the one that does not satisfy the two conditions or at least one of them. So this subnet for example, 172.31.16.0/20, it has a routing table like this. Let's say this is RT_2 or even RT_3 4 that we created because all of them they only have this entry. So these are all two, three and four are all now private subnets. Why? Because they don't have this entry. So they satisfy the first condition. They are in a VPC that has an IGW. Okay, fair enough. However, there is no instruction to the implied router to take that traffic from here that needs to get to the internet and deliver it to the internet gateway so it can make it out to the internet. So if you lose one of the two conditions, that subnet is immediately private. Now if you would like to have your website virtual machine, then you have to launch it in a public subnet because that's the only way the internet will know about it and it will reach the internet directly. Whereas if you have some sensitive data like for example, a database, some credit card information, some order information, payment information, patient health records and so on, this is sensitive, should not be exposed to the internet and then hackers are going to try to break into it and steal that critical information. So in that case, you need a private subnet and you can hide it in a private subnet. And as we move on and we learn more about the cloud, you will know that how applications are deployed and we'll talk about that later in the course. All right? Hopefully this one is clear and you do now understand the difference between public IP addresses and public subnets in the cloud and also private subnets in the cloud that are hidden from the internet. All right. Now let's go ahead and talk about network address translation a little bit more. Understand how it works. We have mentioned that earlier, but now it's time to expose it and understand it. So the network address translation is a feature or an IP feature happening on some devices like wireless routers at home or in the offices to mask or hide the fact that the communicating part, the sender is with a private IP address and hide it behind the [clears throat] public IP address. So that's the whole thing. So let's understand this. We have a router performing network address translation. The router connects this local area network, the mini local area network we have on the drawing and connects that to the internet. The local area network has this range, 172.31.1.0/24. .1 is configured on the router LAN interface and the router is connected to the switch. And we have a laptop that has an IP address 172.31.1.118. Both belong to the same network and everything looks good and they are both configured on ports that belong to the default VLAN. So, they can communicate with one another. And this laptop is configured to send anything that is going outside the network to send it through to the default gateway or .1.1. This is all easy. Now, the user of the laptop would like to get to cnn.com. And cnn.com happens to have the IP address on the internet 205.111.37.86. And both are connected to the internet. Connections are live and life is good. The router got an IP address from the service provider, a public IP address on the one side, on the internet side, which is 100.2.55.33. The browser needs to formulate a packet that will go to cnn.com. So, the packet assuming just for analogy that it is an envelope, so the message is or the payload is put inside an envelope and now the browser is going to write, "I am the sender 172.31.1.118, which which is a private IP and this should go to cnn.com, which is 205.111.37.86." And it will send it to the router because this is going outside the network, so this will need to be sent to the router. The router will receive it, will look at the source IP address and finds out that this is going on the internet and the router understands this cannot happen. So, what do we do? NAT will kick in, network address translation, and what the router will do is it will remove the private IP address from the message and it will replace it with its own public IP address. And the destination does not change. Now, the message can be sent through the internet and it will arrive safely at cnn.com. cnn.com will receive the message, read what is required, so that user wanted to go into the financial news page. The response is going to be formulated, put in an envelope, and the sender in this case is going to be the server itself, and the receiver or the recipient is going to be the public IP address of the router. How and why? Because when it received the message, this is what appeared to be the source. So, now it gets to the router. The router has a table of mapping of what has been done. And part of that was that I have taken the 172.31.1.118 and I have swapped it with my 100.2.55.33. So, now when this comes back, it's going to do the reverse process, but it will not remove the source. It will remove the destination, the one that has been before placed as the source, and swap it with the private IP address, and that is how it gets it to the laptop. So, this is how it works and exactly the same happens at home in our wireless routers. So, if you use the same example and assuming the router received this IP address from the service provider, of course it could be a completely different one, but it's a public IP address. We have this range for the network within your home, which is being broadcast by the router on the wireless LAN. The router has the .1.254 on the WLAN, on the wireless LAN side, and this has the .1.120. The exact same thing repeats. The private IP address is the source when a message is being sent from the laptop to the server, gets to the wireless router. The wireless router will stop it, will change this IP address with this IP address and then send it to the recipient on the internet. And the response is the reverse process. In AWS, when you have a virtual machine that has a public IP address, the public IP address is not configured on the instance. It will be configured on the IGW, on the internet gateway. And mapping will happen between the private IP address of the instance and its assigned public IP address. And we are going to see how that happens in the hands-on lab. All right? So, network address translation is extremely crucial to conserve the public IP address space by masking private IP addresses and allowing the use of private IP addresses internally within wireless LANs or local area networks and converting that into public IP addresses when a communication is required with the internet. And it does the reverse process on the response traffic. Hopefully, it is clear. It's very easy and it happens and you are using it at home all the time without you knowing. So, this is how you are seen on the internet as a public IP address. And that is how on the internet when someone attacks a website or a critical system or something, they look at the logs and they find out who was the the source IP address. And then wherever that is, they can find quickly the country, which service provider, and from the service provider logs, they can find out who was using that IP address at the time of the attack, and that's how they can track you down to your home and find you when you have done something wrong on the internet. All right? So, be careful when you use the internet, use it as a good citizen and don't use it as a bad citizen. So, let's now do a hands-on lab in the AWS cloud where we are going to create a virtual machine in a subnet. We want this subnet to become a public subnet. So, we are going to edit the IP route table of that subnet in order to point to the internet gateway. It is already in a VPC that includes an internet gateway as we have seen, the custom VPC that we created. And we will log in to that instance or virtual machine and we are going to access the internet and access it from the internet to prove that a public subnet means something. So, let's go ahead and do this in the AWS console. So, what we are going to do is we are going to adjust subnet one to become a public subnet. And after that, we need to create a virtual machine in the public subnet and the virtual machine must have a public IP address assigned. We need to adjust the security group to allow all traffic. Every virtual machine that is created in AWS is protected by a security group. Think of this right now as a protection around the instance. We're going to explain it later on what a security group is. But for this one, in order to void the security group, we are going to force it to allow all traffic. So, to do no filtering whatsoever because we need to test the public IP and we need to focus on that. Once we connect to the machine, we are going to try from the machine to access something on the internet to find out if this is working or not working. And then we are going to ping from the internet to the instance. So, from my laptop, I'm going to send messages requesting a response from the virtual machine, and I'm going to direct that request to the public IP address of the virtual machine. And we'll see what happens. Of course, after doing this, we can do some additional step where we are going to remove the part that allows subnet one to communicate with the internet from the route table, and we'll try the same test again, and at that time, the communication should stop, which indicates that the public subnet was key to be able to access and communicate with the virtual machine. So, let's go ahead to the console and do this. It's very simple. We're going to take the very first subnet, subnet one. We're going to convert it into a public subnet by adding this entry into RT_1, which is the route table for subnet one. And we are going to continue our testing as mentioned. So, let's go ahead and do this. So, here I am in the VPC in Ohio, the same one that we created before. So, it's the custom VPC. I'm in the VPC dashboard. I'm going to go into subnets. I'm going to pick subnet one. Let's look at the route table of subnet one. It has only the entry that states I can route anywhere within the VPC to any subnet without the aid or help of anyone. So, this is the route table. We're going to go to the route table and we are going to edit routes and we are going to create a new route that would state anything else other than the subnets in the VPC, please send it to the internet gateway. And which internet gateway? The one in the custom VPC. Save changes. So now we we have forced subnet one to be a public subnet. If I go back, let me now label it as such. So I'm going to label this as public. Save. And just to check one last time, here is the entry that made it a public subnet. So what else do I need to do? I need to have a security group that is going to have all traffic allowed in from anywhere. So we can do it separately right now. So under security, I'm still in the VPC dashboard, scrolling down to security, security groups. And I'm going to create a security group. For now, please don't bother what is a security group. We're going to explain that carefully. So this is the outbound rules, and it shows that all the traffic is allowed to anywhere outbound. I'm going to call it testing _security group. And description, testing VM public subnet. So just a reminder, if I look at it later on, I'll find out what this is all about. And we have to make sure it is in the proper VPC. Inbound rules, I'm going to add a rule that would allow all traffic. We said make sure that it's not going to filter anything. So all traffic from anywhere. And in the outbound, all traffic to anywhere. And create security group. So the security group for me is called testing SG. This is the one we are going to use. So what do we need to do now? So we adjusted the public subnet. We adjusted the security group. Now we need to create a virtual machine in the public subnet. So I'm going to click here and then write EC2. EC2 is the service for the virtual machines in AWS. And I'm going to right-click here and open it in a new tab. So I will have the VPC tab and the EC2 is going to be next to it. So instead of jumping on the same page between dashboards, I will have the required dashboards open in separate tabs in front of me. So now we are going to go here, click on instances, launch instance. I'm going to call this testing _public subnets. Of course, you can call it just testing. Call it anything. The name is irrelevant. And I'm going to have it as Amazon Linux 2023. And I'm going to leave it to the size T2 micro. For the key pair login, I'm going to proceed in this case without a key pair. Doesn't matter. Network settings are important. I want to make sure that it's going to be in the custom VPC. And I want to make sure it's going to be in the public subnet. This is very important, assigning a public IP address to the instance. Make sure that this is enabled. And I'm going to select an existing security group. As I mentioned, you cannot create an instance without a security group. So here we are going to choose the testing one that we created. Okay, and that's it. Quick review. It's Linux, T2 micro, and without a key pair, that's fine. Custom VPC, and subnet one public, and has a security group testing that allows everything. Launch the instance. So the instance has been successfully launched. And I can click on connect when it is a blue color. And I'm going to choose EC2 instance connect. Scroll down. Click on connect. I'm now trying to log in to the instance, to open a connection into the instance so I can use it to verify whether it has access to the internet or not. As you can see, we are in the instance right now. The instance has a public IP address and has a private IP address. So let me do sudo su. And from here, I can try to ping an IP address on the internet. Ping is a testing tool that is used for troubleshooting to find out if another host that I know the IP address of is alive or not. So one that we know on the internet is the Google DNS, 8.8.8.8. This is connected to the internet and it does accept ping packets or messages and responds to them. So let's click on ping. And here, as you can see, the response is successful. How do I know? If I do control C, stop it, you'll find that seven were transmitted, seven were received, zero packet loss, and the time. That means the virtual machine on a public subnet can access the internet. All right. Can I access it from the internet? So let's take the public IP address. And I'm going to go into my terminal on my MacBook, on my laptop. In your case, you are going to open Windows command prompt, and you will do exactly the same. Okay, so here we go. I'm going to do ping, and then control V to paste the public IP address. So the 3146178137 is the public IP address I grabbed from here, from the instance. And if I do ping, as you can see also, it is successful, and I'm getting the responses. How can I know? Control C. Six packets were sent, six packets received, zero packet loss. This indicates that by having the instance on a public subnet with a security group that allows communication out and in, we were able to communicate from the virtual machine outbound to the internet, and from the internet inbound to the virtual machine, which confirms that a public subnet is key into this. Now, how else can we confirm? Okay, let's go ahead into the VPC again. And let me go into the route tables. And on route table one, here are the routes. I'm going to remove this one again. So edit, and I'm going to remove this. And I'm going to save it. Now, let's go ahead and try from my laptop if I can get to the instance. So here I am. I'm going to repeat the same command. And now, as you can see, there is timeout, timeout, timeout. Why? It's the same virtual machine. It has a public IP address. And I was able a second ago to ping it from my laptop. What happened now? What happened is the placement of the virtual machine or the instance right now is on a private subnet, not a public subnet. So despite the fact that it has a public IP address, and the public IP address still exists on the instance or the virtual machine, it is unable to get this traffic. And even if it gets it, it will not be able to respond. Because the route table for the subnet subnet one is no longer able to communicate with the IGW. It's not instructed to communicate with IGW. The way it stands right now is this way. All right, let's do one thing. Let's add the entry again. And I'm going to say anything, please send it to the IGW. And before I click on save changes, see, we're still timing out. Let's go ahead and do the save changes. And see what happens now. See, it immediately started working. So this confirms that if you want workload that is accessible from the internet in AWS, it has to be a workload, a virtual machine, an instance that has a public IP address, and it sits on a public subnet, and the security group allows the communication in and out that you need to have with the virtual machine. All right? Hopefully this is clear. It confirms our point, and everything looks fine right now. So let's do one thing extra. Let's see what IP address do we have on the instance. Do we have the public IP address on the instance or not? So let me go back to the virtual machine. And I'm going to do the command IP address, or IPA. Let's see what IP addresses exist on the instance. Let me just make it a little bigger. So this is 1720001. This is a loopback interface troubleshooting testing on the instance. That's is not the communication IP address. Then I have number two, which is ENX0. And if you look here, you will see that we have the inet, the IP address on that interface, 172.31.4.177. Which is exactly this one. So, the private IP address exists on the V neck on the virtual network interface card of the instance and it has a broadcast IP 172.31.15.255. All right. And the mask is /20. All looks good. But, where is the public IP address? Where is this IP address? Why don't I see it here? The reason why you don't see it is because it is configured on the IGW and there is network address translation happening on the IGW whenever this instance needs to get to the internet that will take care or will swap the private IP address with the public IP address. How can we prove this? How can I prove that this is existing? Let's ask the internet. So, on the internet, what we can do So, we did the IP address and we saw that we only see or we only have the private IP address of the virtual machine configured on its V neck. You could have used this one as well as a command. If you are on Windows, all you need to do is IP config only without get interface address and all that. So, open the command prompt and do IP config. If I do curl interfaceconfig.me this command, if I use it now on the virtual machine, it will tell me how does the internet see me from an IP address perspective. So, let's do curl ifconfig.me. So, let's do curl ifconfig.me. So, I'm asking the internet I'm going to send you a packet now. Can you tell me what is the source IP address that you see in that packet? If I hit enter you'll see here the response 3.146.178.137. So, the internet sees me as 3.146.178.137, which is the public IP on the instance and that confirms that there is a device somewhere that is converting the source IP in the packet, which is 172.31.4.177 on the way out, when the packet is going out it's converting that into this IP address and that's how the internet sees me and the proof is this. So, which device is that? That's the internet gateway. This is documented in AWS and we just proved it that we don't have the public IP address anywhere on the instance. So, the IP address command basically lists all the IP addresses that are on the virtual machine and proves that there is no public IP address configured on that virtual machine and we have found that the internet still sees us or sees the virtual machine with a public IP address. So, hopefully this is clear. Now, we confirm that this is happening. You could use the ifconfig or the curl ifconfig.me as well on your Windows laptop, if you have one, direct from your laptop to the internet and see what will be your public IP address, but in your case, that will be the one from your office router or from your home wireless router, how that is changing or doing network address translation to your IP address when you communicate with the internet. All right. Hopefully this was clear. Now, since we are done I'm going to go ahead and terminate the instance. If you wanted to do some more testing, that's fine. At the end, please make it a habit that you terminate the instance or the virtual machine when you don't need it. Don't worry about the route table and VPC and all that. These are free resources, but the virtual machine is not. Hopefully this was easy to understand. Thank you very much. Okay, so let's do a demo and the demo you will do it from your own PC whether you have Linux, Mac or Windows at home and it will show you that the wireless router does actually do nothing between the IP address that you have and how you are seen on the internet and it will be a public IP on the internet. So, you are seen as if you are the IP address of the router. So, what we'll do is in your case, you will be connected to a laptop and the laptop is connected to the internet. So, you will have a private IP from your wireless router. You are connected through the wireless router, not directly to the internet. So, the private IP that you have is most probably is going to be a 192.168 IP address. Most of the routers of the wireless routers do that. And then it has a public IP here and the internet will see you through the public IP on the router. That's what happens. So, to simulate this and since I don't have a Windows machine or Windows PC then I will launch a Windows PC on AWS and I will connect to it and I'm going to use it as if it is my PC at home and I will check and see if there is nothing happening or not. You follow the same steps on your PC and you should see the public IP of your router. So, let's go ahead and do this and I'm going to show you how it happens, how it works. We are going to use the Windows command prompt. I'm going to show you IP config first because that will show you the private IP address that is on the machine itself from AWS. And then we are going to use the curl ifconfig.me and that should also show us how the internet will see us from the outside. So, let's go ahead and do this. So, I am on a Windows machine. What I I will do here is I will write CMD and this is the command prompt I'm talking about. All right. And I'm going to make it a little bigger, so hopefully you will be able to see better than when it is very small. And I'm going to start with IP config. IP config will show you the IP address that is on the machine. So, let's see. So, as you can see I have an IP address. This is Forget about DNS for now. This is the IP address that I have, IPv4 address as you can see and it is 172.31.80.56 and the subnet mask is 255.255.240.0. Can you tell me in a cider fashion what is the size? Is it a /24, /16, /20 or all of the above? So, this is 8 8. 240 is four ones plus 16, so that will become 20. So, this is a /20 subnet. All right. So, this is my private IP. What if I do curl and then ifconfig.me? As you can see here, it's saying that you have you are seen from the internet as 52.87.238.95. All right. So, if I may just move this to the right a little bit and minimize the view minimize it again. You will see here that the 52.87 IP address and this is the private IP address. So, that's the IP address that we have and it shows you that there is NAT happening. Of course, this is on the IGW in AWS, but in your case, it's going to be in your wireless router. In case, if your operating system does not have the curl, if it tells you curl is not recognized, that means you have to install curl or if you are satisfied with what you have done on the in the cloud on the Linux machine and you have seen the curl and you have seen how the NAT happens on the gateway, so that's good to go. Or of course, you can go to your friend, best friend ChatGPT and tell how can I install curl on a Windows 10 or Windows 11 that you have and it will tell you exactly the steps. Once you have the curl command, you can do curl ifconfig.me and it will get you the public IP address. Now, it's time to talk about the network reference models and protocols. If we have multi-vendors, we have, let's say, an access point from HP network from Cisco and we have cables from a Chinese company and maybe we have data center switches, let's say, from Taiwan. When they manufacture these what are the electrical signals or the optical signals on the cables that is acceptable by all parties? What is the shape of the connection that needs to plug into the switch and the size and how many connectors and whether it is copper or it is something else? How should the packet look like exactly in order for that to be understood that this is coming from this place to that place? Where should the IP address for the source be placed? Where should the destination IP address be placed? So, all of these are standards for people who are working on cabling, on switches, on routers, on software, on browsers, on website engines to find out how they should build it in order to be interoperable with the other vendors. And now, any startup, given these standards, can start and work on cables. Maybe they have a better quality cable or maybe they can compete on the price and also for other companies to work on switches and compete with Cisco, HP, Juniper and the like. And also with for routers and also for software and also for security and also for applications and browsers and so on. So the standardization or this standardization requires a reference model and that is what we need to discuss now. So first of all we'll start with proving to you that we require more headers in an IP packet than just the source IP address and the destination IP address. We'll also talk about the open system interconnection or open system interconnect, the OSI reference model, which is the standard model for the networking. That will take us to talk about TCP and UDP protocols and what is a protocol and other known protocols in the networking field. We're going to pick some of the common ones that they will come in handy and you will come across them frequently no matter what career choice you're going to go after when you finish this course. So let's go back and look at the post service analogy that we have talked about before and that will lead us to find out if we need more headers for IP addresses and IP packets or not, more than the source and destination IP address I mean. So if you have John Smith who lives in this unit number in this building in Boston, Massachusetts in the US and this is the building address wants to send regular mail to Sarah, she lives in unit 308 in this building and that's a street address and and so on. So John puts his address and he forgets to put his unit number. And that's a multi-story building, high-rise. Sarah is the recipient but also he doesn't know or he forgot to add he her unit number. Let's assume that he forgot. So the letter gets sent gets shipped through US postal service all the way to Egypt. Egypt post will deliver it to the building but then at the building maybe we have 100, 200 units. We don't really know easily where to send it, which apartment, which unit. And that is why this will be a problem and the mail will not be delivered without the unit number or the apartment address. Of course, there could be a lot of asking around, security guard, watchman and all that until they know where Sarah is but if not then this is going to be shipped back to the recipient as undeliverable. Okay, but if we add the unit numbers then there should be no problem whatsoever. And everything will be cool. The forward mail will go there and the response will be delivered as well. So similarly, we need additional headers in an IP packet to be able to precisely identify on the receiving end, there could be multiple VMs and multiple applications on the server on the receiving server. Now when the packet gets to the server which application or which VM should receive it? So we need additional headers. Also, which application on the source sent the request? Was it Chrome? Was it Safari? Was it Firefox? Was it mail, email? Or was it Zoom? So on your laptop you might be running a lot of applications. When the response comes back which one should receive the response? They are all on the same laptop. The laptop has the same IP but then we need to distinguish between the different units in the building. Your laptop is the building and it has many applications open. So which one should the software send it to? This tells us that we don't have enough information in the IP packet if we only confine it to the source and destination IP. Because of the fact multiple apps can be running or multiple VMs on the server side and multiple apps on your phone or client side. So what is that header that we need? We call it the ports, the IP ports. So let's try to understand the source and destination ports a little bit more. So source and destination ports are required headers in a packet and this is in addition to the source and destination IP address. If we look here and we try to do the analogy of an envelope if this laptop is in Germany and it has an IP address and this is not a private IP address, this is the public IP address opens a browser and now it's trying to send a request or a message or a login or whatever that is, let's say to a bank in the US or a corporate in the US. And this is the server IP address and it is a public IP address as well. So here the information we need at a minimum is who is the source, who is the sender as an IP address and which application port is on this laptop that should receive the response. And where it is going and what is the destination port, which application in case that we have multiple applications running on different virtual machines for example in this server then which one, which application port I should send it to. So when it is received, it will go to the one that is functioning or expecting communication on port 80. What is a port? We'll talk about that. So think about it as a unit and it has a door. So each unit in a building has a door. So this is going to the door or the unit that has port 80 or has unit number 80, apartment 80. So think of ports like units in a condominium building and this is going to be the unit number. That's what the port is but actually it is an application port, a port that the application is listening on to find out if anyone needs to talk to it. Think about it as a local extension in a phone system inside the building. So extension number 80 should receive this message. So it gets here. Now the server knows which one should receive the communication for port 80 and it will send it to it. If this is listening on port let's say 443 and this is listening on port 22. These are all legitimate ports but we're going to talk about them later on. So in that case, this server, the software in this server should be able to tell which one is the port 80 application and send the traffic to it. Now if it is to respond, what will happen? It will be from and in this case it will be the IP address on the server, which is this IP address the port on the server, that's the sender now because now we are talking about the response port 80 on the server and it will be going to 100.2.55.33, which is this IP address and to which port? To the original port that sent it, which was 55,000. So now if I have multiple client softwares running here, the one or the unit number 55,000 is the one that will get it. So the others are not going to get the response by mistake. And this is exactly how when you open your browser and you have 10 tabs open and each one is going to a different website, you will never find that the first tab for example is going to see cnn.com. When the response comes, the page of cnn.com you will never see it on the second or third or fourth tab. You will always get it in the right tab. Even if you are working on a different tab, you will find the data of cnn.com in the same place, in the same tab that you have opened. This is because of the ports. A quick recap. Source IP and destination IP are not enough headers to be sent with the packet. We need source port and destination port as well. All right, so let's talk now about the first model or the main model when it comes to networking, the open system interconnect or interconnection or the OSI reference model. What is that? Oh my goodness. This is not my drawing. This is the source for the drawing. But this is a seven layers model. All right. It looks like a building to me or at least the skeleton of a building. But what is that for? So the OSI model is just a framework, a collection of standards that breaks down how data travels across a network from the user using an application, let's say Chrome for example until it reaches, so if this is on this side, until it gets to the server on the other side. So from the user that from the application, the client application through the network through the LAN and WAN until it gets to the other side and it is received and comprehended by the receiver. That's what the OSI layer defines. So the different layers will define things like what are the standards for cabling. So that would be the first layer. The physical layer will identify that. And what type of cables we can use, and what type of signals, and what is the standards for the optical signals, and what's the standard for the electrical signals, and what's the length of the cable, and how many wires should we use, and what type of wire should we use, what type of connectors we should use. All of that is defined as standards such that if we bring one connector from China and one cable from Brazil, and then we get the copper wires from the US, and we get the crimping tools from Japan, or the tools that we use to make the cable, all of them are going to work without any issues. And when we connect that to hardware switches or routers that are coming from Taiwan, for example, and they're coming from Vietnam, then all of that is going to work without any issues. Why? Because everyone is following the standard, and that is why it ends up working like charm without any issues. All right. For the switches, then the second layer, the data link layer, will specify any required information and standards about the switches, like the protocols, the protocols for the LAN, the protocols for wide area network, the protocols for data center, as far as switching is concerned and NIC cards are concerned. All of that is defined here. So, if you bring in a laptop or a server that has a NIC card, a network interface card, that you bought from China, the server is from Korea, and then you bring in the cable from Taiwan, and you connect all of these, and you connect it to the switch from the US, all of that is going to work without any problems. This is going to be data link layer, as it is called. So, it defines the standards for switching and related. Then we have layer three, and please note that there are seven layers, and that's why when we say layer one, layer two, layer four, layer seven, you know what we are talking about. So, when we say that a device functions at layer seven, then you should understand that it understands all the application headers and stuff that like that. The most important ones that always are relevant are layer three, layer four, and layer seven. You need to know these like the back of your hand. What do they do? What's their function? Layer three is about the network, so it defines the standards for the routers, the interfaces, the routing protocols, the ping ICMP, IPsec. We'll talk about it later on for scrambling the data. IP, OSPF, a lot of things will function at this layer that have to do with routing. Then we get into the fourth one, the transport. So, this is the bus that will take the data from one side and will establish a connection with the other side, and then we'll send the data down to get there. So, that's the transport, the connection between the two sides that needs to be done. And this will define a lot of things that we are going to discuss, TCP, UDP, SSL, TLS. We are going to talk about all of these. Then we have session, which is controlling the communication. You are opening your browser and you're talking to the website or the e-commerce, amazon.com, for example. So, that session between your application and the other side, who's managing that? That will be the session layer. In the two sides, by the way. And then we have the presentation. So, this one defines the session information and how the session should be between the two sides, how to open the sessions, how to close the sessions, what are the messages exchanged for that. This is all at the session layer. And then we have the presentation that decides how the data should look like, and if there is any scrambling for security, which is called encryption, we're going to cover that later on. If it is required, then this layer will take care of that. And then we have the application layer that defines if you are working with DNS, HTTP for browsers, or HTTPS, and all that stuff. All right. Each one of these layers define the standards and how the protocols or the frames or the format of the data should be at every single layer, how to establish a session, how to establish a connection between the two sides, how the network should look like, and how every one of these headers related to these services or functions will be identified in the packet, and it has to be standard across everything, and that is how the end points, they will be able to communicate without any problem. Okay? So, the framework in seven understandable steps, each one doing a specific job, that's for a successful communication from one end device, let's say my laptop, with a server in a data center. The packet, as it starts, it will start at the user. So, the user will open the browser, let's say, for example. It doesn't have to be a browser, it could be a client, Uber, for example, Uber application, or Google Maps, and going to the Google server. So, the user will start whatever he is doing here or she is doing here, and that will be the payload, the data itself. So, the stack of TCP, or the stack of services that have to do with networks inside your laptop or her laptop or his laptop, the [snorts] application layer is going to start getting that data and then deciding on what headers are going to be added and how to facilitate its access to the network. The presentation layer will look, do we need any scrambling? Do we need to add any headers that relates to that? And then the session layer will decide how the session would be and will manage the session. So, these three are going to prepare the data the right way, so it will be sent to the other side. If it needs scrambling, if it doesn't need scrambling, how it should look like, if there are any headers to be added, and so on. Then it gets down to the function that does the transport layer. Everything we are talking about right now is inside the laptop. So, we're not going to go through layers in shelves and all that. It's all inside the laptop, so please use your imagination that there are components in the software and hardware in the laptop that are going to do these functions. Which component? Who cares? You are not the software developer right now. You are just starting. Maybe later on in the future you will understand this very well, and you will start developing to these different functions. But for now, these functions exist in every one of our devices, even your your phone, iPhone or Android, it does have all of that. This is the IP stack or the TCP/IP stack inside your laptop or phone or iPad that will be doing this. Okay. Now, the transport layer needs to add headers. Why? Because it is the transport from here to there, to the other side. Is it directly? No, but it has to add headers so the other side will understand. Do we need to open a connection or not? Do we need to follow the sequence of each packet? So, if one is missed, then I need to tell you. Do we need to have flow control? So, if you're sending too much, I need to slow you down. Do we need to have extra communication, basically, to ensure that there is nothing missed, nothing is received in error or out of sequence, and if anything is missed, then we can talk and you can resend it again? If we need to do that, or just I will send you whatever I will send, receive it, and if we miss anything, who cares? And both of these are valid options when it gets to a transport layer. So, the transport, it's going to add its own headers, the bits and pieces, and will deliver it. Okay, now it's time to ship it through the network. So, what do we need to do? We need to give it to the layer that understands routing and understands IP addresses and understands BGP, for example, if that's required, and other stuff. So, network address translation also happens at this layer. Do we need to add headers? Of course. That header exists, and here's our original data, and now an IP header is added. Source, destination IP addresses are added, and if anything else is needed. At the transport, this is the source port and destination port will be there as well. Goes through the switch. For the switch to deliver to the different ones in the same local area network, then probably headers are going to be added. Also, these are called data link or link layer or link two headers. Once this is done, it is ready now to go out on the NIC card to the network, to the local area network, and then possibly to the another router or something. So, it will filter down to now, if you are holding your iPhone connected through Wi-Fi, then this has to be converted into frequencies in the wireless LAN. If this was a wired copper port into a switch, then it will be converted into electrical signals to be sent through the copper wire. If it was optical cable, fiber optic cable, then it will be converted into light signals to be sent. Who is going to do that? That is the physical layer. So, this path from the source, from the application until it gets to the physical layer, is called encapsulation. Why is that? Because we have the data, and imagine how many times we have added things around it as if it is a capsule at the end. We are encapsulating the data. We are including the data but adding a lot of headers around it. Now it gets as a series of binary zeros and ones either presented as electrical signals or light signals or however it gets to the other side. The physical layer here it needs to do the reverse process de-encapsulation. So the physical layer here is going to translate that into what is acceptable for the data link layer. So the data link layer will be able to read any information required for the data link and comprehend it and find out if it is for me or for someone else then it's going to remove layer two headers and it's going to pass it on to the network layer. The network layer would look at the source and destination IP where this is going. If it is to me I will process it else if I'm a router then I'm going to send it. If it is a router it will end at this layer and it will not have a lot of information above. Now if this was the server as we are showing here then it will pass it on to the transport layer to understand okay was that supposed to be a connection oriented communication or connectionless? Do we need to look at the sequencing and all that or not? Do we need to do retransmission or not if something is missing? And it understands the protocol or the port it's going to is it going to HTTP 80 for example or port 80? If it is going to port 80 then it will remove each one after it does the processing it will remove the header and will leave the up the headers for the layers above. If this was a router then the router will pass it on. So it will process the network layer will look at any filtering required and then it will pass it on to the next router or the or to the server at the end but this is not our case. We're using a simple case that they are both close to each other. There are no no hops or no devices in between. So now it goes up session layer reads the information presentation layer and then it goes to the application layer. Now the application here will understand it and then the application will become when it for the response it will become the sender and here will be the receiver. So as if we are going to reverse the functions encapsulation for the response and then de-encapsulation at the laptop level for the response. So that's exactly how it happens. If we didn't have all the standards and we did modularize the different functionalities the TCP/IP stack inside any device would have been a nightmare. But now since we have broken these into functions and standards and all that it's easy for a company for example to specialize in only doing the scrambling function of data or only a deployment of a new protocol at the transport layer for example or a a new function at the transport layer. So they can focus or zoom into a specific functionality and develop for that functionality only. So the source software will takes the data from the application flows down through the different layers to the physical layer. This is called encapsulation and then at the receiving end we do the opposite which is called de-encapsulation. From the physical up is de-encapsulation from the application down is encapsulation. Here's an example. Let's say a user is going to open a browser and needs to get to a webpage on the server. So what happens? So the browser will send the HTTP request that is a layer seven activity which is done by the application layer. An HTTP and we're going to talk about this this is a standard protocol that is defined at layer seven will create the request like for example get for me a get request to read the HTML file of the website. So the webpage of the website simply. But this is still layer seven and this is all happening now at whatever the the browser functionality that will take care of of that inside the sender or the client. Now the HTTP data is handed to the to TCP at layer four which is the transport layer. Which adds a TCP header that includes so this is the data after the browser has prepared it with session and presentation. Now it gets to transport transport will add a TCP header. What is TCP? We'll talk about that. It will talk about what is the source port. A random port. We'll talk about these ports later on. Destination port is going to be to be port 80 for HTTP. So now the transport is saying who is the source port source application client application and what is the destination port on the server on the other side? This is where the port number appears and then it goes down to layer three IP to add the source IP and destination IP layer two and then out to the network. So hopefully this makes it clear in addition to the previous slide. What are the benefits of doing that? Standardization and interoperability. And that allows all software and hardware vendors to make products that are interoperable. It's a layered troubleshooting. When you have a problem that has to do with a network go and look at the network. When you have a problem that has to do with ports not allowed allowed traffic is blocked then we go and look at the transport or configurations that have to do with the transport. So we can focus on specific layers while fixing problems as opposed to if it was all one big function then which part should we look into? It's an easier implementation of networking because it's easier to break down understand and work with networking components different components. Modularity is very important as well. So it allows smaller companies or some companies to specialize in optimizing some of the functionalities or modules within the seven layers. Let's now zoom into some of the important layers and we'll focus on layer seven four and three because these ones are very critical and you will deal with them a lot in your career regardless what that is and especially if you are into cloud engineering network security or network engineering. The OSI model layers we have the application which will prepare the data as we mentioned. We have the presentation that will format and scramble or encrypt the data if required. We have the session that will start and stop the sessions to the receivers. We have the transport that will ensure the message will get to the receiver fully and in sequence if required. We have the network that will find the best path the IP routing through the network. We have the data link layer that will add the delivery details at the switch level or the LAN level if you will. Physical layer that will identify standards for the cables and if it is Wi-Fi or signals that will carry the data. So this is an abbreviated definition of the function of each one of the layers. Let's zoom into layer seven the application layer. So the application layer is the closest to the end user. Of course because we said it will be built into the browser for example. So this is where the client sits and that's the browser in front of him or her and they start working on it. So this is where the users will interact with the applications and this will provide the application layer is not the application itself. It's a functionality within the browser that will take the data that you want. You want to go to cnn.com. So it will take that and it will translate it into how should the data look like when I want to go to cnn.com? So it will provide network services to the applications like browsers or email clients and file transfer. And it's not the application itself but provides the services to allow the application to use the network or to work over the network. And it will handle the requests and the response operations between the sender and receiver or the user and the other side by handling the lower layers. So between the user applications and the lower layers that are available at the user side so it can get to the other side correctly. So think of the layer seven as the layer that will let the applications like Chrome or Outlook use the network through the laptop or the iPhone or the Android phone through the network until it gets to the right place. That's layer seven. Any device that has the intelligence of understanding what's happening in layer seven is usually an expensive device and it's an advanced device. Next one we're going to discuss transport layer layer number four. This layer creates the end-to-end transport between the two communicating hosts between the sender and receiver. The ports are added and interpreted or read here. So when one says I'm from port 55,000 as a source the port will be added at the transport layer. And also where it is going it's going to cnn.com on port 80. Then the destination port is going to be also identified here and then added in the TCP header. Then we have the third layer that we need to zoom into, which is the network layer. And as you understand, it's the IP layer. Basically, this is the main protocol that operates here. And it will move the data between the two hosts that are not physically connected. So, it will do the routing decisions, what to do, is it in the same network or in a different network, do I need to send it to the router or it will be reachable through the switch? All of that intelligence happens at this layer. And it uses the logical IP addressing. So, the source and destination IP addresses are going to be added here. And we have the source port and destination port from the transport layer. Examples of what functions here also is IPsec, network address translation, and dynamic routing protocols. Hopefully, that was easy to understand. The OSI layer is very, very important. And if you don't get your head around it for whatever reason, know what layer three, layer four, and layer seven are for because these ones are going to come and as bumps in your way if you don't understand them very frequently. So, the OSI model that we have discussed, how is that related to the TCP/IP model? There is a model called TCP/IP. What is the relation of the OSI model also to the network devices? So, for networking devices, where do they function at the OSI layer? So, routers will operate at the network layer. And switches will operate at the data link layer, which is layer two. And we'll see later on when we talk about firewalls, they could be functioning here or they could be functioning here as well. We'll talk about that later on. The TCP/IP model is also built for the same purpose. But the TCP/IP model combines these three layers into one layer called the application layer. And then we have the transport, we have the network, and the physical and data link layer are called the network access layer. So, here we have four layers, here we have seven layers. Now, let's start with TCP/IP protocols. Let's understand what is a protocol and why is that important and some common protocols that we are going to come across frequently in your career, whether it is network or anything else. So, first of all, what is a protocol? A protocol is a standard set of rules. So, there are a number of documented rules agreed upon. For what? In networking, for formatting and processing data that computing devices need to know how to send messages. So, this set of rules or protocols agreed upon in a protocol that is known and standardized across the globe will allow the computing devices understand how they should send messages. So, how to create them, which headers, what is the length of each header, which one to put before the others, which one to put after the payload, which one to use before the payload. This is the set of protocols such that developers who are creating applications that will use these protocols or need to communicate with others. For example, if someone is developing a new browser. So, let's say Chrome, Safari, and Firefox, there is one that is coming up and it's much better than them. However, that browser needs to communicate with existing websites. The existing websites are using a protocol called X. That browser needs to understand the details of the X protocol and then develop according to that such that the browser will format or create the proper format of messages. And when it receives messages as well, it will be able to understand them. And if anything goes wrong or something sent was not as per the protocol, then there should be some errors exhibited. And that should be all agreed upon. So, for example, with websites, whether you know it or not, we all use HTTP and HTTPS, the hypertext transfer protocol. So, that is a standard, even if you bring an application from Taiwan, from China, developed in Vietnam, and then you use it with websites in the US, in Germany, or in India, it will work. Because they are following a standard formatting of the protocol. When would the problems arise? When the format is not per the standard. Network protocols are used as a common language to enable network hosts to communicate. So, the only reason we create protocols is interoperability and for the successful connection and communication between computing devices and the softwares on them or the servers and the softwares on them. Just to give you an example, for the application layer, there are certain protocols that are widely recognized like HTTP, HTTPS, DNS, SMTP for email, FTP for file transfer, NFS for file system, SSH for connectivity. At the presentation layer, we have the ones that deal with scrambling the data or encryption, TLS and uh SSL. TLS is the newer version of SSL or the successor of SSL. Then, if we look at the transport layer, we'll find that we have TCP, UDP, and some functionality of the encryption or scrambling also happens here. Some documentation will tell you that encryption happens here, some documentation will tell you that it happens here. Anyways, the recognition of the ports must happen at the transport layer. At the network layer, we have IP, Internet Protocol, ICMP, the Internet Control Message Protocol, Network Address Translation, Address Resolution Protocol, IP Security. These happen at the network layer. So, these are examples. TLS and SSL, that's why we have the star here that it has functionalities across layer four and layer six, the transport and the presentation. So, we mentioned TCP and UDP at the transport layer. So, what is that? TCP is Transmission Control Protocol and that is the TCP in the TCP/IP keyword. Transmission Control Protocol is a protocol used at the transport layer, layer four. The number of protocol is protocol number six. Used at layer four means it has to do with establishing the connection if required between the two parties, between the two communicating parties. So, a connection is established in TCP. The two parties must establish a connection between the client and the server before data is exchanged. And if this fails, data will not be exchanged. So, if we think that the client is a laptop and the server is a virtual machine or a physical server with an application, then they have to send a SYN. This is part of the TCP handshake. The client will send a SYN message, synchronize message. The server, because it understands TCP and it knows the protocol, it will understand that this format is for a synchronization message. Someone is trying to establish a connection with me. So, after that, they will exchange data with me. So, it will send a SYN ACK, acknowledging the SYN. So, this is again a message that is well known in the protocol TCP indicating that, "Okay, fine. I have seen your SYN and I am ready now to start the connection." Then, the client is going to send an acknowledgement saying, "Thumbs up. Let's go ahead and start to communicate." In this connectivity on this connection, now they will maintain the sequencing. So, the sequencing of message, ensuring that messages are delivered in sequence. If one is received out of sequence, then the server will send an and say, "You didn't send me this message. Please retransmit that message because I didn't get it." They will make sure that the messages are received without errors and with acknowledgements of the receipt and retransmission if there are any missed or unreliable or erroneous packets. Basically, this kind of communication ensures that 100% of the data is delivered, nothing is missed, and nothing is erroneous. That is what TCP is all about. Of course, this is reliable, but it can be slow because you are retransmitting and you are sending a lot of acknowledgements and and SYN and SYN ACK, establishing connections first. So, if the connection is for whatever reason not established, no communication will happen, and so on. TCP would use it when you are dealing with critical applications and critical data that you don't want anything to miss. Examples, websites, email. You don't want to send an email and then half of it will be missed in between. And file downloads. You want to make sure that your downloads are complete without missing anything, without any corrupted data. Previous one is reliable but slow. What if we are dealing with voice? Voice calls over the network. We're dealing with video streaming. What if we are dealing with games that has a lot of graphics and and is sensitive to latency? Then in that case, you can use UDP, User Datagram Protocol. So, these are the two major types of connectivity at the transport layer, either TCP or UDP. So, again, it's used at layer four, but this is protocol number 17. The previous one was number six. TCP was number six. It does not establish a connection. It doesn't use sequencing, error control, flow control, or acknowledgements. So, just send and best effort. If I receive it, good. If I don't receive it, who cares? And one might say, "Okay, but you might lose data here as well." But, think about it. Think about voice calls. So, I'm talking to you over the phone and that is voice over IP. We're using an application over the internet, Skype or Zoom or something. And let's say we're doing audio only. Now, if I was speaking and you were following and then some voice got or was broken or some words were scrambled, you didn't understand me, or maybe some noise got in between. What would you say? The two parties the receiving end, which is you, you would say, "Your voice is breaking up. Can you please repeat? I didn't get the last sentence, right?" So, the applications or the users are going to correct or request the retransmission, not the application itself. Same thing for video. If we're doing video conferencing and then the video gets distorted somehow, you would tell me, "Can we close the connection and and start again?" And then when we start, everything looks fine. So, the two ends can fix problems if they happen. They can realize problems and fix them. For games, it will show in the games as well. So, user datagram protocol is important when we don't really care about missing some data because the two parties communicating can fix or detect that, but we need the speed. So, this is just sending a request, the server will respond. There is no SYN or SYN-ACK or acknowledgement. There is no establishing a connection beforehand. So, it's faster, but not reliable compared to TCP and use cases include online games, voice calls, video calls, and live video streaming. All right. So, to recap quickly, a protocol is a standard set of formats, of message details, and error messages that are used for the successful communication between different parties regardless or irrespective of who is the developer of the application or the software for as long as they follow the definitions and the rules in the protocol. All right? Now, let's go ahead and look at some common TCP/IP protocols that you will come across. So, I'll give you some examples of what you might face and you will face in your engineering roles. So, the first one is Internet Control Message Protocol or ICMP. Simply, the ICMP is a protocol that will be used by one party or one device to send a message, we call it ping, and wait for a response to find out if the server has received it and is alive or not. So, when I do ping 8.8.8.8 on my laptop, whether it is in command prompt in Windows or on Mac or on Linux, for an IP address, and the IP address can receive the this message. If the server is alive, it will respond and tell me that, "Yes, I'm alive." This is called an echo request and the response is called an echo reply. And here's a snapshot. We have seen it before. If I do ping 8.8.8.8, this is done from my MacBook, then I'm pinging this IP address. So, 8.8.8.8 is the domain name system or service for Google. So, one server in Google that is alive and accepts pings and responds to them. And this indicates a successful receipt of responses and this is the time it took from when I sent it until I received it in milliseconds. And if I stop it, here it tells me statistics. Five packets were sent, five packets were received, 0% packet loss. It functions at layer three, very useful in troubleshooting. However, some people misuse this to find out if they are scanning a network to hack it, they will scan the IP addresses by sending random ping messages to find out if servers are alive and then they will start to orchestrate attacks on these IP addresses. That's why some networks, they will block ping and they don't allow it. So, in that case, if you don't receive response, it's not 100% the server is not alive. It could be that the security in the network is blocking ping from reaching the server and that's why it's not responding. So, here if I had anything at Google to stop ping and say no to ping, don't allow ping, the server will never receive the message, that's why it will never respond. So, receiving a response 100% means the server is alive. Not receiving a response, if you know if you know for sure that the server should receive it if it is alive, there is no security to stop that, then that indicates the server is not alive. But, if you don't know, you're trying to ping, you are a a hacker and you're trying to orchestrate an attack on a specific IP address, you would like to know if it is alive or not. In that case, if that server stops or is not allowed to receive a ping, that is not an indication that the server is down or not alive, you should try some other way to find out. Of course, I'm not trying to enable you to to hack servers on the internet, I'm just telling you when you are doing legitimate work on the internet or in your network, how to use the ping, and you need to be aware whether the other side accepts pings or not. Now, let's look at another one, common TCP/IP protocols. We'll look at the secure shell or SSH. This is a secure way for you to log in to remote devices. When you log in to that remote device, you are going to log in as if you were physically on the device and then you can start to type commands, troubleshooting, or set up applications, or whatever you want to do. So, how does it look like? How does it work? We have a server or a device that accepts SSH connections. So, it is a secure shell server. It can accept clients to connect to it securely. That's the whole reason. And then you need an SSH client on your side. So, the the client must have an SSH client. The server must have an SSH server. Any Windows 10 and above has SSH client and has SSH server available. And if they are not activated, you can activate them. It's called OpenSSH. All right. So, what happens in the handshake? SSH is connection-oriented protocol. So, it runs on TCP. So, there has to be a connection and SYN, SYN-ACK, acknowledgement happening between the two sides. So, the client will initiate the connection to the server. The server will send a key that the client can use to scramble the data and start to send the data. So, they will negotiate the connection parameters and then the client can use that key in order to communicate with the server. That key is used to scramble the data. We're going to discuss scrambling the data in the next module. All right. So, whoever if if there is any man in the middle that tries to copy that data, they should not understand it because they don't have that key. They don't have the key phrase that scrambles the data. So, the data will be garbled, will be scrambled, they will not be able to know what it means. And that's the whole point. So, SSH, it's a secure way to remotely access and control another computer over a network. It could be over the internet and it could be over a local area network or a private network, local area and wide area and so on. Data transfer between the two ends is secure, encrypted, scrambled. So, nobody can see the data transferred over the connection and SSH operates at the application layer, layer seven, and uses what I meant by uses TCP, it uses port 22 at the transport layer. Why is it at the application layer? Because the presentation, as we mentioned before, is responsible for the encryption and that's why they say it's at layer seven. However, the actual port used is TCP 22. It runs over port TCP 22 at layer four. All right? And SSH is especially useful for managing and administering servers. Example use cases, you would like to log in to a remote Linux system to manage it and run commands. That's a solid example. Let's go ahead and do a demo and show how this works. So, let's go ahead now and do a demo. What we'll establish is we'll have an AWS Linux EC2 instance and we'll try to SSH into it from a Mac or Linux client. What am I going to try and do? How does SSH work in AWS? So, we'll have a virtual machine, Linux virtual machine in AWS, an EC2 instance. And by default, it has an SSH servers and it works the following way. When you try to connect to the When you I'm sorry. a look here. When you try to create the instance, there is an option to create a key pair, an SSH key pair. A key pair means we have a public key that will stay in the instance in the AWS side, and we have a private key that you will download it, and you don't have a choice. As soon as you create the pair, it will be downloaded to your laptop. We will see it in the demo. So, the SSH key pair that we are going to create is how the negotiation happens for security between the two parties, and the key will be used to scramble the data on this side. And the public key will be used to decipher or unscramble or restore the original message on the EC2 instance side. What if you try to connect via SSH and you don't have the right private key? The connection will be refused. So, that's exactly how it works, and that's what how we'll do it now. Please remember that the public key remains in AWS, and a private key that will get downloaded to your computer. And the key pair is used for authenticating the SSH connection to the EC2 instance. SSH server is like a security guard at the entrance of an important place. The client is trying to connect to the instance, get into the instance, right? So, the security guard, the SSH server, will say, "Can you present your ID, please?" And the ID in this case, the analogy, is the private key that will be presented with the connection request. The server will look at the ID, and then look at the list of people who are allowed. If the matching public key, remember we said we create a key pair, so they are a matching public private key. If it finds a matching public key, it will allow you inside and say, "Welcome to the instance. You can now log into the instance." And afterwards, the same will be used for the encryption, as we mentioned. So, let's go ahead and do that in the AWS console. All right, so here is my console. What we'll do now is we are going to create a virtual machine in AWS, in our custom VPC, and we are going to create a key pair and download it. The instance must be accessible from the internet, so we will launch it in public subnet one that we have created before, and we'll download that key pair. Then, the instructions will be available in the console on how we can connect to it using SSH. All right, so let's call this testing two. You can call it whatever you want. The name here doesn't matter, actually. I'm going to go with AWS Linux as well, so Amazon Linux. And I'm going to use the free tier T2 micro, because I don't want to pay any money. Key pair for login. We can use a key pair to securely connect to your instance. Then, absolutely, I would like to create one. I don't have any created, and I'm still in United States, Ohio. Please pay attention to where you are exactly, and I'm going to create a new key pair. I'm going to give it a name, testing two. You can call it SSH test, SSH lab, SSH demo, whatever you like. Or let's let's do it a meaningful name, SSH demo. I like that one more. And I will leave everything else to the default. It's {dot} pem. It has to be {dot} pem, and I'll leave it to RSA, and then click on create key pair. Notice what will happen now. See, a download has happened, SSH demo {dot} pem. So, I have that right now on my computer. And if I click on where it ended, right, as you can see, that this is the file, SSH {dot} pem, and it's asking me for key access. So, you can find information about it, and it here it shows that this is a certificate standard. Please make a note. This is extremely important. Now, I know that it has been in my downloads folder. In your laptop, you need to find out. When you clicked on the file, it will show you where exactly in your laptop it is. This is very important to know. Is it in the downloads folder? Is it in a user folder? Is it in a temp folder? You need to find out where that file is, because you are going to use it. We are going to go into that folder, and then try to connect. Or at least we need to know the path, how to get to it. So, let me now continue this, and then we'll come back to the key. So, I'm going to click on edit, because I want to make sure that it's going to be in the custom VPC, and I would like to make sure that it will receive enable a public IP address. And for the security group, I'm going to use the one that we created that is wide open for now, testing one VPC, because I don't want it to filter or block any traffic. And that should be it for now. So, let's me just quickly look at this again. So, we have an Amazon Linux, we have a T2 micro free tier. The key pair login, we have already downloaded that. Remember that this is a key pair. So, the one I have on my machine is the private key. The one that will be in AWS on the instance or related to the instance is the public one. In any other documentation, they will tell you the other way around, that the public key will be with the client, and the private key will be with the server. Understand the concept, and don't stick into the documentation differences, but AWS, for sure, keeps the public, and gives you the private. All right, and it is in the right VPC, and it is on on the wrong subnet, actually. It's good that we have reviewed it, and I need it in the public subnet. If I put it in subnet two or three or four, these are private, so it will not work. And we have a public IP address. So, now I'm good to go. Let me go ahead and launch the instance. Please always do a revision before you create, because I overlooked the subnet. Although I went into the network, but while chatting with you, I did not notice that I had it on the wrong subnet. So, this is very important to do. So, the instance is created, and here's the ID. I click on the ID. And now I have the instance. Of course, this could be because the distance that I have between UAE and United States. Okay, so I need to connect to the instance. We have done before the connect using EC2 connect, which is just go down and click connect. This is not what we want to try now. I want to try the SSH client. I want to use it not from the portal. I want to connect from my laptop into the instance through SSH and through the internet. So, here you will find the details. So, let's find what is required to connect. Open an SSH client. I have it. In Mac, it is on the terminal or in the terminal program. I can access that, and it's enabled by default. Locate your private key. Find out the key that was downloaded. Where is it exactly? The key is going to be used to launch this instance is SSH demo {dot} pem. So, even if you forgot the name, here you have the name of the key for this instance. The key usually has public permissions, so anyone can use it. This is not acceptable. When you want to do SSH, it has to be private and not publicly viewable. So, you need to use this command on the file. Where do you apply this command? You have to head inside the folder where the file is. That's one way to do it, or the easier way to do it, and then you type this command. Then you can connect to it using this this command. SSH minus I, I want to SSH into the instance using this key, and consider that I am the user EC2 hyphen user. So, EC2 hyphen user, that's me. I would like to connect to you, the server, using this key, and the connection will be SSH. So, now this is going to format a packet, an IP packet from my browser, that will be having a destination of 18.191.168.182. The source IP address is going to be my laptop IP address, which is a private IP, because I'm using it in a Wi-Fi network. When it gets to the router at my location, the router will do NAT, will translate that. What will be the port, the source port on my side? It will be a random port created from a range of available ports. What will be the port for the destination? It's going to be TCP port 22. This is added at the transport layer. Then the network layer will add the IP addresses, the source and destination, and now the packet is ready, and it's going to carry the key information along with it. This is how it will work. So, let me go in terminal, and first of all, let's try and see how the key looks like. What What does this key look like? I know that it has gone into downloads, and if you notice here, I am into a folder called ITF under downloads. So, what I will do is I will do CD {dot} {dot}, CD space {dot} {dot}. It will take me one step up. So, now if I do LS SSH demo {dot} pem, I have the file. So, let's open the file and find out what it includes. Nano ssh demo.pem. These are Linux or Mac OS commands. These are not Windows commands. I'm going to show you how to do it on Windows. And here is how the file looks like. So, begin RSA private key. So, this confirms it's the private key. And then as you can see here, this is the key. So, very hard. It's not like a password. SSH can work with passwords as well, but that is disabled by default on EC2 instances. You can enable it if you want. But this is way more secure. This is a key, so that's a long string and very hard to predict or to find out what it is. And the public key on the other side is going to be as complicated. And since they were generated using the same generator, there is a way to check if these two form a pair or not. So, that's how it looks like. All right, I'm going to exit. So, I'm going to do control X. And now what I need to do, I need to change the permissions on the file. So, I'm going to take this command, copy. I'm going to go back into terminal and I'm going to do this. CHMOD, change mode 400 ssh demo.pem. This will make the file a private file, not a public file. So, let me before doing this, let's try to connect and find out what happens. So, I'm going to jump to the last step, copy this, and try to connect and see what happens. So, here it's telling me the authenticity of this host cannot be established. I don't know if this is a secure host or not. However, are you sure you want to continue? And I will say yes. So, it's giving me yes, no, fingerprint. So, I'm trying to connect now. See what happened? Bad permissions on the file. Why? The permission is denied because it's a public key. You have to change the permissions beforehand. It has to be secure and this is unprotected private key file. So, SSH is smart. Even it checks whether the key access is open or closed. So, what I will do now is I'm going to copy not this one, this one again, to lock down the permissions. I'm going to use it. And then I'm going to repeat. Let me clear. I'm going to repeat the same SSH command. Press on the arrow keys up and down. It has the history and it repeats the commands. So, now I'm going to click. And see what happened now? I am logged into an Amazon Linux 2023. And here it shows me that I am the EC2 hyphen user, which was what I requested here. But here it's not showing me that public IP address. It's showing me a private IP address. Remember, network address translation happens, right? What I need to check to verify whether this is the right one or not, I will just go here. I'll go back to the instance page and I will check what is the private IP. Here is the private IP, 172.31.2.144. So, that's exactly where I am. We can do sudo su, super user. And I will start doing ping 8.8.8.8. Can I get to the internet? As you can see, I can get to the internet from the device without any issues. And if I do control C to stop it, and then I'm going to copy the public IP address, which is this right here. So, now I am in the instance and I can ping to the outside, to the to Google site. If I do exit, So, now I have closed the SSH connection and I'm back on my laptop. Now, can I ping the instance? Yes, I can. So, now the instance is available on the internet and I was able to connect to it, to SSH into it. What if I need to SSH again into the instance? Just use the history commands and you can click enter again and you will be connected again into the instance. So, that's how easy it works. But now I have a secure connection. I am in Dubai in UAE and the server is in Ohio in the US and all this connectivity or the communication between me and the server is protected by the private and public key pair. All the information is scrambled. It's encrypted and nobody can look at it or understand it. They can copy it maybe, but they will not be able to understand it unless they have my private key or the public key on the other side. All right, hopefully this is clear and this is for Linux and Mac. We will look at how we can do this on Windows. And it's exactly similar process. All right, so since we are done with the test, if you are not going to continue working right now, please go ahead and stop your instance and you can bring it up later on. All right? Let's now use a Windows client. So, my machine is going to be a Windows machine and we're going to SSH into a Linux EC2 instance in AWS. So, we're going to repeat the same steps we did before to create an EC2 instance, a Linux one, but we are SSHing from a Windows machine. This is going to be a Windows client. That's the only difference. So, let's go ahead and do it. All right. So, here is my Windows machine as you can see at the bottom and I'm connected to my AWS account and I'm going to go ahead and create the Linux machine. So, let me put this one little bigger. Okay. Hopefully this is better visible for you. The response will be a little bit slow because I'm using a Windows machine on the cloud. So, this Windows client is in AWS actually. But it works exactly the same if you were using Windows on your machine. So, launch instance. Oh, but let No, let's do it in Ohio. So, to take advantage of the previous settings we have done. All right. So, I am now in Ohio. So, what I will do is I'll I will call this win testing. And I'm going to still choose an Amazon Linux and it's free tier as you mentioned before. And I will use T2 micro as well because it is free. Okay, and for the key pair, I'm going to also create and download a key pair. So, I'm going to create a new one. And this I'm going to call it win win file or win key. And I'm going to leave it to .pem, everything as is, and I'm going to do create key pair. It's funny when I increase the size how slow this becomes. Okay. Okay, I want to show you this. So, see on the right-hand side. I apologize if the size is not appropriate. Let me try to do it from the browser, maybe it works better. All right, hopefully you can see it now. So, it has downloaded a file on my laptop and that is the .pem file, the win key file. And we are going to continue our settings. So, I'm going to choose T2 micro and that will be free tier eligible as I mentioned. The key pair is win-key. We are going to locate the file where it is exactly. And for the VPC, as you know, we are going to click on edit. I'm going to choose the VPC custom. And for the subnet, I'm going to choose the subnet one public. To make sure that it will receive an IP address. This is very important. Auto assign IP address must be enabled, not disabled. And select an existing group security group, which is the testing group. So, this one. All right, just to make sure custom VPC and we have uh subnet public subnet one. And everything looks good to me. So, let's just make sure that we have everything. It's a Linux and we have the key and it's T2 micro, right VPC and right everything. It's always good to check rather than finding out after troubleshooting a lot that you did something wrong and you'll have to redo it again. So, this will be our Linux instance in the cloud that we need to connect to, right? So, we need to get some information from the Linux in order to be able to work on it. Which is the connection and what's the key and all that. So, I'm going to click on connect. See here, we have a private IP address. And we also have a public IP address to the instance, 18.191.252.228. So, let me click on connect. And I'm going to use SSH client. And that will give me the steps that I need. So, CHMOD 400 does not work on uh CMD in the command prompt in um Windows. So, what we will do is this is this would be the one that we are going to use SSH minus I win and easy to use and so on. So let me go back now to the desktop. I'm going to minimize Edge the browser. So let me minimize this. Okay, and I need to go back to my Windows desktop. Which is this guy right here. Okay, so this is my Windows desktop. Let me just resize it so you can better see what I'm working on. If I can really create this that will be perfect. I don't want to see it in front of my face all the time. Okay, so what we need to look for is where did the file go? So I can look in the file system. I click on and hopefully in downloads. And let me look. Yeah, it is in downloads. So it's very important to locate where did the file go? In order to find it. And win hyphen key dot pem is the name of the file. All right, now I need to get to the command prompt. So what I will do is I'm going to type CMD here and you will see that it will show here. Double click on that. So this is the command prompt. Whenever you hear me talking about the command prompt, this is what I'm talking about. So let's relocate it to the middle of the page. And here let's enlarge it a little bit. Okay, hopefully it's visible now. So what I will do is I'm going to do CD downloads. And if I do dir just to check. We have here the file. The win key dot pem. So what do I need to do now? I need to get the command for the SSH minus I to try and SSH from here. So where do I get that from? I get it from the browser window. So let me minimize again and get to Edge. And I'm going to copy that from here. Oh actually I had copied it. Anyways, that's okay. And I'm going to go to command prompt again. And let's try and see if it works. So now I am on the same directory where the win hyphen key dot pem file exists. That's the easiest way. Of course you can add the path and do it from anywhere, but the easiest is locate where that is. Use CD and the name of the directory as I did here in order to see let me just make this a little bit bigger. So CD downloads as you can see here. So I I went into the downloads directory. So you need to move to that directory where the pem file exists and then from here I'm going to try and hit enter and see if it will connect. I'm going to click yes. Let's see what happens. And as you can see I am connected into the EC2 instance. Here it says Amazon Linux 2023 and here I have the EC2 and the IP address and so on. Now I can do sudo SU and do ping 8.8.8.8. And that would be responding from the Google server. So we can do this and we can reach the internet without any problems. We did SSH. The SSH is working and now we are typing commands from the instance to Google and everything is working fine. That means the forward path to Google is working and the response is coming back as well. So life is good. Do control C and it stops it. And as you can see here, we have 0% packet loss and we have sent this many and this many were received and life is good. All right, so hopefully this is clear how you can do it from Windows and this is very easy as you can see. Don't forget to terminate the instance because we don't need it anymore here. So what I will do now is I'm going to exit from here. Exit. And then another exit. And now I'm back into Windows. I do CLS. In Linux and Mac we do clear here CLS and it will clear the window as you can see. All right, so what I will do now is I don't need the instance anymore. So I'm going to go ahead and remove it. Why? Because if you leave it for extended period of time and if you are not on the free tier or if you have some credits and they finish, you will start to get charged and I don't want to you to spend money if you can avoid it. So what I will do now is I'm I'm going to go into instance state and I am going to go ahead and terminate the instance. Thank you so much. Resize it back and click on terminate and delete. I need to check that it is shutting down and that means it is on the way to be terminated. So now you're good to go. All right, hopefully this was clear and it is not problematic. We are still with common TCP/IP protocols and now we are going to look at the HTTP and HTTPS. Whether you know it or not, but whenever you use your browser, be it Safari, Firefox, Chrome, Edge, whatever or whichever browser that you are using, the communication between your browser and the web server or the website or amazon.com or wherever that you are trying to get the data from is based on HTTP, the hypertext transfer protocol. HTTPS is a secure version of that where between you and the server, between your browser and the server, everything is going to be scrambled, is going to be ciphered, encrypted, so nobody can read it or make sense of it even if they can get a copy of that traffic. So let's go ahead and have a look. Let's start with HTTP, hypertext transfer protocol. So it is a set of rules that web browsers and websites used to communicate with each other. So this standard was primarily created for the smooth and successful communication between browsers and the websites. And the websites can be anything. Can be Gmail, it can be hotmail.com, it can be British Telecom, it can be cnn.com, any website. So what does it do? It allows the browsers like Chrome or Firefox to request web pages for you to sign in to your online banking for example, to look at your accounts. These are different pages on the websites. And when the requests are sent, then the website will understand what exactly you want and it will send the information back and that's how you get the websites in your browser and you can look at them. As in SSH, it functions at layer seven at the application layer. And it uses TCP port 80 at the transport layer or layer four. And if we said TCP means what? It means the two parties, the source or the client and the server are going to communicate and establish a connection and they will establish the rules of that connection. So the sequencing of packets, the retransmission when needed, errors when there are errors, what are the error codes that will be sent if a page is not available or the website is down or whatever. So they will agree on this set and then the connection will start. So the send syn ack and acknowledgement is going to happen beforehand. So this is the port it uses at layer four. And here is an example. This is to show when someone is not using So you're working on HTTP and the website is funny. It's called bad SSL. So let's go ahead and look at this website. It's just a dummy page. But if you look here at the top you'll see that it's HTTP and next to it it's saying that it is not secure. So this is not HTTPS basically. When we're talking about HTTP and HTTPS, the success of HTTP and HTTPS between browsers and websites led to the adoption for that language to be used even between application components. As you progress in IT, you will find that a lot of the application components that you will come across, they are communicating using HTTP. And why is that? Because it has everything. It has the rules, has the formats, it has the error messages, it has a lot of things to do. That's one thing to note. The second thing to note is when we are talking about it functions at layer seven, that means any information that will be added because of HTTP like HTTP headers for example and there are many of them. They will only be understood by devices that can process up to layer seven. So for example, the web server, it processes up to layer seven because it has the application and that's how it understands that. If you would like to put any security device in between and you want to filter or check the packets or understand everything at that packet to ensure that it is secure and it's not malicious activities and it's not including any viruses or anything, then the device that will be doing that check has to understand layer seven. It has to have software components that can look at the packet at layer seven and understand the HTTP headers and look at them and find out if it is following the standard or if it is suspicious. So, this is very important and that's why we mentioned layer three, layer four, and layer seven are going to be bumps on the road. You have to understand in order to assimilate what you need to do from a networking perspective, from a security perspective, from a lot of features that you are going to use whether in the cloud, in the network, or in cybersecurity, or in a lot of other things. Now, let's move on to HTTPS, the secure your version of HTTP. So, this is a normal HTTP over TLS. TLS is abbreviation of transport layer security. HTTPS ensures that anything that your browser is going to be exchanging with the server, whether it is login information, credit card information, account information, whatever that is, it's going to be secure and scrambled, ciphered, such that if anyone in the middle, man-in-the-middle attack we call it, can grab a copy of that data somehow, they will not be able to make sense of it or understand the information included. And it operates at layer seven like HTTP. And at the TCP layer, it uses port 443. HTTP uses port 80 at the transport layer. Can I configure my server, my website, to listen or to function at a different port other than port 80, which is a default? The answer is yes. You can configure it to run at port 8000, maybe 8080. And in that case, the client and the browser that are going to be communicating with the server, if the server is listening now based on the updated configuration at port 8000, then anything sent from here should be communicating with port 8000. Otherwise, if this communicates with port 80, but the server is not functioning at 80 anymore, it will not happen. The communication will be broken. HTTPS functions at TCP port 443 at layer four. And examples would be a lot of things. Could be cnn.com. As soon as you get to the website, you'll find here it's not saying that it is not secure. And if you click click on this, it will tell you that the connection is secure. And if you look here, you'll find that this is HTTPS. Okay? So, these are the difference between the two. Very common. You will come across HTTP and HTTPS a lot when you are learning in IT. So, that's why you need to know them. Whether you are a developer, a cybersecurity consultant, a network engineer, a cloud engineer, DevOps engineer, you will come across HTTPS a lot. So, it's very important to know HTTP and HTTPS. If you are a developer, maybe you need to dive deeper into these protocols because you are going to build software that will start using HTTP and HTTPS. All right. So, hopefully, this was easy. Now, since we have learned a lot of information about TCP/IP, about ports, about many things, now let's put all that together and revisit the TCP/IP packet anatomy. Basically, look at what is the composition, what are the different fields that we have addressed, and where do they exist, and how they will be sorted out, and which layers is going to be using them, and all that. This is very important, and we'll look at some examples because we need to understand when a client communicates with a server, what will be the source port, and where it will come from, how it will be assigned. Also, what will be the destination port, the port on the server, which should be known, otherwise the communication will not happen properly. Imagine and remember when we said that if you send a letter and the address for the recipient does not have the unit number in the building, then it will be difficult or challenging to deliver it properly. Same thing here. You need to know the unit number, the port number for the application you are trying to talk to, otherwise the client software is going to create a packet that is going to be sent to the server, but then it might not be delivered properly, or it will go to the wrong unit, and then an error will be created. So, let's go ahead and look at the TCP/IP packet anatomy. So, first thing we need to understand TCP and UDP. Transmission Control Protocol, which is protocol number six, and UDP, which is User Datagram Protocol, which is protocol number 17. But where do they sit in the headers of the packet? Believe it or not, but this is what a TCP packet is going to include. And it will be surprising to see that the payload is only this part. Of course, it can be long. But then we have so many other fields that will be added by the source and by the destination when they are communicating. So, for the forward traffic and the responses. The HTTP packet has a length field as well. So, all of these are going to be Anything that has to do with HTTP is going to be added at layer seven, for example. We have type of service and version. These are things that we are not going to discuss outside our scope. Time to live. How many times or how many devices can process this packet before it reaches the destination? And if the TTL, that's usually a number that decrements each time a node will pick up this packet and try to process it. So, the TTL, if it reaches zero, the packet must be dropped because that means it might be circulating endlessly in the network. One important field here is the protocol. So, is it TCP or is it UDP? And that's how layer four in one end, when it sends the very first packet to the other side, it would say, if it said TCP, port number six, that means let's go ahead and please create a connection and agree on the rules of the communication before we start. So, retransmission, error flow, flow control, and all that are going to be included. If the protocol value was 17, that means the client with the first packet is telling the destination, let's communicate, but don't worry about errors and retransmissions and sequencing and all that. We I'm just Whatever you receive from me, do the de-encapsulation, make sense of the data, send it to the server, and that's it. Then we have the headers, source IP address, who is the sender of that packet, and the destination IP address, who is the intended recipient. Please remember, when I call you, if you are John and I'm Issa, when I call you, John, can you please help me with that? When you come back to me, you'd say, Issa, I've done such and such and such. So, always the source and the source IP address in and destination in one direction, they are going to be reversed in the response of that communication. So, then we'll get the protocol as we mentioned, and then we have the source IP address and the destination IP address. And then we have other fields out of our scope right now. But then, this happens at layer three, the source IP and and destination IP. The protocol happens at transport layer. And also the source port and destination port will happen at layer four. These are called IP headers because except for the protocol, because these are normal IP headers, and the network source IP and destination IP are the highlights. And the source port and destination ports are called TCP or UDP headers, which port for the source and which port for the destination. So, now we are speaking about ports, ports, ports all the time. How do we allocate the ports? What are the available ranges? Is there any range that could be used deliberately without conflicting with anything else? Let's find out. So, the ports are interpreted at layer four. And the well-known ports are 0 to 1023. So, these are the assigned ports. For example, HTTP, by default, port 80. HTTPS, by default, port 443. SSH, by default, port 22, and so on. So, this is SSH, HTTP, HTTPS, and we have DNS. We are going to talk about it later on. Domain Name System. When you type cnn.com, how is that translated into an IP address? So, this uses both TCP or UDP port number 53. So, these are pre-assigned. Nobody can use them. They are assigned to services or protocols. This is Remote Desktop Protocol, a Microsoft protocol when someone is trying to get from a client to a Microsoft server or a Microsoft machine remotely to administer and control that machine. Similar to SSH, but this is for Linux, and this is for Windows. We have MySQL, one type of the databases, and it is very well known, very widely used on the internet, and that that's the port, 3306. Then we have registered ports, and this is the range, and usually companies will avoid using that deliberately. And then you have the dynamic or private ports. So, this is what clients can use deliberately without any permissions, and also ensuring that it will not conflict with anyone. And the range is 94,152 to 65,535. So, what do we use the dynamic port for? When your browser is creating a packet to go and send it to cnn.com, so, the source IP, destination IP will be added. The destination port is known. I mean, that's HTTPS going to be so 443. But, what will be the source port? The client or this session port from the client? How it will be decided or assigned? The browser is going to check for this range locally which ports are used and it's going to pick one port that is not used randomly. If my laptop is opening 20 sessions to my Gmail and to my Hotmail and to Zoom and to this and to that, these are going to be each assigned a random port from this range and the port will not be reused if another session is using it. And that is how when the client is going to send to the server, it the client will send with it the source port and the source IP as well. And of course, the destination port and destination IP, they will all be in the packet. So, when this is sent, then the server when it responds, the source port will be the destination port. So, when it comes back to the laptop that has 100 or maybe 200 sessions and tabs and applications running, it will know exactly what's the unit number, which session and which application to deliver it to. So, this is very very important. This is called dynamic range or ephemeral port range. Whether you hear this term or that term, it's the same. From the client to the server, the destination port is the port of the application, the unit number in the building at the destination, at the recipient side. And the source port is picked randomly from the range that we discussed. So, here's an example. This client is going to use a browser to get to this website, let's say Dolphin Ed Academy. And the IP address of the source is this IP address and it appears to be a public IP address, so it's connected to the internet. It could be a direct IP address or it could be the one on the wireless router at home or in the office. The web server side, this is the IP address, again it's a public IP address and it is listening on or functioning at port 80 HTTP. When you hear the term listening on, that means this is the port that it is expected to receive traffic on or this is the unit number in the building that you need to deliver or the server needs to deliver the packet to. All right? So, when you when you hear that it works on port, it listens on port, it processes port, it's all the same thing that the application for correct and accurate delivery needs to see that in the packet as the destination port. The browser will look at the random range that we discussed and it will find out randomly that port 50,000 is unused. So, it will create the packet. The source IP address is this IP address. The source port is the random unused one that no other session in this device is using. And then the destination port is 80 depending on our knowledge of the server and destination IP address is 98732164. And it is going to tell the server, "Please, we need to establish a TCP connection. This has to be a reliable connection." In the response, this is going to be reversed. The destination port is the source port that's in the response from the server when they are reversed. And the source port is the server port that used to be the destination in the forward traffic. So, let's look at it again. Here we have the source port and the source IP are those of the client. Why? Because that is the sender. And the traffic was going from the sender to the receiver. So, the destination port and destination IP used to be the server ones. When the server comprehends and understands the message, prepares the response, then it's going to take what used to be the source port and the source IP in the original message that reached the server, these are going to be the destination port and the destination IP. And since it was initially destined to the server, the destination IP and destination port, now in the reverse direction, they are going to be the source port and the source IP. Makes sense, right? And the protocol is still number six. So, this is basic, it's obvious. We use it for the analogy. If I call your phone number, you didn't pick up because you were busy. When you call me back, you will have to dial my number, not your number. A lot of people in IT, network, network security, cloud, DevOps, they do a lot of mistakes when they set security to filter out packets based on inbound or outbound. And when we get to the security module, we are going to talk about that in more details. So, please, if you are going to eventually configure anything that has to do with packet filtering, traffic filtering, security, firewalls and all that, make sure that you draw it. If you are not sure, draw where is the client, where is the server, and for this direction, what will be the source and destination? And for the reverse, what will be the source and destination? That's one thing. What if the server needs to go to an update server and download a new version of the server software? Let's say the server is running on Nginx or Apache and it needs to download a newer version. In that case, the source or the client is going to be the server and the actual server will be the update server on the internet. So, in this direction, who is the source? Who is the one sending the traffic? What will be the destination? It's extremely extremely important to map out the flows expected when you configure that. Here is one more example and in this case, we are taking it one step higher. So, in this case, we have a server that has three applications active. The first one is an SSH server. So, administrators can connect using SSH to this server and it is functioning or listening on port 22 TCP. Then we have a domain name server that will translate cnn.com into an IP address, dolphinedacademy.com into an IP address and so on. And then we have a web server. So, it could be an e-commerce website, something like eBay, amazon.com and all that, but we are talking about like a mini version here because we are talking about a single server. And this is expecting connections on port 80 or it could be 80 and HTTPS as well and 443. All right, so what's the scenario? We have a user and the administrator that needs to connect SSH to fix few things in the code here or in the website. And while working on using SSH and administering that, the user also will need to connect to the web server to see the updates. What is the impact or effect of these changes and whether they have fixed the problem or not. So, two connections in the same server from the same client. Remember that the ephemeral range or the dynamic port range is the 49152 to 65535. So, let's talk about the first one. The client is trying to SSH, is trying to connect securely into the server for administrative purposes. So, in that case, the source port is going to be a random port unused in any of the other sessions and it will be picked up by software. You don't need to get involved. And it decided that it's going to take 61234. Here we are ignoring the IP addresses, but of course, let's say this is IPS or IPC for the client and this is IPS. So, this could be 200.10.1.5 and this could be 150, for example, .2.1.1. So, we'll focus on the ports. So, the source port randomly selected from this range unused in the client and the destination is going to be 22 TCP. And this is the traffic from the client to the server. So, the server going to receive it, check on the key and check on all the information and now it is good to go. So, what the server would do, it will respond and it it would say, "This is being sent from the source, which is the SSH server, port 22, going back to what used to be the source in the request." And of course, the IPs are going to be IPC and in this case, going to IPS, which is the server IP address, and in this direction, they are going to be reversed. The source will be IPS and the destination will be IPC. Connection established. The administrator does whatever he or she needed to do and now it's time to test it. So, they need to do an HTTP connect connection is open, but they open the browser and now they need to go and do HTTP into the server. So, again, the software here will look at this dynamic range and see what has been already taken. For example, 61234 will never be picked up. It will pick up another one that is unused. And here we have more than enough, 16,000 plus ports available to be used as a source port. And I don't think any of us will have 16,000 sessions open at the same time to 16,000 different applications and websites and all that. Maybe have 50, 100, 200, but never 16,000. So, it will decide on this is free, the 50,000, and the destination in this case will be TCP 80. Why? Because we know that the server is listening on this port. Server will receive it, understand it because it's standard HTTP, and now it's time to respond. So, when it responds, they will be reversed. The source is going to be 80 and the destination is going to be 50,000. So, please, please, please stick this fact about the source port and a destination port in forward direction and they will be reversed in the other direction. Now, let's expand it a little bit. Let's say that this server would like to go on the internet to an update server. And the update server is going to be using port 443, for example. So, HTTPS. All right? So, the request is going to be initiated from the server out. So, the destination is going to be port 443 in this case. While the source is going to be a random port selected depending on how the software will do it. All right, let's now discuss the security or the cybersecurity introduction and the network security introduction. A lot of people get confused about network security and cybersecurity and they think they are the same thing. And here we are going to clarify the relation between network security and cybersecurity for beginners. In this module, we're going to introduce what cybersecurity is and what exactly it covers. And then we are going to look at network security. So, the focus is going to be about network security, but we have to take the 50,000 ft view first. Look at what cybersecurity is and the role of network security within cybersecurity. We're going to extend the discussion to network security. We're going to talk about network devices again, but this time we're going to focus on the firewalls. The very famous or the most common device in protecting or in securing your network and the data within. We'll look at firewall examples and we are going to use two examples from AWS, the security groups and the network ACLs, and both of them are layer four firewalls. What does that mean? That means they have the intelligence to understand up to the transport layer only, but they don't go beyond that. They don't understand what's happening in the application. They cannot comprehend any headers are that are added by HTTP or by encryption. So, they only understand IP addresses and ports and that's what they can permit or deny based on. And we'll also look at encryption. Then we're going to look at virtual private networks, which relates very well to encryption that we have mentioned multiple times, but now it's time to explain what that is. So, let's go ahead and start with cybersecurity overview. What is cybersecurity basically? Before we do that, we'll take a step back and we'll do an analogy so you understand the importance of security when it comes to networks and data. So, think of your phone or computer like your house. What do you do to secure your house? There has to be a lot of different ways to secure it. There are the passwords that we need to protect and firewalls. So, let's say, for example, this is locking your doors every night. And then we have the scrambling of the data so nobody can read your data. This is like when you spread or close your curtains so nobody can see you in the evening while you are inside the house. Then we have an alarm system. If anyone breaks into a window or breaks into a door, then we need that. So, that is the role in cybersecurity for antiviruses and security monitoring. Then probably you will have a device with a camera and mic that will check who's at the door before opening the door, right? So, think like authentication in network. So, we are going to cover all of these. So, these are stuff that cybersecurity covers. So, cybersecurity is about protecting computers. Computers include servers, include storage, include anything that does computations. Protecting networks so nobody can break into the network and bring it down. Delete the configuration, for example. And also the data, whether it is stored or travels across the network from being stolen, attacked like hacked or damaged. So, this is the core responsibility of cybersecurity in general. So, please note that we talked about networks and we talked about computers, but this is part of what you need to protect. Why is cybersecurity important? Because it will protect your personal information, your credit cards, your photos, your money, your bank accounts, your passwords. That is all done by implementing cybersecurity measures. Also to stop hackers from breaking into systems, whether these are websites they will hack or even your laptop and then they will ask you for a ransom. And also to keep companies and services running. Some hackers or types of the hacks is the denial of service. They will have loads and loads of traffic on a server such that the resources on the server, the memory and CPU will be busy and they will not be able to serve legitimate users. So, this is also type of attacks that people can do in order to deny the service from legitimate users. So, this can happen in banks, in hospitals, and in schools, universities, and so on. Also to prevent data loss or leaks. So, cybersecurity is very wide in its responsibility to protect a lot of things and to make sure that your IT is healthy, is operational the right way, and is protected from any malicious activities. So, cybersecurity is not network security. Network security is part of cybersecurity. So, let's look at the areas or specializations that are under cybersecurity. What are they and what are these specializations? So, we look at network security. This is one of many areas under cybersecurity. And as the name implies, this is about protecting network devices and protecting the data stored or the data that is moving over these networks or through the internet or local area networks. Then we have application security, which is the security of the software and applications from bugs, from backdoors, from Trojans, from from from There are so many things that you can do to protect applications and software. Then we have the endpoint security. I need to have security software on your laptop, for example. I need to have encryption, for example, done on your laptop. I need to have similar things to detect malicious activities on servers to make sure that they are sending updates and notifications about their performance and all that to monitoring and alerting. So, this is for devices like servers, storage, laptops, and phones. They have to have endpoint security and there are companies that are specialized in endpoint security. And then we have cloud security. So, it could be the network that you own or it could be the cloud. And in that case, in the cloud, then the provider of the cloud will be responsible for the network and you will be responsible maybe for the endpoint security and the application security and so on. So, infrastructure and data in the cloud must be protected as well. There is identity and access management. Who can access your infrastructure, whether it is in the cloud or on prem? And when they access it, what are they allowed to do? Are they allowed to get into databases and change things? Or is it only read only to look at the configurations and find out if it's done right or wrong? Can they change configurations? Can they delete resources or they are just high-level entry-level users? They can just view and not do all of that. So, that is all in identity and access management. Who are the users that are allowed to do this and at what level? So, who's allowed to access what and what they can do? And then there is the physical security itself. AWS has data centers. Azure has data centers. Now, who is allowed to get into these data centers? And what is happening in the data centers? And who went in at what time and where did they walk within the data center? So, even if they are allowed, then we look at badges that will allow them in specific areas and not anywhere. They cannot just go ahead and open any cabinets or any cage and walk in if it belongs to third parties or different companies or if it is an area where they should not be in. And then policies and rules for security and security policies and all that there are rules and policies. What are the standards implemented for that? And this is also part of cybersecurity, which is the compliance and auditing part. So, as you can see, network security is just one of maybe seven or eight different areas in cybersecurity. So, please be aware in your career that nobody is going to fool you intentionally or based on ignorance and tell you that cybersecurity is network security. It's the same thing. You need to take network plus and CCNA before you do cybersecurity. And my answer to that would be, "What if I'm going to specialize in these areas? Why do I have to dive deep into network security? Maybe cloud security will have a little bit of that as well. So, if I'm not specializing in this one or that one, why should I dive deep into networking? If I'm going to do endpoint security or physical security or compliance and auditing? Why do I need to be the expert of networking? So, please be aware of what cybersecurity is and what network security is and how they relate to one another. This is very important to keep in mind as you cruise through your IT career. All right, so now let's focus on network security. The normal extension or the normal continuation is to go through network security as a branch of cybersecurity. So, please keep that in mind all the time. So, network security, it is about protecting the network devices and data as the data travel across or live on a network, get stored on a network in a database or in a storage device. The emission of the network security is to keep the bad guys out and make sure that the data is safe and only the good guys should be logged in to the network or access the network and only do what they are allowed to do. So, that will take us to discuss network devices again, but now we are going to focus on the security part. What are network security device? The very common one that we will face day in and day out, whether we are using AWS or Azure or Google Cloud or even if you are working on premises, we always need to think about firewalls. Firewall is a security gate, is a security guard of your network and applications. So, it can protect the network and it can protect the servers or the computing devices and the applications on top. Is it going to do everything in the application? The answer is depending on the intelligence of the device. Does it delete the need for end point security? And the answer is no. They are integral parts of the overall cybersecurity mechanism that you do. So, here is an example of a firewall that we can place. It will protect the local area network switch and it will protect the application servers and database servers if we are in a data center. Of course, some people would place that in front of the router. That's a possibility if the firewall is an advanced one that can also process routing. The firewall can be configured to allow or sometimes it's called deny or block data coming in. If data is coming into the network or the server, this is called inbound. If data is being sent out of the network, this is called outbound. So, some people would call it ingress for inbound and egress for outbound. So, please understand what this mean because they are very important when you are configuring your firewalls. Once configured, the firewall will be like this security guard that is going to be looking around and trying to figure out if there is anything that's not supposed to run through the firewall, then it will stop it depending on the configuration that you have placed. When I was stressing before on the importance of understanding the flows and the ports and what is the source port and what's the destination port, what's the source IP, what's the destination IP, because if you don't understand it well, you will configure the firewall in a wrong way and that will deny legitimate traffic and may allow traffic that is not supposed to run through the firewall. Firewalls can protect at the network level or at the application level. So, firewalls might be a layer four firewall, which means it understands IP and transport layer only. That's called a layer four firewall. An advanced firewall sometimes it's called next generation firewall or web application firewall, that is a firewall that can understand up to layer seven. So, it can process all the headers and it can even look at the payload at layer seven. The complexity of the firewall depending on the budget and depends depends on also the use case, what you need to use it for. So, we might also deploy separate firewalls at the separate segments and it depends on which business you are in. So, there are some standards depending on the business that they have to comply with and part of that compliance, there will be some clauses about firewalls in your infrastructure and how many firewalls have to be there. So, we could also have hardware firewalls of or software-based firewalls. The two examples that we are going to study in AWS are software-based. The infrastructure security part, how do companies classify segments or trusted, untrusted, or highly critical, low critical, public zones in their infrastructure? Here I'm not talking about a startup that maybe have one or two servers. I'm talking about a corporate a hospital, a university, a government, or a ministry in a government that they have a sizable infrastructure and they want to protect it according to best practices and according to standards. What they do is they start to classify zones in their infrastructure from a security perspective. So, the zoning architectures firewalls, as we have seen, can divide the network into trusted and untrusted segments. The security architecture of the network infrastructure consists of zones. So, there are security architects and this is a job. There are infrastructure security architects that will be defining according to compliance needs and standards and the business and so on, they will be defining an a security architecture that will classify zones and they will detail what should be in each one of these zones. So, the zoning architecture is designed based on the criticality and the security risk of each component. So, let's have this example that we have here. So, I have a firewall. Now, we are not showing the routers. We are showing the firewalls primarily and this is an architecture and that's why it's not a physical drawing. So, you need to understand moving into IT that there are physical diagrams where you have to put the devices and you have to put the ports and the types of the cables, speeds, and all that stuff. And there are architecture conceptual drawings that explain the concept and that not necessarily is going to include all the devices by name. All right, or type. So, here we have the internet and this is a zero trust area. We don't trust the internet. That's why we have, let's say, firewall one or we can call it the DMZ firewall that is a firewall that will filter traffic coming in or going out to the internet before it hits the demilitarized zone. We call that demilitarized zone and that's a low trust. So, it is trusted at a low level because it is only one firewall away from the internet, which is zero trust. This is a data center security architecture, by the way. So, external DMZ, what would you place? Why do you build it? Which workloads are you going to host in a external DMZ? So, examples are voice over IP servers. If you are using voice over IP, telephony over IP, basically telephony over the network, if you are going to have a file transfer protocol server where people can get in and download files from the outside, from the internet, if you have web, DNS, VPN, or extranet servers that are exposed to the outside, any workloads that should be accessed directly from the internet and they are not a high risk or a highly critical workload, then they can be placed in the external DMZ. Okay. So, let's say I have the servers and all that. If these servers they need to communicate, for example, with a database inside, do they just communicate through the network or do we have to have again checkpoints, firewalls that are going to process requests before they get in? And the answer is if the ones inside are classified as trusted, that means I cannot connect a low trust to a high trust directly through the network, through a switch or a router directly. I have to put another layer of security or a checkpoint that will do more checks because if someone from the internet somehow hacks one of the servers here, before they can get in or roam around the infrastructure, I have to do another checkpoint. Police officers that they will stop them and look at the ID, try to find out what they are trying to go to and why and who are they before they are let in. I'm talking about the traffic they are sending, of course. Okay? So, what would I have in a in a high trust zone? You will have applications and maybe end user systems. All right, then where are the databases? These are the applications. Databases, mission-critical applications, and IT support critical services or resources, they are going to be in a highest trust. Look at the color coding, by the way. The colors usually incorporates and in their zoning architecture, they have meanings. Here you have the green, that is the highest trusted. And the red is the most dangerous one and that's why it is no trust or zero trust and the color red signifies that. If you look from afar, you will be able to tell which zone and what kind of security is that. And of course, they document in their documentation, they document the color legend and what that means as well. All right, so if I move from the purple, if it is high trust and I would like to communicate, application here would like to communicate with the database here. So, it has to go through a layer of firewalls. Now, what about the corporate users who are coming through wide area network? They are not coming through the internet. Should I fully trust them? And the answer is no. If they are coming from wide area network, we'll have them as medium trust. So, they are higher trust than the blue, but they are lower trust than the purple and green. And that's why we have firewalls behind the WAN routers, the wide area network routers, because they need to protect traffic or filter traffic before it gets into the operational zones. And from there, maybe they will try to get into the highest trust zone. So, this is not something you need to worry about now, because that is advanced when we talk about these architectures, and you need to get into network security deeply, understand firewalls and how they get configured and their features and so on, before you will be at the architecture level deciding on zoning designs. Usually, you will enter from the junior to mid to senior engineering before you move into the architecture part. All right, let's now go into AWS again and introduce one type of virtual firewall, a layer four firewall, so it only understand the transport layer, the ports and the IP addresses, cannot get into the application, presentation, or session or encryption details. And that is the security groups. This is available also in Microsoft Azure and in Google, and it is a type of a firewall that will protect at the virtual machine level. So, let's go ahead and discuss that in more details. So, the security group, what is it? It's a virtual firewall that applies at the instances network interface. So, each virtual machine in AWS, as we mentioned earlier, it's called an EC2 instance. Elastic Compute Cloud is what EC2 is or abbreviation for. And then instance means it's one virtual machine, basically. Each virtual machine, as we know from the virtualization concept, it's going to have virtual resources allocated. One of them is a virtual network interface. So, if we look at this symbol as the virtual interface, it's called the ENI in the AWS world, Elastic Network Interface. What does it signify? Why did they call it this way? I don't care. All we care about is to use the right terms that AWS has used or has decided to use for the VNIC or the virtual network interface. So, if you heard the term ENI or VNIC, it's exactly the same thing, virtual network interface card. So, it's a virtual firewall that applies at the instance network interface. And in the security group, we can only allow permit rules, allow rules. So, how about the deny ones? By default, if it is not there, that means it's denied. If we have a security group with allow allow allow, and that's it, that means there is an implicit deny at the end. So, if anything that is not allowed is denied. So, if I have a blank rule set in a security group, that means everything is denied. If you make a change to a security group, the changes are going to take effect immediately. We're going to present all of that, so don't worry about that. In a firewall, there is something called inbound, and there is something called outbound or ingress and egress. But you need to understand the meaning from the vendor perspective, not up to you. From the vendor perspective, what is ingress or inbound, and what is egress or outbound? For example, in some Cisco routers, if you're talking about inbound, it could be what is coming into the router, and outbound, what is going out of the route. But here, when we are talking about inbound, that means traffic that is coming eventually into the instance. So, if the firewall, if the security group allows it, it will go inside the instance. It's It is sent to the instance. Whereas outbound, that means it's initiated from the instance, and if allowed, it will go out. So, inbound or ingress means coming into the firewall destined to the instance. Outbound means that it is leaving the instance through the firewall to the outside. And the outside could be another instance that is in the same subnet, or it could be another instance in a different subnet in a VPC or even out to the internet. It could be going to anywhere. We don't care where it's going. What we care about is outbound means leaving the instance or the instance has initiated that traffic. Outbound is always at the initiating instance side. So, outbound is always coming from the instance, even if it was going to another instance in the same subnet. So, this is outbound, and then it will be inbound if allowed to the other instance. So, please make sure that you understand the flow that you are trying to allow or deny, where it will be initiated from, where it is going to, what are the involved ports for the source and destination, and then you will know where you decide. So, for example, for this flow, assuming that it started from here. Let's say this instance is doing a ping or SSH into this instance. So, it is initiated from here, which means it has to be allowed, if you want to allow it, through the security group in order to pass through the security group and continue its trip. So, as it reaches here, the same flow, the exact same flow, here it is inbound, not outbound. So, in the inbound rules here, you need to allow it if you want to let it go into the instance. If you did not understand that, then definitely you're going to configure that wrong, or maybe you'll do one side and forget about the other side, and then the traffic will not flow, and you will have problems, and we got a lot of questions like that based on lack of understanding. Despite the fact we stressed time and time again on the importance of understanding the ports, understanding the flow, what is the source IP, what's the source port, what's the destination IP, what's the destination port. And now we'll add to that, what are the involved security groups or firewalls in the path that need to allow this to get through. So, here we have to allow it on the outbound in the blue security group, and we have to allow it on the inbound in the receiving security group. All right. So, let's say this was a ping, ping IP address allowed in the outbound, allowed in the inbound, everything is cool. In security groups, they are called to be stateful. They have a memory and they remember the state. They remember what was allowed in one direction, so the instance will receive the ping, and now it's time to respond and say, "I'm alive. Yes, I'm okay. I got your message." As a special case, because it is stateful, if the traffic was allowed in one direction, the response for that traffic when it arrives, it will be allowed. This is as if you are driving your car into a gated community or a gated compound. So, when you are coming in, they will ask you, "Where are you going?" Maybe they will take your phone number and name, which unit you are going to. Maybe they will call a landlord or the owner of that unit or the resident in that unit, and they will make sure that you are allowed to get in. So, you get in. When you are leaving, the barrier or the gate will open automatically as you approach, and they will not ask you for anything else. Or maybe they have cameras that will record that you have left, and that's it. This is stateful. So, that's exactly the same analogy for security groups. Is this true for any virtual firewalls or any cloud firewalls? Go and check the documentation of every vendor you are dealing with to find out if it is stateless or stateful. What if it was not stateful? That means you must configure the response rules to be allowed here on the outbound, and when it arrives here, then you have to allow the response inbound on this firewall. All right? So, this is extremely extremely important to know which firewall you are dealing with, is it stateful or stateless, and should I allow rules in both directions for the forward traffic and the return or the response, or is it enough to do it in one direction, and then response is going to uh work without any problems. Let's look at inbound rules and how the format in the security group looks like. So, what do we configure if we wanted to edit or create a security group and define the parameters and whether that will be allowed or not. So, here's an example. We need to allow this inbound traffic. Let's assume that this is coming from the internet. Yeah, a user is sitting here and needs to connect to an instance that is in a public subnet connected to the internet. All right, what do you need? Any instance, any virtual machine created in AWS, must have a security group. That's not an option. There is no way you can start an instance without a security group. And even when you are creating the instance, and we have seen that before and we'll to it again, you are told do you want to use an existing security group or do you want to create a new one? So for the inbound rules, the destination is the instance itself. So when you are creating the inbound rules, so this is an example of an inbound rule. You can decide on the IP version. It could be IPv4 or IPv6. That means the security group can filter based on IPv4 addresses or IPv6 addresses. Then what is the type of the traffic? Here we can say HTTP, SSH, all traffic, all TCP. There is a lot of choices. We're going to look at that. Then the protocol. Is it TCP or UDP? Then the port range. Why do they call it a range? Because it could be a single port or it could be a range of ports. If you want for example to allow all the ephemeral, all the dynamic port range. And then we have the source and that's it. So where is the destination? The statement we are going to make here is when the traffic hits the virtual firewall of a specific instance in the inbound direction, it is obvious that this is headed to this instance. So why should I ask about the destination? I know the destination IP address. I know you are headed to the instance I'm trying to protect. So the destination is already known, but what we care about is where it is coming from. Who are you? Are you allowed to come in? Are you allowed to send traffic in the inbound? And we're not talking about only your IP address, but also which port on the instance. So the the port range here is destination port range. We don't ask about the IP, but we ask about the port. Why? Because I may have here web, I may have here SSH, I may have here FTP, I may have multiple applications on the server or on the virtual machine. So I need to make sure that I know whether you on this IP address, you are allowed to communicate with the web. Maybe you're only allowed to come into SSH as an administrator, but not to use FTP or the web. So it gives you that granularity that you can define based on the source, where it is coming from, the source. So this is the source. But the port is on the server. So it is very very important to understand that. A lot of the simple and obvious mistakes happen because of this confusion and people don't know what is the source, where is the source, where is the destination. You don't know, you can't figure it out, bring a piece of paper, draw where is the client, what is the flow. Somebody is trying to come through TCP and get into the HTTP port on the server, trying to get to a web server. So the flow is clear. Is it from within AWS in my VPC? Is it from outside VPC or is it coming from the internet? All right, so it's coming from the internet. What are the allowed sources on the internet that can communicate with this virtual machine on the HTTP port? And based on that you'll find out. So here for example, there is only one source that is allowed. 98.12.37.32/32. So that's a specific IP address, not a range. /32 means a host IP address. So it has to match everything here as is. So this IP address is allowed as a source to communicate with the HTTP port on the instance. We have a second rule. The second rule is about SSH. And SSH runs on TCP and on port 22. So port 22 is here. So we're talking about port 22. Earlier we were talking about port 80. Again, that is a port on the instance. So this is a destination port. The source is 95.12.65.91/32 again. So /32 means only this IP address. So there is another IP address that is allowed to come in and to do SSH into the instance. All right. What if we get an SSH request, but coming from a different IP? For example, what if this IP address tries to send an SSH into the instance? Would it be allowed? Security group, inbound, check the rules. Cross, cross. We don't have any other rules. Deny. It will not be allowed. What if the second IP address tries to send in an HTTP? Again, do I have an HTTP rule? Yes. What's the source? 98.12. This is 95.12. No, not allowed. Cross. So that will be an implicit deny. So basically here there is a deny anything rule that we don't see. However, it's an implicit deny. Deny all. And as you see at the end, there is no allow or deny. It's only allow rules in the security group. Based on that, the source in the inbound rules is the client, the one who initiated the traffic, and the port is on the instance. By the way, if the source was another instance within the VPC, so the source IP will be all also this one. So if an instance within the VPC was trying to talk to another instance within the same subnet or any different subnet, the source is the initiator of the traffic, the destination is where it is headed. Now let's look at the outbound rules and there will be a difference here, a key difference. So let's look at the outbound rule and what information you need to fill in. So IP version, same. Type of traffic, same field, same choice, pull down menu, ICMP, HTTP, SSH, HTTPS, all traffic, all TCP and and so on. Protocol, TCP or UDP. Port range. And destination. So it is very clear if the traffic is going out, we are talking about the destination IP address. But also we are talking about the destination port or ports. So in the outbound, we know the source is the instance because this is the firewall or the security group that will inspect the traffic. If it come to me and it wants to get out, then obviously it's coming from the virtual machine. So I don't need to ask about the source. But in this case, what I need to ask is where it is going both at the IP level and at the port level on that destination. So I don't care about the source port, I don't care about the IP port because I know them. I know it's coming from the instance. I know the IP of the instance and I know the port because I have received the packet and I know the port on the instance. What I care about to allow it or not allowed is where it is going, not where it has been originated from. All right. So if there is no rule to allow that, then guess what? There will be an implicit deny at the end that will block the traffic. So in this example, we are allowing IPv4 HTTP on port 80 to go to this specific IP address. So the instance can send outbound HTTP to a specific IP address, which is the 133.45.89. And it's a specific IP, not a range. And I also allow HTTPS, the secure version of HTTP on port 443, and that is to another IP, 100.130.4.56/32. So I have two IP addresses. I'm allowed to send one of them HTTP and the other one I'm allowed to send it HTTPS. And that's it. So what about any other traffic? If the instance tries to ping another instance, not allowed. Why? Because it doesn't match, doesn't match, blocked. What if it it is trying to SSH into another server? Not allowed. Why? Because it's not HTTP and it's not HTTPS and it's not port 80 and it's not port 443. What if it is trying to HTTP into a third IP? So an IP that is not this one and is not that this one and it's initiated from here. Block. Why? Because this is very specific, very close. What if I need the instance to download updates from a specific server on the internet? I mean in addition to these two, I need to download or download something from GitHub or download something from a storage in S3 or a storage in Azure. Do you know the IP address of the server? If you know, then configure a new rule and allow HTTP or HTTPS. So you have to know the IP address of the server and you have to the port range or the port on the server and then you need to add a rule to allow that. And please also pay attention, there is no allow or deny because the rules in a security group in AWS is without deny rules. You allow, allow, allow, everything else is denied implicitly. It could be different in Azure. It could be different in GCP. So always study the specifics of the firewalls that are available in the cloud provider that you are working. Find out if you can configure allow or deny. Find out if it is stateless or stateful and then decide on what you need to configure. Is it asking about the source IP, destination port, destination IP? If you understand this well and you understand your flows that you want to allow, then you'll be able to configure them properly. Remember that the security groups are stateful. So if this instance initiate HTTP to this IP address on port 80 and it is allowed here, if the traffic goes out to the server. Now, the server is going to process it and respond. The response is going to be allowed automatically in the inbound direction even if there is no specific rule to allow it. Why? Because in AWS, security groups are stateful. If you allow traffic in one direction by allowing the rule whether it is outbound or inbound, if it was outbound, the response coming back will be inbound to the firewall. So, that will be allowed automatically. If the traffic was allowed inbound to the instance and the response will be going out of the instance, that will be allowed automatically even if you don't have a specific rule to allow it. All right? So, please remember that the destination IP and the port are on the destination and not on the instance. So, let's go ahead now and do a security group walk-through in the AWS console. All right. So, where would I find that? You can find it under EC2 and you can find it under VPC as well. So, what we need to do now, let's go ahead and see the default security groups, how they look like and what do they have in terms of rules in the inbound and in the outbound. So, if you are in the VPC dashboard and you scroll down to security, this is where security groups are. You can also come from here and click on this. So, I can click on security groups. So, these both are default security groups. How would I know? They are named default, that's number one, and also as you can see here default VPC security group, default VPC security group. This is not what we created. I have two VPCs. We have the default VPC and custom VPC and each VPC comes by default with one security group. What's my proof? Let's move to another region that I rarely use, Tokyo, for example. And let's check how many VPCs we have and how many security groups we will have. So, let me make this a little bigger. So, here we have one VPC, no name, and if we scroll to the right, it will tell me it's a default VPC, right? And if I go to security groups under security you'll find there is one security group. It's called default and it belongs to this VPC and the description is default VPC security group. So, it's all the same but let me move back to Ohio so that we don't create anything and then we don't need it later on. It's not going to cost you anything to create VPC security groups and subnets and route tables and all that, but it's a habit that you only build resources where you actually need them, not just go randomly create resources anywhere. If you are used to do that, eventually you're going to create chargeable resources, forget about them, and then get a surprise bill. So, let's go ahead and check one of the default security groups that is in United States in Ohio. So, we have two VPCs as we mentioned. The one that ends with D23 is the custom one. Let's refresh ourselves on that. So, this is the custom VPC, D23, and this is the default which ends with DE2. So, what I can do in order to be able to know everything in my account, then what I will do is this one I'm going to mark it as custom VPC default SG. So, it's custom VPC default security group and I'm going to save it. And the other one I'm going to mark it So, let's remove this and I'm going to say default VPC default SG. So, from now on, I know that this one I have created, these ones are the default ones, and if I scroll a little bit to the right, I'll find these two are in the same VPC. So, there is no confusion there. Okay. What do we need to see? I need to see the default security group in the default VPC, how does it look like? This is the DE2 and if I scroll down, I'll find in the inbound rules and outbound rules. Inbound rules, there is no name for the rule, that's a default rule, and this is just the rule ID, so it's irrelevant to the actual impact of the security group. And it allows all traffic. All right? So, what are the the the other options we're going to edit and see now. Allows all protocols, all ports, but here is the tricky part. If you didn't scroll to the right all the way. So, this is how it appears when you open it. So, it appears as it allows all traffic on all protocols, all port ranges. So, they don't scroll all the way to the right to check the source. So, this source is very tricky. So, what does this source say? This is a security group ID. Each security group has an ID as you can see here. And the source is the security group itself. A11 and EA11. So, by default the security group, the default security group, allows all traffic in the inbound direction from all ports provided it is coming from the same security group as the source. What does that mean? It has to be coming from an instance that has the same security group applied to it whether in the same subnet or a different subnet. So, if it is coming from a different instance that has a different security group, this will not be allowed. It will not be allowed. No matter what the traffic is, if the source does not have the same security group applied to it, it will never be allowed. If you wanted to open up the inbound rules here, what you have to do is you have to do edit inbound rules and you can delete this if you want. So, I can delete and then I can add rule and then I can state what do I need, custom TCP or UDP? Is it ICMP or all TCP, all UDP? Or you have all ICMP IV4, all traffic, SSH, SMTP, and so on. So, I can do all traffic from anywhere and I can save it, but this is not recommended and that's why they are stating here, "Rules with this source allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only. Don't open up your security group widely like this because it could be dangerous." Now, you are not limiting to anyone and some of the IP addresses possibly that will will come into your instance or will try to break into your instance could be ill-intended or malicious activity. So, this is for the inbound. I'm not going to change anything because this is the default and I don't want to play with it. How about on the outbound? So, please remember the default on the inbound rule for the default VPC security group allows access to all ports, all traffic only if it is coming from an instance within the same VPC that has the same security group applied. How about on the outbound? On the outbound it allows IPV4, all traffic, all protocols, all ports to all destinations. Traffic from the instance going out is allowed to all destinations on all ports, zero restrictions. That's for the outbound, the traffic that is initiated from the instance and going out. So, everything is allowed. So, that's the default. Let's look at the default security group for the custom VPC and see if there is any difference. For the outbound it's all traffic, all all all to all destinations. So, it's exactly the same like the default VPC default security group. On the inbound you will see that all traffic all port range, everything if it is coming from the same security ID. If I want to edit, I would I would show you as well for the outbound, for example, then I can also do for example, delete this rule and then add a rule. Let's say where I want to allow only HTTP. So, I'm going to allow HTTP. So, this is the port on the destination on the destination. So, this is outbound, instance talking to a server. The server has HTTP port 80 and as soon as you choose HTTP, you'll see here that it is port 80. What if I had a server operating on port 8000? So, it is expecting to receive requests on port 8000. So, in that case, you can say custom TCP and then you can put 8000 and you can select what is the IP address of the other side if you know it. If you don't, you can allow all or you can write down the range. So, it could be 100.0.0.1/32, for example. So, in that case, that means it's only allowed HTTP on port 8000 only to this server IP address. So, you can restrict if you want, but in the outbound, you have to account for every single possible traffic that will leave your instance to the outside, originate from your instance to the outside. If this instance talks to a database, you have to allow that on the outbound. If this instance will talk or you will look to this instance and it try to ping another virtual machine, then you have to allow that on the outbound. If the traffic is originating from the instance, starting from the instance, then the outbound rules has to be either wide open to account for anything, or it has to be detailed enough to account for all possible communications out. So, this is very important to remember. All right? So, that was our quick walk through and of course, you can always go to security groups and you can create a new security group, if you wanted. You can add rules, if you want. Here, by default, on the outbound, it's going to allow all traffic outbound. On the inbound, you can add rules, if you wanted, and it can be SSH or anything else that you you need to allow. You can lock it down to what you want from which IP addresses, or you can write down the IP addresses, if you know them. Put a description, if you'd like, and then save, and that will start the security group. Of course, here, because I didn't add the information, it's asking me for it, so I'm going to skip that for the inbound rules, and I'm going to put a name for the security group. So, mine test SG, and I'm going to allow testing security groups. Anything that describes what we are trying to do. In your case, it's up to you, but here, you will always receive this warning, if you leave things at 0.0.0.0. Now, if I check it out on the inbound rules, no inbound rules. So, what traffic will be allowed to come into this instance through the security group? Based on what we have here, we have no rules explicit. That means we have zero allows, which means, if traffic is coming, originated from the outside, coming through the security group, it will be dropped. No matter what the traffic is, no matter where it's it's coming from, because the implicit deny is the only rule that exists in this security group now on the inbound direction. How about if the instance would like to communicate from the instance to the outside? So, let's check what is the outbound rule. It allows all traffic. All protocols, all port ranges to any destination. So, any traffic going out from the instance through the security group, no matter what the port is at the destination, no matter what the IP address is at the destination, will be allowed. So, in that case, it's wide open on the outbound. For traffic coming from the outside, it is wide widely locked. There is nothing that is going to pass. What if traffic from the instance, let's say ping. I'm on the instance at the prompt, and I'm doing ping 8.8.8.8, and assuming that the internet is accessible to the instance. So, the instance is on a public subnet. So, the traffic will go out, it will reach Google 8.8.8.8. They will formulate the response and send it back. So, it will come on the inbound of the security group. Do you think it will pass or it will be dropped? The response coming from 8.8.8.8 to me. The answer is, remember that the security groups are stateful. They have memory. So, if anything was allowed in one direction, the response to that traffic will be allowed, no matter what. So, in this case, the ping response coming from Google back through the security group, despite the fact there are no rules on the inbound, it will pass and the instance will see it. All right, so that is the statefulness of the security group. All right, let's go ahead and do some practice on security groups and stress the facts that we have mentioned. So, we have practice number one, and this is for inbound rules, and you are required to explain what this means. So, we have a virtual machine with a security group, and the inbound rules look like this. The first rule is talking about type of traffic HTTP, and the protocol is TCP, the port is 80, and the source is 0.0.0/0 means from anywhere. Anywhere could be from the same subnet, could be from the same VPC, could be from the internet, could be from another VPC. So, I don't care where it's coming from, basically. Here, it says, if it is headed to port 80, and that's HTTP, I don't care where it's coming from, allowed. And remember that we don't we don't write allowed here, because there is an implicit deny at the end. The second rule we have, we allow SSH on port 22 from this specific IP. And why we are saying specific IP? Because it's /32. That means only this IP. So, explain what does this mean? If you want to go ahead and pause, think about it, decide what it does, and then restart or resume the video again in order to see the answer. All right, so what does it mean? It means for HTTP port 80, anyone can access the instance over HTTP. Anyone can send inbound traffic to the instance over port HTTP, and no matter what the source IP address is, it will be allowed. For the second rule, it states that for port 22 TCP, SSH, only this IP address 192.168.1.10 can SSH into the server. And this could be the IP address of the administrator who is allowed to get into the server, or the machine that is allowed to be used by the administrators to SSH into this instance for administrative purposes. Here is another one, and this is for outbound. So, explain what this means. Outbound rules, type all traffic, all protocols, all port ranges, 0.0.0.0, and that's outbound, not inbound. Outbound means the rule will apply for traffic going out of the instance, initiated or originated at the instance and moving outside. So, what do you think? Pause, if it's not clear, and try to go through it, and then resume to watch. So, this means the server can send, or the virtual machine can send traffic, any traffic, anywhere on any port. For example, download updates from the internet. Is this a recommended setting? The answer is no, but this is the default setting in AWS. They allow everything outbound, and they lock everything inbound. Number three, here's another example, inbound rules that we need to explain what it does. Here, we have SSH, TCP, port 22, from anywhere, and it's inbound. So, we are talking about traffic coming this way. So, anyone can try to SSH into the instance. I think that was obvious and easy, that's why I didn't ask you to stop and resume the video later on. Practice number four. There is a custom TCP. So, that's not a standard port, and the port is 5432. And we're talking about outbound rules. Destination is 10.0.2.0/24. Please remember that for the outbound, both the ports and the destinations are on the destination you are headed to, not on the virtual machine itself. So, what does this mean? Here, we we just have a a drawing for a subnet with this same range, assuming that this is within AWS. It could be outside AWS. Okay, so 10.0.1.0/24 is where the instance in question is. So, this is applied to instance A. We're not talking about this one. So, this is where the security group is applied, and now we are look looking at outbound, and this is only allowed, if it is going to 10.0.2.0/24, and on a specific port, which is 5432. Interpretation. This server, which is instance A, can connect to 10.0.2.0/24. So, any instance within this subnet. This is not a /32. /24 means I have 254 usable hosts that I can send the traffic to. Of course, in AWS, you have the first and last, the broadcast IP and the subnet ID, and the first three more IP addresses, so the one, two, three as well. These are not allowed, these are reserved. So, now, if you have 251 IP addresses usable, then you send the traffic to any one of them on this port, and things will be allowed. Of course, this is outbound here. If it's not allowed inbound in the security group here, it will not be functioning. Although it went out of the security group here, but it was blocked here. So, you have to allow the rules that are on security groups or security firewalls along the path, not only at the source. All right, practice number five. Custom TCP protocol is TCP and port range and source. Source means this is inbound rule. All right, so always keep in mind. So now I'm talking about traffic that will be coming into my instances and the source is 10.0.1.0/24. And that's custom TCP. It's a little bit confusing. Pause the video, think about it, and then resume to watch. So the subnet where the security group and the instance are is 10.0.1.0/24. And now we are looking at the inbound rule, let's say at the security group of this instance, for example. So I'm going to allow TCP port 3306 on the instance. So 3306 is a port on the instance, and that's a database port well known. Only if the source IP address that sent in the request was within the 10.0.1.0/24, but that is my subnet. So this rule means we will only allow access to the port 3306 on the instance if the request was coming from within the subnet. So another virtual machine, another instance within the subnet, then we are going to allow it. And that's the interpretation. So only EC2 instances in this subnet can connect on port 3306, which is MySQL database, and that is the most used database on the internet. All right, so hopefully that was clear. Inbound and outbound, watch it, remember that it is stateful, and always draw your flows until you get your head around it, and then you can do mind mapping to the flows and all that, and decide what is right and what is wrong. All right, let's go ahead and do an in-depth security group practice, and we're going to involve virtual machines in order to know more and understand security groups much better than we did on the slide. So let's understand it hands-on. Let's get our hands dirty working with security groups. So we want to do a setup, a lab, hands-on lab in AWS that will be used for us to test and ping and SSH and all that stuff, and see if it works or it doesn't work. All right, lab setup, step number one. We need to create two security groups, and we'll use the names security group A, security group B, and leave the default settings. And we're going to walk through the default inbound and outbound rules configurations on this default settings. So let's go ahead and do that first. All right, so I need to create two security groups. Let's find easy. Security groups. We are going to name them SGA for the first one, testing security groups, and this is going to be in the custom VPC. We're going to do everything in the custom VPC. Inbound rules, I was told to leave it at the default. Outbound rules, leave it at the default. So I don't need anything else. Create. And now I need to create a new one. So I'm going to go back and create a security group, and I'm going to call it SGB as instructed, and testing security groups, and again in the custom VPC. If you create a security group in a VPC and you go to another one expecting that you created it in the second one, you will not see it. So security group as a resource is tied or confined to a VPC. It's not confined to an account where you can use it however you like. That's why they are asking me where should this be created. And leave everything to the default as I was instructed and create the security groups. All right, let's check. Since both are identical, let's check one of them, SGB, for example. So on the inbound, there is nothing allowed. On the outbound, all IPv4, all traffic, all protocols, all ranges to all destinations is allowed. All right, that sounds good. Let's go ahead and check step number two. So in step number two, we are going to create two virtual machines, two EC2 instances. One is called instance_A, so we have to use this name, and the other is called instance_B in the public subnet or subnet one public. This subnet is in the custom VPC as well, the same VPC where we have created the security groups. All right, what else should we know about these instances? Create a key pair for each instance, use the instance_A key and instance_B key for the key pair names. Ensure that a public IP address is assigned to each instance. Okay. And associate instance A with SGA and instance B with SGB. All right, we can reference that if we forget anything. So let's go ahead and create the two virtual machines. So I'm still in Ohio. What I will do now is I need to go to EC2 dashboard. If I click on this, it will over it will open in the same tab. So I can right-click on that and open link in a new tab. And if you look at the top here, a new tab will open now. So now I have access to the EC2 dashboard, and if I switch tabs, I still have access to the VPC dashboard. So let's go under here and launch instance. We are going to create the first one. So let me enlarge this a little bit. So this is going to be instance_A, instance_A, and I was not told what's the operating system, so I'm going to go with Linux, Amazon Linux, free tier eligible AMI, Amazon machine image, or the OS of that instance. I'm going to stick with T2 micro. I was not told anything, so I'm going to use the free ones. And of course, if your account is old or if you have run out of the AWS credits, these prices are going to apply to your usage depending on which operating system you are going to use. In my case, I'm not changing anything. Key pair for the first instance, this is instance A. I'm going to create a new one, and I was told to use instance_A instance_A_key for the name. And as you can see, it has been downloaded to my laptop. For network settings, I'm going to click edit. I want to make sure that it's going to be in the custom VPC to be able to use the security group. So custom VPC. And for the subnet, I want it to be in the public subnet, sub subnet one_public. And enable the assignment of an IP address, public IP address, and I'm going to select an existing security group, and that would be SGA. And there is nothing else that I'm told to do. Just a quick review, instance_A, Amazon Linux, T2 micro, free tier eligible, the key pair as instructed, I've used the same name. Network settings, custom VPC, and the subnet is subnet one public. Security group is SGA. So I've done everything as instructed. Are we done? No, we are not done. We still need to create a second instance, and we are given the details for that one as well. So I'm going to do instance_B. I'm going to copy this one, it will help me do things quicker. Amazon Linux and T2 micro, and for the key pair, I'm going to create a new one, but this is going to be instance_B key. And create, and you will see that it has been downloaded as well. So I have instance_A key and instance_B key both downloaded to my laptop. I can click here or click the folder and it will bring it up. It will open the folder and I will see where that is. But in my case, I'm sure that it goes automatically into the downloads folder. In your case, most probably it's going to be also in the downloads, but you need to go and check that. Or when you see something like that on Windows, just click on the folder and it will open it up on the side to you, so you will know exactly where it went. Network settings, I'm going to do edit, custom VPC, and for the subnet, again the same thing, the public subnet. So both they are going to be in the same subnet, which implies they are in the same availability zone. How did I know? Subnets do not extend beyond an availability zone. Select an existing security group, and I'm going to go in this case with security group B. And there is nothing else, quick review, instance_B, it's Amazon Linux, T2 micro, and the name of the key, custom VPC, it's in public subnet one, and this one, see? Always there is something that you may forget. After nine or 10 years now with AWS, and I still rush things. So please be patient and don't rush things. Of course, as you grow in your career or as you grow in your cloud or network or anything, you will know that in the cloud, we actually do not usually work with manual stuff. We build scripts, infrastructure as code using Terraform or CloudFormation, and we submit these codes, and it has everything we need to do, and we don't need even to log in to the console. But, that we will learn as we go. So, security group B, everything looks fine, and the IP address is enabled, everything is cool, so let's launch the instance. So, now I have the two instances created as per the specifications I have been given, and this is what usually a cloud engineer would be doing, whether it is manual or through the Terraform script or CloudFormation script, you will be building infrastructure resources so the developers can use them, and the application architects and application engineers and the software engineers can use it to test and deploy software. All right. So, now we have the two instances, hopefully, up and running. Let me just minimize this a little bit. So, I have instance A, instance B. What do we need to do now? Verify that the correct security group is associated with the correct instance. So, I need to find out that SGA is with instance A, and SGB is with instance B, and that's very easy to do. So, all I need to do is click here, and under the security tab, this is for instance A, I'm going to scroll down, and I will find that security group is SGA. And if I switch this tab, I'll find that security group on instance B is SGB. So, all good. We have the security groups, we have everything, so now it's time for us to start testing. So, what we have achieved now is I have instance A, instance B, and I have applied SGA on instance A and SGB on instance B, and they are both in the same subnet. Okay, so what do we need to do? From your laptop, from your machine, you need to try and SSH into instance A, and can you do that? Yes or no? And why? So, from your laptop, this is SGA. From my laptop, through the big eye, the beautiful internet, and of course, this is all inside AWS, we need to try and SSH into instance A. So, I'm going to send SSH request through the security group A. Would that reach the instance and be successful or not? That's what we need to test. In your case, you will do it in the command prompt if you are using Windows. Forget about PowerShell for now. Command prompt, CMD, as we have seen in other labs. And in my case, or if you have a Linux machine, you're going to do it from the terminal, or you need to get into the Linux console and do it from there. But, let's grab the command first. So, I'm going to go into instance A. I'm going to click on connect, and SSH client, and here are the commands. So, this is the command that I need to see if it works or it doesn't work. So, let's try. I'm going to go back to my terminal, I'm using Mac. Okay, so now just clear. So, here we go. Let's paste the command, and I'm going to hit enter. What do you think will happen? Why are we waiting? So, nothing is happening. What do you guess is happening? So, the question was, are you able to make it? Are you able to connect? And if yes or no, why? What do you think? What do you think the reason is we are unable to get a response, and we are just waiting, and we'll keep waiting and waiting and waiting, and it will time out. The request is going to time out. If you ever get a time out, that indicates for some reason, the request has not reached the SSH server on the instance, and that's why you did not get a response. If the request reached the SSH server, you're going to get a response, and it could be a positive response or a negative response. But, if it times out, as you can see here, that means it has timed out because the security group, for some reason, or the security in general, blocked it. In our case, it must be the security group. Let's go back to the VPC, and let's look at This is instance A, so it must be SGA. So, let's go back to the security groups. I clicked on the VPC, I'm now in the VPC dashboard, and if you look at SGA, let me just shrink this down a little bit, or maybe just minimize this a bit. So, SGA, here we go. SGA on the inbound, let's take this one up. It has no rules whatsoever, no rules. So, definitely it's not going to allow SSH in, it's not going to allow ICMP, it's not going to allow anything. Let's verify. So, let me try and ping the IP address of the instance, which is 3.140.186.254. So, 3.1 40. 186.254. Request time out, request time out, request time out, request time out. Of course, and if you try anything else, it will not work because it's not going through the security group, it does not reach the instance. The response to ping must come from the instance. The response to SSH must come from the instance, and if the request is not making it to the instance, the instance doesn't know anything about it. And why it is not reaching? Because the security group is dropping it. So, if if we go back here, no, I can't, and we know why we can't. So, if we SSH from the instance to instance B, can we? And why? And the answer is, of course not. You want to try it? Let's go ahead. Remember that the two security groups are identical. So, if we look at SGB, which is this here, on the inbound, same thing, nothing. You want to try it? Okay, fine. Let's verify. So, I'm going to go back to instances, and this time I'm going to go to instance B, and I'm going to click on connect, take the command, this is for instance B, and I'm going to try SSH, and the same scenario is going to repeat. So, different IP address, different instance, security group has exactly the same configuration. So, you're trying to do the same thing with the same configuration. What do you expect will happen? It's going to be the same result, for sure. So, leave it to time out, and let's go back and see what do we need to do now. Add the SSH from anywhere to the inbound rules in SGA and SGB. All right. So, I'm going to go back to the VPC dashboard, and this is SGB. Let's do B first. Edit inbound rules. I'm going to add a rule that is going to allow SSH, very specific, and I was told from anywhere, and we can write here allow SSH inbound from anywhere. These descriptions will be helpful as the number of security groups and rules you have will grow to let you know what is this rule doing exactly. So, save rule, and that was Need to double-check that was in the inbound direction, and that is taking place now. So, it's IPv4 SSH TCP, port 22 from anywhere. So, we need to do the same, as instructed, for SGA. So, that's the inbound, nothing in here. Edit inbound rules, add rule, and also we're going to go do SSH from anywhere, and again, the same thing. Allow SSH inbound from anywhere. Okay. Save rule. Make sure that it has taken place. So, SGA, and look at the inbound, and it looks like it is configured as expected. All right. So, what do we need to do now? So, that is done. SSH into instance A. Can you? Let's figure out. So, I'm going to go back to the tab of the instances. I'm going to go to instance A. So, let me grab instance A, click on connect, and SSH client, let me go to the last, and copy it. Now, see? The request now. Oh, this is B, sorry. So, B, before it timed out, we have put the rule in, and now it has been accepted, so yes. And of course, we have a problem. It's unprotected private key file. So, let me clear this one. As per the instruction, I need to try A now. So, see, the response is very quick because it has reached the instance. Yes, and then we get the same error, unprotected private key file. So, what do I need to do? We need to do the chmod, and for the key name and all that. So, instead of typing, I'm going to copy it. We need to do this in order to make the key private, not public. So, I'm going to go back, paste, and hit enter, and then try the SSH again. The up and down arrow repeat the commands, the previous history, I mean. So, this one looks like it's going to work now. And as you see here, let me do a clear. I am now in the instance as the user EC2-user on the IP address 172.31.4.157. How can we tell that this is the right IP address? Let's go back to the instance. Click here. And look at the private IP address 172.31.4.157. 172.31.4.157. So, now I'm in instance A. So, this was successful. Exit. And what we need now is we need to try to SSH B and see if it works. So, this is it's SSH and this is still A. This is B. 3.148.115.161. So, this is instance B. Enter. And again, the same problem. We need the chmod command. So, I'm going to Let me just grab this one up. And let's do a clear. I'm going to repeat. And chmod, the only difference is this used to be key B. I'm trying to save time, but if you wanted to know the exact one, then you can go here. I can go to instance B. Connect and copy. And then go back. So, I'm going to delete this completely. Just hit enter and get an error. Oh. Exit. Quit. Control C. Yeah. So, here I am. I'm going to do control V. Enter and then repeat the SSH. And now it should work without errors. See? Let's clear. All right, so hopefully that is clear. What else do I need to do? SSH into instance B. Can you? Yes, I can. So, we could do both of them. We are still with firewalls as network devices and we're going to look at another example in AWS cloud, which is the network access control list, abbreviated knuckles or NACLs. So, the knuckle or the network access control list is again a layer four firewall. It doesn't understand the upper layers, the application and so on. And it applies at the subnet level. Before we proceed and we continue, please note, the network ACLs part is an optional part for those who are not getting into cloud engineering, who are not getting into network engineering and network security. So, that is optional. You have already knew what a firewall is and what it can do by learning the security groups. So, if you are not planning to specialize in one of these three specialties, I think DevOps and ML Ops to an extent are also included, then you can skip this part. But if you are going to learn the AWS cloud and you're going to build infrastructures in the AWS cloud, no matter what your role is, even if you are a developer, then network access control lists are very important because this is part of the security and depending on what you are developing, it can be a mandate, not an optional thing to configure and lock down your network ACLs. All right. The network ACL is a virtual firewall that functions at the subnet level. Remember we discussed the security groups and we said that security groups apply at the instance level, at the virtual machine level. Now, we are talking about the subnet level. So, whatever is going to be allowed through the firewall, in or out, that will be at the subnet level. Whatever is going to be blocked from getting in or going out, it will apply to all the virtual machines in that subnet. So, this is very important to note. The scope of the ACL is the subnet with everything inside that subnet. So, the network ACL decides what goes into the subnet and what comes out of the subnet. The network access control list rules are numbered, unlike security groups where we just created rules, these ones have numbers. And the inspection, when there is some traffic and we need to decide, the network ACL needs to decide whether to allow it or deny it, it starts the investigation at the lowest numbered rule and then the next until a match is found. Once a match is found, it stops the search and then a decision is made. And we can configure allow and deny rules. Here's an example. I have rule 50, rule number 50, rule number 90, rule number 100 and then an asterisk. This one is an explicit deny. If no match is found, then there is a deny at the end. Parameters or variables that we configure, the type of traffic, SSH, HTTP, all ICMP, all TCP, all UDP and so on, the protocol, what is the port or port range and what is the source. So, this one, for example, is for inbound rules. If it was outbound, it will be destination. And then we have allow or deny. So, what is the action if there is a match. The security group functions at the virtual machine level. And we are saying that the network ACL functions at the subnet level. Where does it take effect? And the answer is it's at the implied router. Remember we said each subnet is automatically connected to the implied router. So, the best location to oversee the entire subnet is not to be inside the subnet. It is configured at the implied router and it functions at the implied router. The impact of the network ACL is applied or applicable to all instances in the respective subnet. So, for example, if on this network ACL, we said there is no permission for any HTTP to go into the subnet. But here I have a web server. So, this was a Let's say a database server, but this was a web server, a website. And the website is listening on port 80, which is by default HTTP. If you deny HTTP, it will apply to all the instances. For this one, it doesn't matter. It's a database and it functions at a different port, not HTTP 80. But for this one, what you have just done by denying HTTP to go into the subnet, you have denied any traffic from reaching this web server. That's why this will be broken. Having a network ACL configured, you need to make sure that at the network ACL, you apply the generic traffic that should be allowed or denied across the subnet. Then at the security group level, you can confine, you can refine the allow uh statements to what this virtual machine should receive and then the rest will be implicitly denied. Directions of traffic. If the traffic is going into the subnet, so coming from the router and it should pass through the firewall to go into the subnet, this is inbound. Ingress to the subnet. If the traffic is coming out and it should pass through the firewall to go to the router and then somewhere else, that is outbound from the subnet. So, inbound and outbound are from the perspective of the subnet. In security groups, we said they were stateful. Stateful means if one if traffic is allowed in one direction, its response will make it through in the opposite direction even if there are no rules to allow it. In ACLs, it's completely different. It's stateful. So, you want to SSH into a server, then you have to allow through the ACL SSH in the inbound to the subnet where the server is. You have to allow the response from the virtual machine or the instance going out to the user again. So, you have to allow both directions, otherwise it will not function. So, if we want to allow traffic on the inbound, let's say we want to allow all traffic in the inbound, then what we need to do is we're going to have a rule numbered all traffic from all sources allow. If you don't do this, it's going to hit the explicit deny and it will be denied. And in the outbound direction, you have to have a rule that will allow traffic as well. Here it's allowing all traffic to all destinations. If you don't allow it, it will hit the explicit rule. Do you have to do allow all, allow all? Of course not. You have to lock it down to what is permissible. This is a wide open network ACL on the inbound and outbound direction and this is not a good security practice, although it is the default in AWS. Why do we need the network ACLs if we already have security groups? We add an extra layer of protection at the subnet level. So, you have the security group at the virtual machine level and you have a second layer of defense at the subnet level. Also, if you would like to deny specific traffic, let's say we figured out after investigation that there is a specific range of IP addresses coming from a specific country and that is malicious that always tries to hack into our website or our network or our VPC presence. We would like to deny that traffic completely and allow the rest of the internet. So in that case then since we can do deny and allow, I can have a rule in the inbound to deny the range for any port for anything and then afterwards, let's say the first one is rule number 100, the second will be rule 110 or 200 and it will allow traffic from anywhere else. Also, if you want to block IP ranges at the subnet level and you are working on a compliance heavy environment where they need multiple layers of protection or firewalls. Let's go ahead to the AWS console and have a look at the network ACLs, how they are configured, what parameters are there and what are the default settings in the default network ACLs in AWS. So here I am in the AWS console. I want to go to the VPC dashboard and I want to go under security and here is network ACLs. So we have an ACL. Here is the ID of the ACL, no names and here's another one. This one is applied to four subnets. This one has applied to three subnets. I'm still in Ohio. It's a default network ACL, so which means created by AWS. I did not create it. And this one is in the default VPC and this one is in the custom VPC. So let me go ahead here and write down some labels that will help me. Custom VPC and this one is default VPC. Always the tags or the labels, they will help you as you work through uh your exercises and projects because you want to quickly identify the resources that you would like to check, troubleshoot, manipulate, edit and so on. Okay, so let's look at the default VPC network ACL. And here is the ACL. Let's look at the inbound rules. Here you'd see at the inbound, all traffic, all protocols, all ports from all sources is allowed. So all the traffic coming inbound through this ACL is going to be allowed inbound, no matter where the source it's coming from is. And on the outbound rule number 100, all traffic, all protocols, all ports to all destinations. Outbound means it's leaving the subnet to a destination. So all destinations, so that means the virtual machines on this subnet can send traffic to anywhere on any port. Basically, the inbound and outbound by default does not filter anything at the network ACL level. Is this a good security practice? The answer is no. You need to lock it down. You need to identify what is allowed outbound, what is allowed inbound and lock it down to that and don't be generous when it comes to security. And this VPC network ACL is applied to three subnets and these are the subnet IDs and these are the default subnets in the default VPC which we did not create them. How about the other one? So this is a default network ACL in a custom VPC. Let's see how different that would be. So actually on the inbound, there is no difference. It's exactly the same. And on the outbound, there is no difference. It's exactly the same. Please note that it is the destination in the outbound, the destination IPs and the destination ports like in security groups. For the inbound, it is the destination ports in the subnet, in the virtual machines in the subnet, but the source is where it came from outside the subnet. So the source in the inbound is where it came from, from the outside to the subnet. And this one applies to four subnets and these are the subnets that we created, subnet two, three, four and subnet one public. Remember in custom VPCs, there are no default subnets. You have to create the subnets. So these are the ones that we created. Now if I want to associate a VPC network ACL with a subnet, then you can go into subnet associations, you can edit and then you can identify which subnets are going to use this ACL and which will not. Since I have only one ACL all the subnets will have that ACL applied to them. So it's like route tables. If you don't create custom route tables, there will be one main default route table for the VPC and that will apply to all subnets in the VPC. Same thing for the ACLs, it's one default ACL per VPC that allows all the traffic in and out and it will apply to every subnet that you create unless you start creating your own custom ACLs and you start associating them with the relevant subnets that you want. All right? So these are default settings. Network ACLs don't filter anything. So this is how it is. Let me just go back. What if I need to add a rule or change a rule? You can edit. So this is on the inbound direction. Where do you want the rule to be? Please remember that the inspection always happens when there is some traffic coming in into the subnet. This is inbound. Coming into the subnet then it will always start the inspection from the lowest numbered rules. So if you want to add a rule that is going to be inspected first, you have to add a rule number that is lower, not higher. So 50 for example and then allow or let's let's say that this one is going to deny SSH from a specific IP. So let's say deny and we're going to add 100.1.1.10/32. So that's a specific IP that should not process or should not access SSH into the into their subnet. So when we look at the rules now, you'll find that it has been sorted according to the rule numbers. Let me just minimize this a little bit so I can drag it up and you can see it. All right, so I'll keep it large. Inbound rules, it has a new rule, 50 and that's for SSH TCP port 22 and the source is this specific IP will be denied. Now what about the rest? What if another a different source IP tries to SSH? Then this rule will not match, then it will skip to the next rule which is allows all traffic. So anybody else will be able to SSH and anybody else will be able to do all the other ports and even this IP address can do HTTP, can do ICMP, can do a lot of things but not SSH. So doing so and the fact that we can have deny rules more specific, we can put the denies at the top and then the rules that will come after will define what is allowed. So this is how flexible network ACLs can be. So hopefully this is clear and you have seen how we can edit rules and we can do the same thing for the outbound as well. So you can do edit rules for the outbound and then you can add what's to be denied and what's to be allowed. Please remember that network ACLs are not stateful. They are stateless. So hopefully this is clear and that was a quick walk through into network ACLs. All right, let's now do some hands-on practice where we are going to demonstrate the fact that the network ACL is stateless and we'll show that we have to configure both sides of a communication in order for that to work. We'll also show the rule numbers and their priority and some other stuff. So let's find out what exactly we are going to do here. If you don't have this done earlier, please create two security groups, security group A and security group B and ensure they allow all traffic inbound and outbound on all ports. Basically, what we are trying to do here is we are trying to show the impact of network ACLs. We're not going to examine what the security groups can or cannot do. That's why we need to have them wide open and they are not going to block any traffic in or out. So if a blockage happens, this is because of the network ACL. If any traffic succeeds is also because of the network ACL. So we can focus on the network ACLs and show their features and what the inbound and outbound rules impact is in network ACLs. So in my case, I'm going to go into the custom VPC. All the work will be done in a custom VPC. And I'm going to go ahead and look at the security groups and I have SGA and SGB. So all I need to do is to make sure they allow all traffic inbound and all traffic outbound. So here I had them do some traffic, not everything. So I will edit inbound rules. I'm going to delete all the rules and I'm going to follow the instruction allow all traffic from any source. That's inbound. All right, and I'm going to go back on the same one. Verify that it allows all traffic from any source on the inbound. And then I'm going to go on the outbound rules and do the same thing. Check. It's actually allowing all traffic from only one IP address, but I want it from everywhere. So, if I do a final check, always a good idea. On the outbound, it allows all traffic from any source and on the inbound it allows all traffic from any source as well. All right, so we are good for SGA for security group A. For security group B, inbound, also we have some selective allows, so we're going to delete delete add rule all traffic from any source. Save. That's the inbound. We need to do the same for the outbound, so I'm going to go again into SGB. Just verify that inbound is correct before we do the outbound. Outbound rule. And there are no rules whatsoever. And we need to add a rule and that will be all traffic from any source. And save. I didn't put any descriptions, but it's a good idea to put descriptions because it will help you find out as the number of rules grow, why did you add that specific rule? Okay, so we did SGA and SGB. Step number two, create two EC2 instances, instance {underscore} A and instance {underscore} B in the public subnet subnet {underscore} one public. Create a key pair for each instance and use the names instance {underscore} A {underscore} key and instance {underscore} B {underscore} key for the key pair names. Ensure that a public IP address is assigned to each instance and associate instance A with SGA and instance B with SGB. So, in my case, I have these two instances created. I'm going to show you how they look like and I'm going to verify that they are associated with SGA for instance A and SGB for instance B. Also, I will show you that we have a public IP for each and I have already done the keys as well. So, if you haven't done it, please go ahead and do it. And for me, I'm going to show you what I have. I'm going to go into the instances all the EC2 instances and you can simply do that EC2 and then right click open in a new tab. I have it open already. So, here I have two instances, instance A and instance B. They are both in the stopped state. So, what I will do now is I'm going to start them both because we need to use them. If we need to verify what configuration they have, this is instance A. So, it has a public IP. It has a private IP. And if we go in under security, you'll see here that SGA is allocated to instance A and you see that on the inbound it allows everything from any source and on the outbound allows everything from any source as well. If you want to connect to to this instance, you'll find that the instance A {underscore} key pem is the key and we need to do the key to make it private if you are using Linux or Mac. And this is the command to use in order to connect. All right, so this is instance A and instance B is exactly the same configuration, but with instance B and the key name is instance {underscore} B {underscore} key. And if you verify quickly, security group SGB and it does have details, public IP, private IP. And we have we can look at the key pair name from here. So, instance B key {dot} pem. And here is the command if you want to SSH into the instance, all right? And let me check the state of each instance and they should be up and running right now. So, all done. Now, let's do the first test. ICMP test using ping to the public IP addresses. What is the instruction? So, now I have the two instances, instance A and instance B up and running. This is with SGA. This is with SGB. Both are in the same subnet and we're going to do some ICMP tests now. So, from your laptop, ping the public IP address of instance A and instance B. Can we and why? Let's go ahead and get the public IP address of instance A. So, here is the public IP address of instance A. Copy it. This is copied. I'll go I'm going to go into my terminal. In your case, you'll go into command prompt if you're using Windows. So, let me do a ping. And you can see that it works. If I try to B, I'm going to stop it. Let me go into B. And copy. Go back. Ping. And it works. So, now let let's go back to the instruction. Can you? Yes, I can. Why? First of all, the security groups SGA and SGB, they're not filtering any traffic. How about the network ACL? We haven't checked that. We don't know. So, I need to make sure the subnet one public is associated with it which ACL. I need to go and look at the inbound and outbound rules of that ACL in order to be able to respond and say why. So, let's go under network ACLs in the VPC. Security, network ACLs. We have only two network ACLs. This one is the custom VPC one. So, let me click on that. Let's verify that it is associated with public subnet one, subnet one public and it's associated with this ACL. So, let's look at the inbound rules. Inbound rules in the ACL, they deny SSH in, but they allow all other traffic. That's what's happening right now. So, let's bring it to the default. The default usually is that it allows everything in from any source and everything out to any source. Okay, so this is the default on the outbound and this is the default on the inbound. So, why did the ICMP ping work even when we had the SSH denial rule? Because I was sending ICMP and that's why it is still working. As you can see, it is still running to instance B. If I stop it and I start it again, it will still work because the ICMP is allowed through the network ACL through the allow every traffic in and out and also on the security groups allow all traffic in and out. In the network ACL, block ICMP inbound from any source. So, block all ICMPV4 inbound from any source. Okay, let's go ahead and do it. This is the network ACL. I'm going to do edit. And I'm going to do add new rule. To add the rule above 100, so it will be investigated first, or below 100, so it will be investigated after the allow all traffic. Let's try both. Let me try and add it as 150. And I'm going to say this is for ICMP IPV4 from anywhere denied. So, when the inspection happens, 100 will be inspected first and it says allowed. 150 will stop ICMP specifically from anywhere. So, let's go ahead and look at the ACL again at the inbound rules. And this is how it looks like. So, this one will be investigated first, second, and third. If this one has a match, it will not go to the second. It will make a decision, allow, and it will continue. If it did not allow here, then the deny will take effect. So, let's find out if the first one is going to be used or the second one. As you can see, the ping is still ongoing. 120, 122, 124, 126, and so on. So, the ping did not even take effect because the allow at the top was the one that was considered and this proves that rule numbers are extremely important and if one match is obtained from the lowest numbered rule and to the next one to the next one, once a match happens, the investigation aborts with the decision of that rule. So, let's do one thing here. Let me go again on edit and what I will do is I will make this 50 only. So, the deny rule will be above the allow all traffic. So, this is how it looks right now. And denied. So, let's go ahead and check. You'll see that the rule or the ping has stopped. Why? Because now it has investigated the first rule, which is ICMP denied. And that's why it stopped. If I remove that rule, everything will work again. And let's try one thing more before we change it. So here I was pinging, this is the IP address of instance B, the public IP address. Let me try the other one, this one. This is for A. It will not work as well. Why? Because the network ACL is blocking ICMP from anywhere to go anywhere into this subnet. So A, instance A and instance B are in the same subnet. So whatever the network ACL decides applies to everyone in the subnet. If it was allowed, then everything everyone is allowed. If it was denied, everyone is denied. So what happened to the ping? It stopped when we blocked it with the rule number 50. With the 150, it did not stop it. From your laptop, try to ping again to instance A and instance B's public IP addresses. It's not working, we tried. Okay, let's do one more thing. Instance A and instance B, we tried from the outside and we saw the impact of a network ACL rule. What if I block ICMP inbound and I block ICMP outbound and I try to SSH into instance A and ping instance B private IP. So they are both in the same subnet. Is that going to involve the network ACL or not? If the two instances are within the same subnet, will the traffic go up to the implied router where the network ACL is and then come back or would it flow internally with complete ignorance of what the network ACL does? We need to block ICMP ping from any source inbound and outbound and we are going to use rule number 50. And we are going to allow all other traffic inbound and outbound with rule 100. So I think for the inbound we already have this done. So let's do it on the outbound. So for the inbound, I have rule number 50 denying ICMP from anywhere and I have rule 100 allowing traffic from anywhere. On the outbound, I need to do the same. So I'm going to edit and I'm going to add rule number 50. And this will be for ICMPV4 from anywhere and that would be deny, not allow. ICMP version 4 from anywhere uh deny. So when we look at it, it will look like this. So ICMP in and out of the ACL is going to be blocked. However, any other traffic from any source will be allowed. That's how it is now, inbound and outbound. All right, what do we need to do? So this is done. SSH into instance A. Sure. So I'm going to go into instance A. Get the SSH rule from connect SSH client and I'm going to copy this. So let me stop this failing ping. I'm going to clear the screen and then SSH into instance A. Yes. And here we go. I'm going to clear the screen. So now we are into instance A. I'm going to elevate the permissions to the root level, super user. Okay, what do I need to do now? From instance A, use ICMP ping to the private IP of instance B. So I want the private IP of instance B. Instance B the private IP is this guy right here and I'm going to ping it. And it is working. So the network ACL in the subnet where both instances A and B exist is blocking ICMP inbound and blocking ICMP outbound from anywhere. However, when I'm inside instance A, I'm at the prompt of instance A and I try to ping instance B the traffic is successful, which implies that the network ACL has not been checked at all. It has not intervened in this communication and the reason is that you need to keep in mind, when will the traffic from the subnet go through the router? It will only go through the router. Let me draw it here. It will only go through the router when the traffic needs to leave the subnet or if the traffic from outside is coming into the subnet. In our case this is all local to the subnet. So the traffic goes out and goes in here. The response goes out and comes in here. So the network ACL is not involved at all. The implied router is not involved at all. That's why it was successful. So this is a very important thing to keep in mind as well. So we looked at the rule numbers, but we find let's find out what is this about. SSH from your laptop into instance A. Can you? Why? Yes, I can and I know why. SSH from your laptop into instance B. Can you? Why? Because the network ACL is allowing it. What else? Now on the default network ACL in custom VPC, add a rule to block SSH from anywhere with rule number 50. All right. I'm going to go into the network ACL and I'm going to add a rule that will Let me make sure that whether we need this one or not, but let me add that rule first. Add a new rule, let's say it's going to be 75 or 80, 70. Should block SSH from anywhere and that should be a deny. Save changes. So now there is an allow all traffic, which is number 100 deny SSH which is number 70 and deny ICMP which is number 50. All right. To block SSH from anywhere, we'll do it number uh 50. I cannot do it because 50 is taken. Okay, so let's proceed and see. Try to SSH again into instance A and instance B. Can you and why? Let's find out. So now I'm going to stop this. See, I'm not connected at all and 143 142, this is not running anymore. I lost the connection. The SSH connection is lost. So what do I need to do? I'm going to open a new terminal. So shell new window and from here I want to try and SSH into instance A again. So let me close this one. Terminate and I want to SSH into instance A. Go back, instance A, connect copy and control V. I need to go into the right folder first where the key is. CD downloads. That's where my key is. And then I'm going to do control V and SSH. And do you think it would work? I don't think so because rule number 70 is where the SSH blocked and rule number 50 is ICMP blocked. So it will hit number 70 before it goes to 100 that allows everything and that's why I won't be able to. Control C. So I couldn't because the network ACL is blocking it and that's why I couldn't. From your laptop, use ICMP to ping the public IP address of instance A. Can you and why? In my case, I'm not going to be able to because I have rule number 50 and rule number 50 is denying ICMP from anywhere. That's why I will not be able to. However, if we remove rule number 50, then we will be able to ICMP ping, but we are not going to be able to SSH into the in So that's the case here. All right. Network ACLs are stateless. So this test is going to show us that fact. In the custom VPC network ACL allow all inbound traffic from any source. Okay. So let me go and clean up that one. So we're back to the ACL. I'm going and this is inbound. I'm going to edit. I'm going to allow all traffic from all sources. So I'm going to remove the deny, remove the other deny and this one will take care of allowing all traffic from any source. What do I need to do? Delete the rule in the outbound that allows all outbound traffic. But before I do this, let me check if I will be able to SSH before we do the the delete rule and then we will find out after removing that if we can or we cannot. So let me from here try the SSH first to make sure that it works and after I make sure that it works, then I can try. Yes, it works. So now I know that it works. I'm going to exit. So I'm back to my prompt. Clear. Back on my laptop. Now I will do what was requested, which is remove the rule that allows all outbound traffic. So I'm going to do edit and I'm going to remove this and this. So the only rule that exists is the explicit deny all. As you can see now on the outbound, I have only the deny rule and on the inbound, I have allow all. Why are we testing this? Because I will show you that if the traffic is allowed in one direction, but the other direction is blocked, then the entire result or the whole result, the end result would be the traffic is blocked. Let's verify this. Go back and I'm going to try and SSH again. And this will not work. Why? Because it reaches the instance, but the instance's response is blocked at the network ACL. Why did it go through the network ACL? Because my laptop is connected to the internet. So, that is outside the subnet where the instance is, so it has to go through the ACL. The general rule is if the traffic leaving the instance is going outside the subnet where the virtual machine or the instance is, it has to pass through the router. That means it has to pass through the network ACL of that subnet. Okay, so it will time out and it will not work. For obvious reasons, it is not allowed because it was blocked. All right. What I will do now is I'm going to go and clean up the network ACLs and make it again like the default. Allow all traffic in, all traffic out. All right, so inbound looks good. Outbound, I'm going to bring back the rule that we have removed because otherwise, nothing will be flowing in or out of this subnet. So, I'm going to use rule number 100 for all traffic. All traffic, all sources allow. And just to verify, can I SSH? I should be able to. Yes, I can and that is enough to make sure that it went back to normal. Clear and we are good to go with this hands-on lab. In module nine, we are going to learn important IT services and observability as well. It's good to have the infrastructure up and running that you have built or the network and so on, but it's more important to know that it's functioning properly. So, you need to have monitoring in place to monitor the infrastructure or the network or whatever you have built in real time. Make sure it is performing as expected and if not, then send you notification or alerts. Also, for compliance reasons and for troubleshooting purposes, you need to have logs. You need to have the history of events that happened in your infrastructure or application or network and these are called logs. Also, we are going to introduce the domain name system or the domain name service, the DNS. When you type www.cnn.com or google.com in your browser, that is not how the internet works, right? This is a name. All the internet only relies on IP addresses. So, what would translate the www.google.com that you type, which is easier to remember, into an IP address? That is the DNS. So, we're going to introduce that as well. And we are going to have an introduction to databases. So, we have mentioned data in a database. Why do we need a database? What are the types of database? All of this we are going to learn here and we are going to end up with a very important training, which is how to draw professional architecture drawings. So, all of this in this module, lots of stuff to learn. So, let's start with DNS, domain name system or domain name service. As we know, websites, all the internet use IP addresses. However, it is much easier to remember names than remembering IP addresses. Imagine if you had to memorize the 15, 20, 30 common websites that you go to all the time and you had to maintain and memorize their IP addresses, which would be a nightmare. For example, here we have a web server, www.dolphinedacademy.com or dolphined.com and this is the corresponding public IP address. When you want to go to dolphinedacademy, you're not going to type the IP address because you don't know it and you're not going to search for it, but you know that it's called www.dolphined.com or maybe you have it saved in your preferred domains. So, you click on that and then magic happens in the background to find out the IP address and then a packet will be formed and that will be the destination IP address in the packet. And since it is easier to remember names than IP addresses, the domain name service are the translator, the interpretation of domain names into IP addresses. That is what DNS is all about. So, here's an example of a DNS server. Let's say the server of the DNS, the IP address is 1.1.1.1, just hypothetical example. And it will maintain a database and here is a snippet of the database. dolphined.com, this is the IP address. example.com, this is the IP address. marketing.abc.net, this is the IP address. And of course, it has a huge database that involves all of the known domains and subdomains in the internet. So, if you want to visit dolphined.com, what you need to do is you are going to use the internet and you are going to use DNS. But, how would your laptop know which DNS IP address to send the request to? It's called DNS query. Any client that will be configured, your phone when it connects to Wi-Fi, your laptop when it connects to Wi-Fi or any other network, it will have a DNS server configured and this is automatic from the Wi-Fi device. So, you will get an IP address and you will get also the DNS configuration. Or maybe it is static configuration on your laptop or your device. So now, when you want to go to dolphined.com, you go in your browser and type dolphined.com. Now, in the background, the browser is going to formulate a request, a DNS query, and it will send it to the IP address of the DNS server configured. Can I please have the IP address of this subdomain, www.dolphined.com? Now, the DNS will check its database to find out that it has it and here is the IP address. So, it's going to respond and say, here we go. The DNS response, the IP address requested is such and such. Now, the browser and the IP stack on your machine, they know the IP address, the destination IP address, and they will form the packet and send it to dolphined.com. Of course, the internet is going to forward that because as we knew and as we learned that the internet knows how to get to any public IP address anywhere in the globe. Now, how can I find out on my laptop, whether it is Windows or Linux or Mac OS, how can I find out the DNS configuration? What's the DNS server that I'm using? And also, how can I find out the IP address of a specific DNS? Let's say that I want to find out what is www.dolphined.com. What's the IP address corresponding to it? Or cnn.com or google.com. Then, you can use the command nslookup and the name or the domain or subdomain you would like to look up. If you would like to find out about the IP and the DNS information in your machine, if it is Windows, you can use ipconfig /all. If you are on a Linux system, depending on what type of Linux system, which distro are using, then you can do cat for the etc/resolv.conf file. Cat means show me the content of that file without opening or editing the file. Linux also, systemd-resolve --status or --status. This is for systemd-based systems. If it is network manager, like Red Hat for example, real, nmcli, all of these are going to give you the same thing. What is the DNS information that you are using? What's the DNS server that you are relying on? All right. So, these are good stuff. DNS server and here's the DNS server as well for Linux and this one would show the domain. Whether it is Windows or Linux, the nslookup will show the IP address of this domain or subdomain that you have typed. Let's go ahead and do um demo and show you DNS in action on an AWS Linux EC2 instance. So, we need to have a Linux instance in AWS. It needs to be in a public subnet and we need to ensure that it has a public IP. We are going to associate with that instance while creating it a security group that allows all traffic inbound and outbound and we have one that does that. We are going to SSH into the instance from the console and then we are going to start the testing. So, let's go ahead and create the EC2 instance with this specific criteria and SSH into the instance. So, we are going to go into instances and then create instance or launch instance. I'm going to call it testing DNS. I am going to choose AWS Linux. T2 micro is fine. Key pair, I'm going to choose one of the key pairs that I have. In case if you don't have one, please create one. You know how to deal with them now. I'm going to choose this one, which I've used before. For the network, I want to make sure that it is in the custom VPC, the VPC that I have created and I know everything about, and in a public subnet as requested. And I want to make sure that the auto-assign public IP address is enabled. For the security group, I'm going to select one that I have, which allows all traffic in and out SGA. And that's it. Let me just go back quickly and confirm that I've done everything right. It appears Linux and T2 micro key custom VPC public subnet and enable and I created or selected existing a security group. So, I'm going to launch it. And once I launch it, I'm requested to connect to it through SSH or using SSH. So, what I'm going to do is I'm going to So, once this is highlighted in blue or colored in blue, I can click on connect and I can use SSH to connect. So, let me try from the outside. Uh, here is the instance connect. I'm going to use EC2 instance connect instead of SSHing from my laptop. I'm going to do it through the console. Connect. And you will notice that it will open a new tab for the connection and it shows me here what is the public IP and what is the private IP. And here you go. I'm connected. Elevate the permissions to root. So, as you can see here, it changed from EC2 user, which is the user we used to connect using SSH and now I am root. So, I have all the privileges that I have. Let's find out what we need to do. So, all of this is done. Check the DNS server on the instance. How? We can use the cat ETC resolve.conf or we can use the systemd-resolve --status. So, let's find out. So, cat ETC resolve .conf. And if you look here, this is the line we're looking for. Name server is 172.31.0.2. So, this the DNS server is an IP address, the second usable IP address in the subnet and this is the name server. So, all the queries are going to go into this IP address DNS queries as the server. And that server from AWS or that DNS server from AWS, if it knows the answer, it will respond. If not, it will query the internet, find the answer and send it to you. Or we could have done also the systemd-resolve --status. And it gives me the same information that we have received here. So, if you look at this and you look at this, it's exactly the same answer. We are now sure that there is a DNS configured on the machine and that's how we can get to the different domains on the internet. So, for example, if I do dig www.google.com in the answer section, you'll find that this domain maps to this IP address 17142.250.190.68. And also I can do NS lookup for the same domain. And it should give me a similar answer. Look at this IP address and look at this IP address, but the NS lookup will give you that in a different format. So, here is the DNS and here is the IP address of google.com. Also, it gave me the IPV6 address of google.com. So, it resolved both IPV4 and IPV6. So, we did this step already, DNS lookup. Oh, actually it's NS lookup, not DNS. So, forget about this D. NS lookup. So, now we need to influence a change in how the local DNS sees www.google.com. The dig command, let me clear this. The dig command goes straight into the DNS and finds the IP address and goes out. But if we use ping, for example, www.google.com it is working and it is responding, but the ping, what it does is it checks local files, local DNS files first and if not then it will query the DNS server. Ping does that. So, here when I ran ping it translated www.google.com into this IP address. Let's now do one thing. Let's do nano and here is a file where I can define hosts. ETC hosts. So, I'm going to go below and I'm going to do 10 or 172.31.0.55 maps to www.google.com. So, what I am doing now is in a local DNS file and I'm going to define a local IP address, a private IP address 172.31.0.55. Control X to save. Yes to confirm that we need to save the change and hit enter. Now, if I do ping, what happens? Let's find out. You'll find that instead of going to this IP address 142.250.190.36, which was working now it's going to a completely different IP address. Let me stop this, control C. It's going to the 172.31.0.55, which is the one in the hosts file, in the ETC/hosts file. Whereas if I do dig www.google.com, it will not check any local files. It will go straight into the DNS and it gets me the correct IP address. There are ways that for some of the tools like curl and ping that you can influence locally what some domains would look like. Whereas dig will always go to the DNS server and get the correct information. So, we did the change and that worked and we did ping and it used the IP address in the ETC hosts file. Whereas if you do dig, it is going to use the one from the DNS, which is the correct one and that is how dig works. All right, hopefully that clarifies at a basic level how the DNS works. In AWS cloud, there is a service called Route 53. Let me show it to you. So, if I go here and I type Route 53 if I right click on this this is a DNS service that can be used even for big corporates if they would like to host their domains and details in AWS. You can register domains and you can create hosted zones, basically records in these domains to tell what www.dolphinet.com means, what marketing.dolphinet.com means, what example.com means and so on. So, you can rely on AWS completely to provide you the DNS server in the cloud. But we are not going to dive deep into this because this is beyond the fundamentals. All right? Hopefully that was clear and thank you for watching. Let's now talk about monitoring, alerting and logging and why these are important and what can we use them for. Monitoring is watching the system metrics in real time for health, performance and security. So, monitoring in real time means as the events happen, as the status changes, as the performance degrades or enhances, that means monitoring in real time. So, you are recording in real time what's happening in the system. And if you have a monitoring tool that's like an eye on the system, then that can tell you, for example, if that was a virtual machine, what's the CPU utilization, what's the disk space taken, what's the network in and out traffic and so on. So, it can give you a lot of things and these can help in the health, in the performance and in the security of the systems. So, monitoring can be monitoring security, performance or health or all of that together. So, here's an example from my macOS. There is a tool called Activity Monitor. I'm going to show it to you right now. So, as you can see here, we have the CPU utilization, CPU time and we have also memory information about the memory for the different applications that I'm running. We have energy, we have disk, we have network. So, we have a lot of things that we can see about this macOS, this laptop in real time and the applications running and their statistics, what CPU they are taking and all that stuff. So, this is monitoring for my system, for my laptop. That is what is being monitored right now. In Windows, you have something called Task Manager, which I'm going to show you in the demo as well. Something similar to this that will be about your laptop or your server. It will tell you about the resources, the utilization of the resources, the percentages. So, for example, here on the left hand side, if anything is close to 70, 80, 90%, that means it's taking a lot of resources and also I have it here and as a graph at the bottom that shows if it's working fine or if any is taking more than it should. CPU utilization, the percentage of the CPU and how many threads and so on. These are metrics for the monitoring. and using these metrics like CPU utilization, I can find out if everything is okay or not. Memory utilization, disk space, um network in, network out. All of these are metrics that will tell me, by looking at them, how is the system doing from that perspective. Then alerting, notification basically. So, getting notified when some pre-identified events happen or thresholds are crossed is a good thing. That's what alerting is. So, it could be performance-related, could be health-related, or security-related. For example, if someone is trying to SSH into an instance and it doesn't pass, it doesn't succeed, and it fails repeatedly, I need to know someone is trying to hack my systems, for example. If the CPU utilization of one of the critical server reaches 80% or 90%, I need to be notified even if it is at 3:00 in the morning because that is a critical thing. That will affect the response time, that will affect the performance of the server and application, and that will cause a lot of issues when users will start to complain. One of the examples where you can be notified in AWS is when you have a budget alarm. So, basically, you tell AWS, "You know what? If I am getting the consumption is expected to cross or be higher than $3.60 a month, please send me an email or send me a notification." And here is an example of a notification that I have received when the cost the budgeted amount for the month, I don't want to spend more than $6, but please let me know when I reach 60% of that. So, I was told that it's going to get to four uh $4.84 if you keep the same utilization for the month. So, this is an example of notification where I was informed based on a configuration I have done about this event. If it didn't cross the threshold, I wouldn't have any emails or anything. Similarly for security, similarly for performance. Then we have logging. Logging is an archive, uh storage of events or errors related to a system. So, if you are logging, for example, who had accessed your account, who had created EC2 instances in your account, who had deleted EC2 instances in your account, if you can find these logs, if a problem happens, then we can go back to the logs and find out who did what and at what time, to what service, and who deleted and or who created and so on. So, this is good both for auditing if you are in a business that requires compliance and also for troubleshooting if we need to find out the reason for the problem that happened or the outage that happened. And in AWS, we have a service called CloudTrail. Any logins, any sign-ins, any creation of virtual machines, any deletion of virtual machines, any creation of subnets, VPC, route tables, security groups, network ACLs, all are going to be logged here. Any action on AWS services in your account is going to be logged here with the time it has happened, who did it, which user, and what was the event source, and so on. A lot of details. And if you click one of these links, you will find that out. Let's look at this service. So, I'm going to go here and type CloudTrail. And I'm going to open a new tab. We have so many tabs open now, but let's go into this service. And this is enabled by default in your account, in any AWS account, and you don't pay for it. So, if I look here, if I click here and I look at the event history, and this is of course about my account and this is the account ID, you'll find here that send SSH public key, and here it has the date, who did it, and EC2 instance and the ID of the instance that was affected with that. And if we click on that, you'll find more details. So, you'll find the timestamp, who did it, the user, what was the event name, event source, event ID. You have here the instance ID and the details of the event. I don't want to drag you into what this means right now, but this is a lot of information that is very useful when we need to troubleshoot or find out what has happened and who did it and so on. And those events are kept by default for 90 days free of charge. After 90 days, they are purged. And if you want to keep them, you can export them and save them in a storage that you will pay for. Also, we have a service called CloudWatch, and this is for monitoring in your account and for logging in your account and for alerting as well. So, it has as you can see, it has insights, metrics, alarms, dashboards, and services. So, let's have a look at this service, CloudWatch. For example, if I go into metrics, all metrics, scroll down a little bit, you'll find here EC2, for example, virtual machines. And if I click on that, I have metric data available. If I start scrolling, as you can see here, for example, this is the CPU utilization average on EC2. So, you can see that the CPU utilization is low right now, but it has gone up to 6 uh percent. If we keep going, network average, network in average, the traffic going into the instance, the average. And we have also the network packet out average, network packet in average, network out average. So, you have lots of details about what's happening for this instance. So, that is for the metrics. What else can I see from CloudWatch? If I go back to the dashboard, you can create alarms. So, I can create alarms. The alarms and the alarm will watch for a single metric, for example, the CPU of the virtual machine. So, I can monitor the CPU, the average CPU of the virtual machine, and I can instruct it if it goes above 75% send me a notification, for example. That is possible also to do in CloudWatch. Then we have CloudWatch logs. So, I can send the logs from all my applications and the errors from all the applications and the events that happen, and I can save it in a log group into CloudWatch. So, CloudWatch is the core or the heart of the monitoring as far as AWS is concerned. So, why is it important? Let's go back and find out. The importance of monitoring, alerting, and logging for security perspective, you need to know if someone is attacking or probing your system. If someone is trying to break into your system or scanning your system for attacks. You need this monitoring, alerting, and logging for troubleshooting if you want to fix things faster in a proactive manner when something goes wrong before the users start to complain. For performance, you need to monitor your performance and spot slowness before the users do because you want to make sure that they are going to have the right response and the right performance. For compliance, the logs are very important because we need to keep records of what's happening in the infrastructure for audits and policies. So, these are many, many reasons why we need to make sure that monitoring is in place, alerting is in place, and logging is also in place. Example use cases, CPU usage goes over 80%, I need to be notified. Someone tries to SSH into a virtual machine repeatedly and it they don't succeed. A part of the code or the application code fails to run. I need to have that error sent into logging or maybe a notification based on that. Website response time is going down, I need to know about that as well as it happens. A web server runs out of disk space. I need to find out before that starts to impact the performance or the user experience. Example tools, Windows Task Manager, macOS Activity Monitor, AWS CloudWatch for monitoring, alerting, and logging, and AWS CloudTrail for logging. We talked a lot about databases, but we didn't dig deeper into what a database is and why do we need it. To understand the importance of databases in applications or in IT, think about a pizza shop. So, imagine you are running that shop and you need to keep track of the customer orders, who ordered what, and maybe the customer phone number or name. Ingredients used, deliveries, and payments. And if you want all of that written down in a logbook, that is going to be your database. And that may run for a small pizza shop, but for a popular pizza shop that has so many branches, a franchise, people can order online and deliveries and all that, there is no way one person or even a couple of persons or three people will be writing down all of that manually. It has to be in the application. It has to be in a persistent storage that will keep this data. So, if we shift now into IT, the database is an organized collection of data that can be easily stored, searched, updated, and retrieved by software. So, the application can write in the database, can search the data in the database, can update the data in the database, and can retrieve data from the database. And even if the application fails or whatever, the data in the database is going to persist, and we usually take copies, we call it backups. So, in case if the database fails, we can retrieve or restore from the backup into a new database. One might ask, "Okay, but I can do this in Microsoft Excel. I can have all the data about the customers and the orders and what pizza they ordered and how many and how much they paid and all that stuff in an Excel sheet." And the answer is it's okay, fine. You can do it in an Excel sheet or in a Word file, but again, scaling how easy it is to search? Wouldn't application be able to read the Excel file or ask the Excel file for a specific information and get the proper response or does it have to search the Excel file every time it needs to get a part of the information? So, we need a system that can receive a short question, look through a database engine into the data and then respond with the answer. So, the system itself, the database itself is going to take care of that. We may think of database are like super powered spreadsheets and they have the search capability within. So, no need for us or for the application to search by itself. Why do applications need databases? I think we have mentioned that already, but let's summarize it. So, applications, they need to store the user data like usernames, messages, customer orders and so on. So, the user interfaces with the application and the application writes into the database and gets a confirmation to that. E-commerce sites storing customer orders, customer preferences, customer refunds and so on. Hospitals will need to store the patient records. Banks will store banking transaction or financial transactions. With databases, it's always called an input and output or write and read operations. When you write to the database, the application will write to store data. So, the user for example goes on dolphinet.com, buys one of the bundles and now this is going to store the order information in the database. Receive a confirmation and then confirm to the client that everything is okay. So, your order is processed and here is your access or this is what you will get. So, this is for the right operations. But also we can do query operations or read operations. For example, I go on amazon.com and I need to find out my orders for the past 3 months because there is one item I need to reorder it again. So, now the application logic will understand what you want as you click on orders, 3 months, show me the history. It will query the database and ask for the history of your orders in the last 3 months. Gets the answer, prepares how the answer would look like in a nice way on the page and then you will get that in your browser. There are types of database. They're not all one type. So, there are relational databases where the data is sorted out in tables. An example database that are relational, PostgreSQL, MySQL and SQL Server. NoSQL database examples, MongoDB and AWS DynamoDB. In-memory database, very fast. Redis is the best example. And time series, we have Influx, Amazon Timestream. So, we have many types of database. The most common one is the relational one, but also the NoSQL is gaining popularity. An example of a relational database, it's exactly a neat table. So, for example here we have the order ID, customer name, the pizza, which type, the quantity and the price paid. So, this is an example that would be stored in a database and I can search it and I can find it at the end of the day. How can we read and write from a database? This is following something called SQL, structured query language. So, using SQL, you can write and read from database, especially the relational database. So, it allows applications to talk to the database, read or write using simple queries. And here are examples. So, if I have a table with the name order. So, a database with the name orders and this is the information in the table, then I can do a query to find information from the database. Select and this is SQL command. Select asterisk from the table orders where customer equals Bob. So, what is it that I'm finding here? Can you find me in the table with the name orders, search all the items and find me the entries or the record where the customer equals the name is Bob. So, this is the customer field and this is Bob. So, basically the output for this one is going to be this row. So, this query will request the database show all orders in the table named orders where the customer is Bob. Again, for the same table, I can do other queries will be around how many pizzas has Bob ordered. So, if I'm looking for this from Bob. Or what's the total revenue today? So, I want the collection of the prices paid. Or show all orders with pepperoni pizza. So, these are examples of if you build the code to do these functions, then you can easily go open the application, click show me all the revenue for today. Or show me how many pepperoni pizza were ordered or how many packs of mushroom were used today in the ingredients or uh cheese or whatever. So, databases, the good thing about them is they can be integrated with applications and they are persistent. Persistent means they are going to maintain the data even if issues happen in the infrastructure, the data will still be there. Even if the application fails, the data will still be there. As long as I have the right way or the right process of backing up, of taking copies or snapshots from the database on a regular base, so such that even if the database fails, the infrastructure fails, I can take that data, populate it in a new database and restore the functionality of the applications. So, databases are extremely important and this is an integral part of any infrastructure that you are going to work on. Be it for AI, be it for machine learning, be it for cybersecurity or anything. Always, always, always you will need a database. Let's do a hands-on demo on a database called SQLite and this is available online for free and that is why we're going to do it. Of course, as you learn uh through the cloud, there will be a lot of AWS services or Azure services or Google services that are databases and you will get the chance to work with them in applications and in projects. Now, we're going to only show you the database part, but there's no application to communicate with the database. We're going to do the application role manually basically in this case. So, here is the page for the SQLiteonline.com and this is free. You can go ahead and use it. So, what we need to do is we need to build a table like this one, a table that has ID, name and city as the columns or the parameters. IDs are going to be 1 2 3. For ID 1, the name will be Alice and the city is New York. For ID 2, the name is Muhammad and the city is Cairo. For number 3, the name is George and the city is London. So, how can we do this using SQL? So, what we'll do is we're going to have this SQL statements or script and let me tell you what that is all about. So, delete the table if it exists and the table name is customers. And then create table customers. This is because we are testing. And there will be three parameters. ID is integer, so it will be a number. Name is text and city is text. So, this is only identifying what information to expect in each one of these column or data uh for the columns. So, until now all we did is we just created an empty table. Now, we need to populate it. Insert into customers. So, after creating the table, I want to insert into it the values 1 Alice, New York. So, basically I'm entering a row into this. I'm going to repeat it to enter 2 Muhammad and Cairo and then I'm going to do 3 George and London. So, we are entering rows or records in the database. Once I have entered that and we confirm, let's query it. Let's send a query, ask the database to find me a specific piece of information using SQL and find out if it understands it and if it gets me the right information. So, what we'll do is select from customers. Show me the full table because we are not specific on what exactly. I'll also do select from customers where ID equals 1. So, I expect to see this row. I can also do select from customers where name equals George. So, I expect to see this row. So, let's go ahead to SQLite and play with this information. All right. So, here is the SQLite website. Let me just make this a little bit bigger. And let's remove this completely. Here it shows you if you had any tables, and here I have only a demo table, as you can see. And we are going now to start creating our table. So, let's go ahead, and I'm going to copy from the text that we have gone through. And I think it doesn't like this one, so let's do a normal code. This is the table that it's going to create, and as you can see here, it doesn't exist. If I click run, we'll have a customers table here, as you can see. And then the columns are ID integer, name text, and city is text. This is what we have right now. Okay. So, now if I want to view items from the table, what do I do? So, I can do the first query that we have looked, which will show me the entire table. And if I click run, it will show me here, as you can see. Hopefully, it is a bit visible. Let's do if I can do white background. Yeah, I think this one is clearer than the previous one. So, this is going to be select from customers, and here is the table fully, because I didn't specify what exactly I'm looking for. Whereas, if we do this query, so select from customers where and we put the information here, and I run it, then as you can see, I want where the ID equals one, and the ID equals one is in the first row, which is Alice and New York City. If I do where name equals George, equals George, and we hit run, oh, I put this wrong. George, and I hit run, you'll find that the third row for George and London is the one that appears. So, this command that we are typing here, usually it's going to be encoded or programmed into your application code. Let's say if this was for a school, and the user would like to know the grades or the GPA. So, in the user interface, it will be like check your GPA or check your grade. Whereas, when that is clicked, in the code itself, there will be a select from the table for that subject. So, select from the grades table where the subject is chemistry, and the user is let's say George, or maybe Sarah. So, it will find that out, and you will see it. So, the UI or how you see it is completely different than what happens between the application and database. So, hopefully, this was a simple example. And if you want to delete this table right now, all I need to do is the drop table if it exists. And if I click here, and if I run it right now, look at this side. Run, and the table is gone. So, there is no table anymore, and this is an actual database engine available online, and we can play with it. What happens in real in reality is there will be application code interfacing with the database. Hopefully, this clarifies how the databases work. Let's now train on how to draw architecture drawings or diagrams in a professional way. In order to do that, we are going to practice on how we can draw such um good-looking architectural drawing that represents a VPC in AWS with some requirements. So, what do we have here? We have AWS region US East 1, North Virginia. A VPC with cider block 10.0.0/16. And then in availability zone 1A, we have a public subnet and a private subnet. And these are the IP address ranges for the subnets. Security groups, web server one, and a database. And then we have public subnet two and private subnet two in availability zone two, which is 1B. And here are the ranges for them. And we are giving also the root table information for both of them, or for all of them, with the IGW, implied router, internet, and users. And of course, the VPC stretches across the different availability zones available. So, how can we draw this, and where do we get the icons from, and how does it end up being good-looking or representative of your skills and understanding? This is what we're going to learn now. All right, so let's open this website. app.diagrams.net, or you can do draw.io. Both of them are going to take you to the same website. This is an online drawing tool, used to be called draw.io, d r a w.io, and now it is app.diagrams.net. Once you get to this website, it will ask you, "Where do you want to save your diagrams to? Do you want to save it to your device, to OneDrive, to Google Drive, and so on?" I'm going to save it to my device, and it will ask you which folder, where exactly do you want to save it. And I'm going to create a new diagram. And you can change the storage if you wanted later on. Because I have already decided where it will be saved, it did not ask me for the folder or the directory, but in your case, it will ask you where on your laptop do you want to save it. So, in that case, you save it to downloads, you create a new folder and call it drawings, architectures, solutions, use cases, whatever. So, now I'm going to create a new diagram. And I will start with a blank diagram. Of course, here you can do a flow chart, you can do organizational chart, you can do a lot of types of diagrams, but in our case, I think blank would make more sense. And click on create. Now it's asking me where exactly it will be saved. I'm going to save it under downloads, and I will call it testing, for example. All right, so this is basically where we can draw. And as I mentioned, what we need to draw is this. So, let's start with the AWS region, US East 1, and then we are going to create the VPC, the availability zones, and then we can come and look again for the details. So, on the left pane, on this side, let me make this a little bigger so you can see it. I can type what I want. So, for example, I want AWS icons. So, here you have the 2025 open library, and you have a 3D one. So, I'm going to go with this one. And as you can see here, we have groups, we have analytics, depending on which services you want. So, you can have all of that. If you are not sure where the icon you want exactly, so I'm going to mention or type region. And here you can see that there is an AWS region. Here is another one. So, I'm going to select this one. When you see this cross, that means you can drag it around as you wish. So, you can drag it around your canvas, and if you expand, the uh canvas is going to get bigger. So, is it one page or more pages? Usually, try to confine it to one page. Don't try to make it multiple pages. It will be easier for you to save it, to print it, and so on. And I'm going to, as you can see, when at the corner, when this shifts into an arrow, then you can shift it this way, you can shift it that way if you want, as you wish as well. So, this is the region, and it was US East 1. Double-click on the text, and now I can write US East 1. All right, so this is the region. What do I need now? I need the two availability zones. So, I can write availability zone. And you have here availability zone, and this one is also availability zone. So, what I will do is I'm going to grab this one, and I am going to put it here. And I'm going to drag it to the end. And for the availability zone, click or double-click [clears throat] on the text, and I can write US East 1A. And the second one, I'm going to click on this, and command D to duplicate it, and I'm going to drag the other one below, and this will be by double-clicking on the text, 1B. So, this is the availability zones, 1A and 1B. Now, what do I need? I need the VPC. VPC, and here is the drawing for the VPC, and you have the purple one, and you have this one as well. I'm going to drag this one, and I can change the color. Let me leave this one. I dragged the wrong one. So, the VPC stretches across the availability zones, as you know. And I'm going to [snorts] make it bigger, so we can accommodate the different Okay, so I'll make it this way. Drag this one this side. And this is availability zone one and availability zone two. You know what? I think it's better to do the availability zones in a different way. The reason why, I'll tell you, because I don't want the writing for the availability zone to get in the way of stretching the VPC. So, what I will do is for this one, see what happened? I cannot click the other availability zone. Why? Because a layer is in front of it. The VPC is in front of it. So, what I will do is I will click on the VPC, I will click on the VPC, and then send it to back. That will allow me to get So, these are like layers. When you are unable to click one of them, that means the other one is in front of it in terms of layers. So, what you need to do is click on the one that is holding it or not allowing you to get to it. And right click and then to back, that means send it or make it a backward layer, send it backwards. So, that will allow you to view or to touch or to move the other one. So, what I will do here is I'm going to move this this way like the other one. And this is going to be availability zone 1B and I can make the region a little bit bigger. No, only the region, not everything else. So, I'm going to move all of this down now. And that makes the availability zones I can see them. And I can see the VPC as well and it also signifies that the VPC can extend across availability zones. So, this is what we see right now and it is what I wanted to see here. What we can do is I can now click on the mouse, hold hold the mouse the mouse button down and I'm going to move these inside to the back a little bit. And to the bottom a little bit so it doesn't conflict with this text. What you can do also is if you do control B, this is going to be uh dark or uh bold also here. I want it to be bold. And here, I want this to be bold. Oh. Okay, so we have all of them. Of course, you can change the colors if you want. So, this one for example, I can make it green if I want it. I can fill it. This is the fill and this is the line. If you don't want to fill it, then I can reverse what I did and I can put a color for the line a different color if you want. So, I can make it green. Apply. And I can also make this the line a bigger size. So, see the line size is getting bigger now. For this one, I'm going to do the same thing. And I'm going to make it bigger as well. And drag this a little bit up. Of course, the color and your taste might not be like mine. I mean, I'm not thinking actually about what will look good and what will not look good in terms of colors now. But, I'm thinking that you can distinguish it by looking that they have different colors, which means they are not the same and they have they represent different things. So, for this one, also make it a little bigger and now it's a different color and also for the region, I can make it anything, red for example. And it's up to you. You can also change the text color to be different. So, now we have the VPC and we have the availability zones. Let me shrink this one a little bit to this side and expand this a little bit to this side. So, what do we need now? We have the VPC, the region. I need the internet, right? So, let me just type the internet. And here you have multiple selections of the internet. Select the one that you like. So, this becomes the internet and of course, I can move all of this. I can highlight all of it. Move it to the right. To the borders. And then I can write users. So, whatever you want to draw, you can type it in the search and it will give you the different icons or shapes that can represent that. So, these could be the users that are going to be using the infrastructure from the internet. All right, so what do we need now? I need to have public subnets in availability zone 1A and private subnets in availability zone B. So, let's go back and check. Two public subnets and two private subnets. One public, one private in each availability zone. So, let me do public subnet. And here it is. So, again, this is blocking. So, I'm going to push it back the VPC to be able to get the subnet. So, push this one to back. Push the region to back so I can get to back. So, now the VPC also. All right, so here's what I'll do. Okay, I'll move this one out. Move this one out. Now, take the region, put it back. And take the VPC and put it back as well. So, this one I'm going to bring it in. This is the public subnet one. And then I need a copy of this. Control D. So, this is going to be public subnet two. Then we need private subnet. And here is the color. So, we need private subnets one and I'm going to copy it. Control D. Into public subnet two. Private subnet two, I'm sorry. Okay? And then we drag this one down. And we drag this one down as well. All right. What else do we need? I think it would make more sense maybe to put the internet and the user on this side. The reason being that we are going to put the internet gateway here towards the internet and I want the two public subnets to show as if they are closer and directly connected to the internet. Whereas the private are behind and they are hidden from the internet. We need now to put the VPC cider as 10.0.0/16, which is fine. And then we start putting the ciders for the subnets as well. So, I'm going to place 10.0.10.0/24, 10.0.20.0/24 and the cider block here. So, let's do that. When you click anywhere, you can open a text and then you can write what you want. So, this is 10.0.0.0/16 and this is the VPC cider. So, let's add the word cider. [clears throat] Okay, and 10. 10. And this one, remove it. And put a bold and I can place it in here. Then I need a copy of this, which would be the subnets. So, 10.0 .10.0/24 for public subnet number one. And I'm going to move it a little bit behind the name of the subnet. And then another one that will be dot 20.0. So, this is going to be dot 20 .0/24. So, I'm going to place this one here. And a little bit up. Okay, now let's see what the private ones are going to be. So, the private is 100 and 200. I'm going to do 200 and I'm going to do 100. Okay, so 100 is private subnet one. 200 is private subnet two. Okay, what else do we need? I need to put an instance in the public subnet with a security group around it. This is called web server one. This is called web server two. That's easy. So, here I'm going to go and click on instance or write instance. Uh let me write EC2. So, EC2 instance. Okay, this is uh I wanted the instance only without instance. All right, I'm going to scroll down and look for it. It's under compute. And I want the empty one, the one that doesn't have any text inside. This one. Okay. So, this is an instance. And a similar one on the other side. So, control D or command D copies or make a makes a copy of what you are working on. Or what you are highlighting basically. And a security group. Group. So, you have multiple ones. I can probably take this one, let's say. I'm going to take it out. I'm going to resize it so it fits within the subnet and around the the instance. I need to make it a little bigger, so I'm going to drag this a little bit down. And let's see. Probably we need to move the instance a little bit down as well. Uh, drag this a little bit down a little bit more. Yeah, and then I need to write that this is web server one. And then using the arrows, I can adjust it and I can do control B to make it bold. And control D I need the same thing on the other side and I need the security group on the other side as well. Of course, you can change the colors to your liking and to your taste. And this shouldn't be a problem. And I can move the instance a little bit down. Of course, the security group is coming on the way. So, I'm going to bring this a little bit down and then bring this back. Use the arrows to adjust it. So, now I have a security group and the web server one and this is web server two. Okay, so the text is going also to be over it. So, I'm going to to drag this one out and make it two. And then take this one back. Use the arrows to adjust it. And we are good to go so far. Okay. What do you need now? I need to have the implied router and the internet gateway. So, internet gateway. And here we go. This is will be at the border of the VPC. Resize it to look good. And this will be at the border of the VPC and that is how it connects to the internet. And then I need implied router or I will just say router. And this is the icon of the router. Again, I'll take it out. Resize it so it fits in between. I need to connect the router to the internet gateway. So, when you hover over the icon, you will see that there is an arrow and if you click on the arrow then see it connected it to the router. Same thing, if I need to connect the subnets the subnet into the router, then I can click on the arrow. No, not this one. Don't drag it. I need the subnet only. And I'm going to click on the arrow and then adjust it. Okay, so now this subnet is connected to the router. And if I click on this subnet as well, I'm going to connect it to the router. So, just click on here and you can adjust it a little bit. So, I'll make it a little longer. Drag it. So, we can move this a little up with arrows. And same thing for this subnet. And use the arrows again to connect it here. And we can make this move up a little bit so it's in line with the other one. Or close to being in line with the other one. All right. Okay. I think it's close. Maybe if I move it to the side a little bit. Bring it here. And then use the arrows to align it with the other one. I think it looks good now. And the last subnet also needs to connect here. So, I'm going to connect it in here. Uh, doesn't look as good because of the distance. So, we can drag this a little bit to this side and it becomes better and we can drag this one as well. So, the lines are now looking much better. Okay? So, I've connected [snorts] all the subnets into the implied router and the implied router is connected to the internet gateway. All right, so this looks okay to me now. What we are missing now is the route tables. That's what we are missing now. I need the destination and target and the names of the route tables. And once we are done with that, that means we have done the entire thing and you have built an architecture drawing that looks good for a fundamentals level. This is excellent, not only good. So, we need to insert a table. So, I'm going to type table and you'll see different ones here. So, I'm going to click on this one. Let me drag it out. And we need only two columns, not three. So, what I can do is I can click on the it's in the arrange and probably this one. Yeah. Okay. And also I need to delete an arrow. So, I'm going to go into arrange again. And I'm going to delete a row. But I didn't want to delete this one. Let me delete the last one so it will maintain this one. Okay, and we we need to type the text destination and target. Of course, all of them are going to have the 10.0.0.0/16. And this is going to point to local. And the internet ones are going to have 0.0.0.0/0 which will point to the internet gateway. IGW. Let me go back. Yeah, I got it right. So, let me go back here. We don't need this row. So, I'm going now to put this as This is for public uh, subnet. So, we have public RT and public RT the same. I'm going to double double click here and then write public RT and make it bold. So, this one applies to both and what I can do now is I can highlight the entire thing and then drag it to the left so we'll have space on the right hand side as well. And I can drag it a little bit more. So, we'll have public route table as well. Okay, so I need a copy of this table. Okay. It is replicating. Not the entire table. It's replicating the the row and this is not what I want. So, I'm going to replicate this first. Public route table and this one I need to replicate. Not I need the entire thing to be replicated. So, let's see how we do this. Copy and paste. Okay. So, here is the other one. This is and public route table. Of course, now I have started a new page and I didn't want to do that. So, what I will do is I'm going to shift everything into the same page. Just drag it and then take it to the left a little bit. So, now we are back to one page only. And this one bring it closer. Now, what we need is we need to to do the private subnet tables. So, I'm going to do a control V again. But this is going to be without the last row cuz it doesn't have access to the internet. And I can change the color, of course. I can choose not the font. I want the table color. Style. So, I can do the fill to be uh, let's see. Fill. Uh, let's make it blue. But with a little practice, we can figure out why it's not taking the color, why it's not changing the color. But anyways, what I need now for the private, I need private route one and private route table two. So, I'm going to have different names for them. So, private RT one and make it bold and drag it to here. And then control D. Drag it out and number two. And take it to the other side. And guess what? We have now the full drawing that we wanted to do. Although it changed the direction of the internet, but that is okay. That's perfectly fine. And actually it makes no difference because here I have the two public subnets facing the router and the IGW closer to the internet. So, as if we shifted that 90° to the right. And that is how we have but the availability zones here were horizontal. If we shift it 90°, they are going to be vertical and it will make the same drawing. Now, I need to find out why it's not taking the fill color. And once we're done with that, then all is good. All right. So, let me click on this. Click on the table and I don't want the fill to be auto. I want it to be solid and I want it to be a different color. So, let's try blue. Okay. So, blue is good. And now, okay. So, now Oh, okay. It does one cell at a time. I think it does one cell at a time, not all the table. So, this one I'm going to do it blue as well. Yeah. All right. So, we figured out why it was not taking it. So, we have to highlight one cell. That is not the case when I'm working on um on the app that I have on my laptop. But anyways, we figured out. It's very easy if you play around to figure out what are the different things are. So, now you have a a full drawing. Looks very professional. And it shows that you understand what is an availability zone because here we are extending the VPC across availability zones. So, you understand that the VPC is confined to a region. You understand that the region has multiple availability zones and availability zone is also confined to a region. But the VPC can stretch and have workloads across availability zones. So, this is clear. When I look at it, I understand that you understand what you are drawing. And it looks professional. You are using different color to signify that you have different items. Route tables, different route tables, different colors. Same route table, same color. So, this shows that you know what you are doing. It shows the IP addresses. It shows the name of the web servers if you have one assigned. We have a wrong line here that we can delete. I'm only missing one thing, which is the database and the security group in the private subnets. Once I have this, I think we would have completed everything and this will be your first architecture drawing. Of course, you can start with simpler ones if you want, but now I showed you how to build a complex one. If you get to that skill level, excellent, perfect. If you don't, you need to look up to getting to that level, but you can start with one availability zone, one subnet, implied router, IGW, one VPC, small VPC and all that. You can start with that and then you grow your skills as you go. But let's put the database and the security group and we are good to go. So, here I'm going to type RDS. That's the name of the database in AWS. And I'm going to take this icon. Let's take it out. I can change the color. I can make it blue. Yeah. And I can make it smaller so it can fit under the security group. So, we need one here. And we need one here. And then I'm going to go back and security group. And let's grab this one so it it's different than the other one. And let's change its color to blue for example also. I like blue. Resize it to fit in. I think this should be enough. See? Yeah. And you can always use the arrows for sensitive distances. Control D so I can have another copy. Move it to the other side. And use the arrows again to adjust it within the subnet. And we are good to go. Believe it or not, congratulations on building your first architecture drawing. And nothing stops you from expanding into other pages if it is going to be big, but it will be very hard to accommodate it and make sure that it's visible within documents. Now, you are done and you want to export it or you want to save it. So, I can export it as PNG, JPEG, SVG if you want, PDF. You can do all of it. If you do PNG, you can click here to make it transparent background. So, you can take the drawing, put it on a PowerPoint presentation if you are going to present and you include it in your PowerPoint or take it without a background and put it as well in your documents. So, it will not have a grid or anything that will show in the document. It will only show the diagram on the background, which is the document itself. That's it. And if you do export, it will ask you, "Okay, what's the name? Where do you want to have it?" And that's it. So, that's all what you need to do in order to build a professional drawing. This is not only limited to AWS, by the way. Let me cancel. Now, if you want Azure icons, you can have Azure icons. If you want GCP icons, you can have GCP icons. So, GCP icons. You can have Google Cloud icons. If you want Cisco icons, if you want to to build something for networking, you will find everything. Cisco and you'll have Cisco icons. Juniper. They don't have Juniper. So, there are icon libraries that you can download and use it as well. And of course, they have the general ones as well. They have the drawings, the rectangles, the circles, the triangles and so on. These are general purpose ones that you can use if you want. Arrows and so on. And the more you draw, the more you get familiar with it. So, Kubernetes, I think it will have also. Kubernetes. It does have Kubernetes icons. Docker has some of them. Uh Terraform, let's see. Um not many. Or maybe HashiCorp. HashiCorp. No, it doesn't. But you can look for libraries and you download them and use them if you want. In module 10, we are going to look at many IT tools or technologies that we use and they are extremely important when it comes to modern IT. The IT of the cloud, the IT of DevOps, the IT of AI and machine learning and so on. This is not going to turn you into a master of these technologies and tools, but it will tell you why you need to learn them and what you can do with them at a very high level, very basic, very simple without any complications. When you decide on your next career steps, you will know up front what technologies and tools you would like to master in order to be well prepared and well-rounded for the role that you are going to choose. All right? So, let's go ahead and start our section. So, let's start with a Linux overview. First of all, Linux is I would say 95% running all the servers on the internet today. I'm talking about the server side. I'm not talking about the users that are using Windows. I'm talking about servers that are running AI, that are running the cloud, that are running DevOps, that are running a lot of things in the cloud in modern IT. And these are based on Linux. That is why I am personally an advocate of learning Linux as opposed to Microsoft Windows Server. You will be well equipped with Linux, with the right skills to start learning Docker, to start learning Kubernetes, Terraform, Git and GitHub and a lot more technologies that are all based on Linux primarily. I know some of what I mentioned may run on Windows, but that is not what is used in production. That is not the core in production. And as I mentioned, we are talking about 95% of the internet runs on Linux. Again, this is only a high-level overview to show you how you would deal with it and how it works. Is it command line interface or is it graphical user interface? And what would you do for simple tasks in Linux? So, why learn Linux? Linux runs most of the cloud and internet systems, servers and cybersecurity tools today. DevOps and cloud careers heavily demand Linux skills. So, you need to know Linux well and also, in order to build the skills in other technologies like Docker and containers and Kubernetes and all that stuff and Ansible and so on, you need to know Linux to a decent level where you can learn these technologies and work with them because at the end, they all work on CLI and they are all dependent on Linux commands and Linux operating system. Learning Linux paves the way to learn the other stuff. We talked about that. It is free. So, you can start learning Linux without having to invest in a license or buy subscription or anything like we do with the Windows. You don't have to do that with Linux. Linux administrator is a good quick entry point in IT as I mentioned. So, if anyone would like to get quickly a job in IT, it won't be the highest pay that you should be aiming for, but at least you can enter and have a funding source to fund the rest of your education. And at the same time, learn IT and grow within. The minimum Linux knowledge that you need will be creating, deleting, and navigating folders and working with files and permissions. Basically, to be capable of dealing with the file system, the files, the folders, the permissions, the users, the groups, assigning and creating users, assigning permissions, and all that stuff. So, this is all important. Using the terminal shell and the common commands and install and tune packages, this will be the minimum that you need to know. And this is enough to get started. You can add more skills as you go or whenever you need to learn something new for a new technology, then you can go add that to your tool set in Linux and then continue. If you are planning or if you want to get into IT as a junior Linux administrator, then the number one enterprise preferred Linux certificate is the Red Hat Certified Systems Administrator. So, this is a certificate you may spend after this course maybe another um 1 and 1/2 to 3 months depending on the time that you are going to allocate and you can prepare for the exam. The exam a little bit on the hefty side. It costs about 350, 400, 450 dollars depending on where you are. But, that would give you the seal that you are certified in Linux and you can start your job as a junior Linux administrator or junior technical support engineer. Don't make that your goal, but that could be a tactical or a milestone towards your goal. So, if you want, you can do this. And of course, there is one equivalent one also, the LPIC certificate, but I think that Red Hat is more widely known at the enterprise level. The other one is picking up towards the cloud. Either one will give you enough knowledge about Linux that you can learn any distribution. You can learn Ubuntu, you can learn Red Hat in this certificate, you can learn Kali Linux or anything else depending on what you will specialize in after this course. When you work with Linux, you are working with a command line interface. So, it's not a graphical user interface where you click on things and right click and open and and and delete and all that stuff as we do in Windows and and Mac OS. It is more on the command line. So, some common commands that you will definitely use. Who am I? If you would like to check which user you are logged in to the Linux system. PWD, if you would like to know where exactly in the file system you are. Are you at the root? Are you in the Linux practice subdirectory? Are you in the application one folder? Where are you exactly in the system? LS to list files and folders and CD to change directory. CD can help you change directory so you move deeper into the file system or you move up into the file system. You can create directories with make directory and you can do cat in order to print file content. Basically, read for me the file and print it on the screen. And use the touch command in order to create files. You can nano to edit files. And you can echo if you would like to redirect a specific sentence into a file. So, you want to create a file and then you can start adding information into that file or appending information to what is in the file using the echo command and redirection. We are going to go ahead and do a demo and that would be the most helpful way to get an idea on how Linux works and what to expect when you are dealing with the CLI. Let's go ahead and demo Linux and use some commands in a very simple scenario that will give you a feel of how Linux is and how you work with it and some basic commands as I mentioned that are very common and you will use them frequently when you are learning cloud or you're learning any of them modern IT skills. So, what's the objective? We want to learn how to navigate, create, and manage files and folders in a Linux system. And the scenario, imagine that you have been hired or you are in an internship as a junior support technician or systems administrator. And the team lead that you are assigned to will ask you to explore the Linux server and do some basic file and folder operations to get used to the environment. In order to achieve that, the simplest thing, I'm not going to ask you to create a VM on your laptop or anything. We are going to create an EC2 instance in a public subnet in AWS with a public IP address. It will be associated with a security group that will allow SSH inbound from anywhere. Very easy. Let's go ahead and create this before we start the commands. So, here we go. I am right now in my account. I'm going to go ahead, launch an instance, and let's call it Linux training. And it's going to be an AWS Linux. Amazon Linux 2023 or AL2023. T2 micro. We don't need a powerful instance for this. I'm going to use an existing key pair. If you don't have an existing one, please create one and download it and know where it was downloaded. And network settings. We're going to do with a custom VPC. I want to make sure that it's going to get a public IP address and I want to make sure that it is in a public subnet. And I'm going to use an existing security group and I have one, SGA. This allows all traffic in, all traffic out. Okay. So, a quick review just to make sure that everything is right. Public subnet. It will get a public IP address in the custom VPC. It has a key and it's T2 micro and Amazon Linux. And I'm going to go ahead and create it. After we'll create it, we'll connect to it because we need to start working with Linux. So, I'm going to click on the ID to get into the instance. Click on connect and in this case, I'm going to use the EC2 instance connect. Click on connect. And as you can see, we have a public IP address and a private IP address. Connected to the instance and I'm going to elevate my permissions with a super user. So, as you can see on the left-hand side that this is easy to use. But if I want to know for sure, I can ask who am I? And that will tell me that you are easy to user. When I do the sudo SU, this is going to change. So, let's find out. Who am I? Now, it will tell me that you are the root. Root means the most powerful, the super user in the system and you have or you can do all permissions and all that stuff. Of course, in in Linux, usually when someone tries to change into a super user, there must be some authorization done because not everyone should be allowed to do that. But the default in AWS is there is no password, there is no permissions to claim the root privileges or permissions. All right. So, find out your username. We did the who am I? Where in the file system are you right now? So, in order to do that, we need the PWD or print working directory. So, I'm going to do PWD. Let me know where I am. And this tells you that you are under home and under the directory home folder of easy to user or the home folder directory of the EC2 user. List the files and folders in the current directory and that is using the command LS. So, I'm going to do LS and I don't have anything right now. Create a new folder for your work and this is going to be the Linux-practice folder. And the command to do that is make directory. So, let's do that. Make directory and then Linux practice. That's the folder. When we do LS again, you'll find that we have now a folder called Linux practice. Move into the new folder. So, from home/ec2-user path or the place in the directory, you need to move into you move deeper into the file system. So, basically, we have home. And under home, we had a folder called user. Now, under user, we created a folder called Linux practice. And when I started, I started right here. Now, I need to move one step in the system and get into this directory. How can I do this? Using the change directory command, Linux practice. And after we do this, we need to find out where in the file system we are. So, we are going to use PWD to confirm that we have moved in the system. So, I'm going to do CD and then Linux practice. LS. I don't have anything. And if I do PWD, it will tell me that See, before I was here and now I have moved one step into the system, deeper into the system, into a a folder called Linux practice. Create a file. How can I do that? Touch hello.text. So, when you do LS, we don't have anything. Let me clear this. And now I need to create a file called hello .text. If I do LS again, we have a file now. the hello.text And if we do cat hello .text, this will show me if the file has any content, it will print it here. But as you can see, the file is empty. I don't have anything here. List the folder content, we saw that. All right, what's next? Write something into the file and we can use echo hello world. So, this is going to print as an output hello world, but this means amended or append the hello.text file. So, add it to whatever is in the hello.text file. So, echo and double quotes hello world and then hello.text file. Now, if we cat the content of the file again, you'll find that after it used to be empty before when we did here, we didn't get anything and now we are getting the text in the file. We did the cat, edit the file. So, we can use the nano editor in order to edit the file. Let's try that one. So, nano hello.text and here I'm inside the file and as you can see the sentence that we have added and I can say here how are you doing today? And then do control X. Yes to save the changes and enter to exit. Now, if we repeat the cat, you'll find that we have the two sentences in the file. Okay, create a subfolder inside the folder. Subfolder called notes inside the folder. So, we're going to create make dire notes. If I do LS, now I have two things. I have a folder, different color, and I have the file hello.text. Where in the file system are you? We're going to move the file hello.text into the notes folder. All right, so do PWD. I'm still where I am in the Linux practice. We're going now to move the file hello.text. I would like to move it from the location where I am right now into the notes folder. So, I'm going to move it into notes. LS, I don't have the file anymore. If I go into notes and do LS, I'll find that the file is here now. Now, once we are done, we can delete the hello.text file. We don't need it anymore. That was just the practice that we wanted to do. So, I'm going to remove the file hello.text. Remove regular file. Yes. LS, remove hello.text. Now, the file is removed. Now, let's get out of the notes directory because I need to delete it. So, you can move one level up in the file system by doing CD space dot dot and as you can see, we moved from notes into Linux practice. So, I moved one level up in the system. And if I do LS here, I'll find that we have notes. So, we can do remove directory, delete the directory notes. And if I do LS, I don't have it anymore. So, I'm going to move one level up again and now I'm back into the home directory of the EC2 user and we can do remove directory Linux practice. LS and we don't have it anymore. All right, so delete the hello, delete the directory and delete the Linux practice. And as a good practice, always if you don't need the instance anymore, terminate it or at least stop it so you don't face any surprising charges. So, I'm going to go back. I don't need this anymore and I'm going to get here and instance state terminate and we are good to go. Now, let's do bash scripting or bash overview. What is bash? Why do we need it? Why it is always a requirement or a skill required when you apply to cloud engineering, to DevOps, to programming, to Linux administration, to ML ops, to SRE, to platform engineering, anything, you will need to work with bash scripting at least as a scripting language. So, what is bash? Bash stands for Bourne Again Shell. That's the abbreviation for bash. It's a command line interface and a scripting language for Linux. So, it's only for Linux. It lets you talk to the computer, automate tasks, and chain commands together to get powerful things done. So, instead of you going into the command line, typing one command at a time, you can have them in a script and you can apply that script, for example, when the virtual machine is booting up. You can install things and you can configure things. When you want to automate the backups, for example, you want to take a copy of your database every night at 1:00 a.m. for example. So, instead of you waking up and doing that manually, why don't you put in a script and schedule it so it runs every day at 1:00 a.m. And you will be sleeping and you can also ask for an alert or a notification that was done successfully. All of that is done using bash script. So, it's one of the core skills when you are working with Linux systems for automating tasks on these Linux systems. Why learn bash? It's the default shell in Linux and automate boring tasks used in DevOps, cloud, and cybersecurity heavily and it's fast and lightweight. Now, let's look at common use cases for bash so you can get your head around why do you need to learn it. So, we'll look at the tasks and what would bash do for me in that case. So, you want to automate routine stuff. Starting virtual machines at 7:00 a.m. in the in the morning, switching them off at 6:00 p.m. in the evening, doing backups for the virtual machines or for the database, a lot of things that can be done. So, routine tasks like backups, deleting temporary files every day. So, that can be done without you having to worry about it. Schedule it and forget about. Cloud setup. So, launch and configure EC2 instances. Not only launch and configure. So, you can download things, install packages and and so on. Security and monitoring, it can help you scan logs for failed logins and that will be helpful for the security specialist or the consultant to find out if you are or you were under attack. Installing packages and software, multiple packages in one script as opposed to you going and do typing a command and then waiting until it finishes and then typing the next one and until it finishes, you can just pass them as a series of commands and it will do them one by one as the virtual machine boots. Report generation. You can use it to pull, for example, disk usage and send an email or email these reports. Which modern IT roles will require you to have bash because you will use it in that role. So, if we start from IT support, network engineers, technical support, sysadmins, all of them will need bash because they need to fix files, manage files, generate reports, troubleshoot via CLI, create and manage users. For DevOps engineers, it will be very helpful to automate the CI/CD tasks and also server management and creating cloud scripts to bootstrap the virtual machines with the right packages or the right software that you need. For cloud engineers, for user data scripts, basically passing that, as you'll see in the demo, passing a script to the virtual machine when it runs, so it will download and install packages and maybe services that you need and it will start them as well as the instance boots, so you don't have to wait until it boots and then you go in SSH and then you start typing one by one of the commands. So, user data scripts, provisioning EC2 and startup tasks. For cybersecurity analysts, it will help with the log analysis, it will help with automating tools that are used and also for network scans. And for sysadmins, automate system health checks, backups, and updates. So, these are just examples. Of course, when we talk about DevOps engineers, that means SRE engineers and platform engineers also they need it. Cloud engineering also definitely will need it. Network engineer, developers, they will need to have an adequate level of bash because many of these tasks, you'll find that other roles as well need them. A lot of the jobs that I see in the US and that is the reference for me that I use to find out where things are going, they will ask to know bash or PowerShell or Python. Rarely I would see that this and this and this, but they want one of the three. So, let's compare them and find out. What's the positioning of bash? Why is it more popular? What's the positioning of PowerShell? And if I learn bash, why do I have to learn Python? So, this is very important and I get this question day in day out from people who don't want to learn Python and they keep pushing back and say, "I know Bash. I can live with Bash. I don't need Python for anything." Actually, you do. From an operating system focused perspective, Bash is for Linux, PowerShell is for Windows and now it is cross-platform. Python, of course, that's a coding language. It can work on Windows machines or in Linux machines as long as it has the right runtime. For the syntax, this is very simple, Linux commands basically. Uh for PowerShell, it's verbose a lot. I mean, the commands are much more difficult, I would say, than Bash, but they are powerful. If you learn them, you learn them. For Python, it's a programming language. So, the code is clean and it's very easily readable. Bash is best for native Linux tasks and automation on Linux systems. And, of course, PowerShell is for Windows and Active Directory. Whereas Python, it's full-featured applications, anything you want. So, you want to automate integration for an application, for example, when someone uploads an image on a website, then Python will sense that and then will do some tasks based on that that cannot be done with Bash. So, you have to have coding in that case. Learning curve, easy for beginners. Usually, you learn Bash after you learn Linux. And PowerShell is slightly steeper than learning Bash. And for uh Python, it's a programming language. How is it used in AWS? Bash is excellent for EC2 user data scripts. PowerShell is less common in AWS. And Python, of course, when it comes to writing programs that will interact with AWS services and automate things based on events that happen in these services. Learn Bash first for system-level tasks and then learn Python later for more complex automation or data manipulation. So, Linux, so you do the fundamentals, you learn Linux to an adequate level and be confident with Linux, then learn Bash, then learn Python. That would be your automation/operating system path in order to get a job in, let's say, 4 months. And if you finish the RHCSA as well, you will find entry-level jobs with these skills and then you can take it from there up. Python automation is very hot everywhere. Don't stop at Bash and say, "I'm good. I don't want uh programming languages." Take your time, learn it, and if others have done it, you definitely can do it. All right? Hopefully, this is clear. Let's look at a demo where we are going to bootstrap. Bootstrap means you will initialize the instance. You will create the instance, but then you will stuff it with some script to initialize it in a proper way. This is called bootstrapping the instance. So, we are going to use a Bash user data script to bootstrap an Amazon EC2 Linux instance. Let's find out what we are going to do. We need to set up an EC2 instance in a public subnet and make sure its security group allows port 80 inbound at least. And we're going to pass the following script to install Apache as it boots up. I'm going to add from my side as well. Let's do SSH as well. So, allow SSH and 80 inbound just in case. If it's not working, we need to get into the instance and find out what happened exactly. So, we're going to pass the following script to install Apache as it boots up. What is the script? This is at the top to define that we are going to use or we are going to use the Bash shell or a Bash script. Then we are going to update the indices and all that on the operating system. We're going to use DNF install -y httpd. We're going to install Apache, which is a web server engine. We're going to do systemctl start httpd. So, after installing Apache, we need to start it. And then enable httpd such that every time you are going to reboot this machine or stop it and restart it, Apache is going to be restarted as well with the instance. So, all of that is going to install Apache and that's it. But then, let's also have a simple webpage that would say welcome to my EC2 instance. So, this is HTML. This is the echo command. We have seen it before. And here are the double quotes to delimit the text in question. And we are going to output that into a file index.html at this path var www html. This path within Apache is where the root document or the index.html or the root of the website exists. So, if you want to have a webpage and you have designed the HTML for that page, you need to place it in this folder in order for users, when they come in to your uh website on port 80, they will be able to see that page. So, if you want it to be seen, this is where you place it. And this is what we are going to do in our case. Let's go ahead and create the instance and then we'll deal with the script. So, here I am in EC2. I'm going to do this in a slightly different manner. First of all, I'm going to do every command manually. And I will show you the result and then we'll do it with user data so you will see the difference yourself. So, launch instance. And we're going to do it without bootstrapping first. So, web testing, for example. Amazon Linux. And it needs to be with a key. So, I'm going to use again a key that I have for SSH. Network settings. I'm going to use the custom VPC. And I'm going to use the public subnet. And I'm going to make sure that it has an IP address. For the security group, I have one that is widely open. It allows all traffic in, all traffic out. In your case, at a minimum, you want to have on the inbound SSH from anywhere and HTTP inbound from anywhere. I'm not going to do anything extra than this. And I'm going to start. If I wanted to have the user data or the script passed to the instance, you click on advanced details and you scroll all the way down and this is where you paste it. It's called user data and that's the script or you can have it in a file and upload it here. So, I'm going to create this instance without any user data or anything. And I will show you that we can achieve what I'm being told. So, why do I have to use a script? So, let's find the difference and that will tell you the importance of Bash scripting. So, what we'll do now, let's go back to the instances. And I'm going to select this one. Okay, it's running now. Connect. And I'm going to use EC2 instance connect and click on connect. If at this stage you are unable to open this black screen and find out the prompt, that means you have a problem with your security group inbound rules. Go fix it. And you will get an error that maybe SSH is not available or something. So, this is based on SSH inbound in the security group. If this is not working, you have a problem in your security [clears throat] group. All right, let's go ahead and do sudo su. And what do we need to do? I need to do DNF update -y. So, this will update the system. It may take a little bit of time because the instance is still booting up. All right, so it's working now. And then DNF install -y httpd. This is the Apache service. So, as you can see, a lot of things are happening now, installing many things. Then we do systemctl start httpd. So, start the service. Now, if I can do systemctl status httpd, show me the status, you'll find that we have this service right here and it shows me that it is running. And the last command, systemctl enable httpd. So, each time when the instance is booted, the httpd will be started. Apache will be started. Okay, fine. What did we achieve? I typed the five or six or eight commands and now I should have Apache up and running. How do I find out? Apache listens or works on port 80 by default. So, I'm going to take the public IP address. I'm going to open here a browser. And you can write 80 or just leave it to the default. By default, it's port 80. And you can find out here that it's telling me it works. I didn't put any script or file. So, this is by default from Apache. If I want to add a script that I need, then I can do echo and then hello from Apache. And then I have to redirect it into var www html index. html. You can cat to check. So, I can cat and then I have all of this copied. Paste and it shows me hello from Apache. So, now if I go back if I reboot it will tell me hello from Apache. Maybe you can't see it. It's small, but hello from Apache. So, now it works. What's coming from a default page in Apache in the same folder and now I have replaced that with hello from Apache. All right. So, this shows you that we could do it without any bash scripting. Why on earth do I need to learn bash scripting? Let's find out. So, let me go back into instances and I'm going to launch another instance, but this time I'm going to do it with the bash script. So, let's do web testing two. It's going to be Linux and same size. Key pair, I'm going to use the same key pair. If you are using EC2 Instance Connect, you don't even need a key pair, but that's fine. Same VPC. So, I'm going to do same everything, but I will pass the script to it. Enable security group. Security group, I'm going to use the same. And advanced settings, click on the triangle. Scroll all the way down. And then we're going to copy the script that we have in the file. And I'm going to paste it here. One very common problem here is sometimes when you copy from PDF files or Word files and you paste here, the line delimiters, they get scrambled. They get mixed. They get confused. So, what I usually do is either I'll copy it and put it in a notepad, for example, uh like basic text editor and adjust it or I will do what I'm doing right now. So, I'm going to go into every line at the beginning. Then backspace and then hit enter. So, that confirms that I have a line break after every command and each one of them is going to be considered a separate line and they are not mixed up. Also, the comments that we have here, they are of no use. If you want to remove them, that's perfectly fine. It's just for you in the documents to find out what this was for and to find out that it is a separate line, each one of them. Okay. So, this is the most common problem that I see with my students when they are working on bash scripts with user data. Especially if they're copying from PDF files. So, launch instance. Let me just double check we have everything set right. It's always good to double check as opposed to waiting and testing and troubleshooting and then you figure out you forgot something. Custom VPC, public subnet, public IP and security group allows everything and we have the bash script as well. So, now I can go grab a cup of coffee. I don't need to wait for the instance or connect to the instance or type any commands. If these commands with the with the line delimiters, they are done right into the script the virtual machine will boot up and will start execute these commands line by line and the start of it states that it is a bash script. So, that should all be working without us intervening. Okay. Let me close this completely and I don't need the previous one anymore. So, now we have a new instance which is web testing two. This one, this is the one initializing. So, this one I don't need it anymore. I can go ahead and terminate it to not forget it later on and be confused about which one I'm using. So, this one I don't need it and this is the one that is initializing right now. Let's refresh. If the bash script will download a lot of packages and it has a lot of steps, then you need to be a little patient because if it takes time when you type the commands, it will take time when they are automated and running on their own. So, let's try. Here is the public IP address. I'm going to copy it and I'm going to check and see if this works. So, paste it and hit enter. And as you can see, welcome to my EC2 instance. So, it didn't say it works or it worked. It has taken the statement in the echo and that was done with HTML delimiters to enlarge the size a little bit. So, that's why you can see welcome to my instance. Which is exactly the statement that we had here in the file. So, you can see with scripts, that is one task. I mean, that is one example, not everything that you will do. If you're not working with virtual machines, maybe you need to take the backup of the disk of the virtual machine and do a copy or a backup every night. So, scheduling and scripting will help you do that. Maybe there are some states. Read the logs and if this happens, do this. So, there is complex logic that can be built with bash scripts, but this tells you the value of automation, although it is a basic example, not a complicated example. So, it shows the power of scripting in cloud automation and zero clicks whatsoever. I did not even SSH into the instance. I just checked from the website and everything was working. And that is the power of scripting and automation, which is why everything is going towards automation. AI is also doing faster automation and so on. All right, hopefully this was clear. Don't forget to terminate your instance if you don't need it anymore. DevOps engineering, site reliability engineering, platform engineering and DevSecOps. Four very crucial areas in IT as it relates to IT in general and software development in particular. It doesn't mean that you're going to be a developer to work in one of those areas. This module will help you understand what these areas are, their importance and how they relate to one another. So, let's go ahead and get started. So, let's start by exploring what's SDLC is, software development life cycle. When a team or a company would like to build an application or build a tool, what is the process? What's the workflow that from the time the need or the requirements and the planning were done all the way until the code is done, tested and deployed? This is called SDLC, software development life cycle. So, let's go ahead and explore that because it relates to everything we're going to talk about. Any application or software goes through several steps from the idea all the way to deployment. We have, let's say, the startup, the company or a business unit. They have requirements. So, these requirements are going to feed into a team and that team will start doing the planning. And in the planning, they would say, "Okay, this is what we need to build. This is how much it will cost. This is how much it will take. These are the required resources and so on." So, development team and project managers and all that are assigned. They start working on code and they start collaborating in a repo in a repository. Then we have the build and QA and testing teams that are going to be testing the code as it is developed or after it is developed. And depending on the manifests of tests that needs to be done, they will find out if there are any issues. If there are issues, they will send feedback to the developers and then iterate through this until the software and the code is ready. So, this is true for any software development. So, let's go go ahead and find out what are these steps. So, the software development workflow will go through the following steps. Planning. Then we're going to go through identifying the teams, the development teams, assigning the jobs to them and then they will start coding. After coding or maybe during, depending on which methodology they are going to use, there will be building of the code from the different developers. Then performing testing in order to find out errors or bugs or malfunctions in the code. And they will provide feedback to the developers depending on what happens, the results of these tests. And after that, if these all errors or all problems are solved, then we get into the releasing and deployment. Releasing means the software is ready or the application is ready or the new version is ready. And then deployment means it gets implemented in production. Then comes the operation and monitoring phase and then this cycle repeats as we enhance and add more features and so on. So, this is called the SDLC, the software development life cycle. Of course, it is critical if we need good quality software with less problems, less errors. The more we can automate in the steps, the better it's going to be, the less errors we are going to have, the faster it's going to be released. So, SDLC is a structured process used by software development teams to do what? To design, develop, code, test, deploy and maintain software. And this will provide us a step-by-step workflow or guide in order to be able to manage the entire life cycle from the planning all the way to monitoring and iterating through this process again. Benefits of following a workflow or a process step-by-step or SDLC, it will ensure that there is a systematic approach to the software creation across teams and it will provide a way to measure and improve the development process. We can look at every stage or every step in the workflow and find out if this is working as expected or not. And it allows for an accurate analysis the different steps, which one is working fine, which one needs enhancement or improvement. And depending on the methodology we use, we can test more frequently and build and test more frequently to find errors or bugs early in the process. And of course, the SDLC also will facilitate, if we do the automation, it will facilitate faster software delivery and higher software quality, of course, which is going to yield better user experience. Of course, that is the goal. But let's find out how was software development done the old way. So, the old way, we had the developers who are going to code and build, then they're going to ship the code over the fence, do a handover or handoff to the QA and testing teams. They will do their testing and then they will send it to the release team or the release manager team and say, "Okay, we have done all the tests. We need feedback. Everything works fine. Now it's time for you to decide with the operations team when to release." And we work with the operations team. Once it's done, then it is handed off to the operations team. So, as you can see, this is more like silos. They are working separate from one another. When each one finishes their work, they will pass it on to the next one, to the next one, and so on. So, there is no collaboration. There is no integration among the teams. So, they were discrete teams. Complex integrations, of course, because if you are going to finish all the code 6 months, 12 months, and then start testing, we are going to have a long list of issues. Lots of bugs, of course, and definitely a slow release process because we wait until all the development finishes before we start testing. We wait for all the testing to finish before it is ready for release. And we wait for the scheduling in order for that we deployed. So, that's very slow release and features are not going to be updated frequently. In the new way, and in order to reach our goal, the goal of automation, less human intervention, less errors, higher quality, faster releases, we need collaboration among the teams and we can't have the discrete teams that we have looked at. So, here we need to have an iterative process. Maybe every couple of days, we release, or maybe multiple times a day, which means we have to build and test more frequently and we have to get software ready more frequently. We have to deploy more frequently and that's how we need to enhance the user experience by adding features in a stable software, highly performing all the time. So, we expect teams to collaborate together and not to work in silos. There is going to be continuous and less complex integrations and errors, consequently, are going to be detected earlier. And this will yield a fast release process, which is what we are looking for. So, collaboration between the teams or marrying the teams together is an ultimate goal as opposed to allowing them to work in discrete teams in silos. Now, let's look at the different models and we are going to bring it from the history all the way to where we are right now. There are different models to our workflows that we can adopt or processes, if you will, in order to do the SDLC workflow. One of them, which is legacy, is waterfall. That's traditional. So, in waterfall, we expect that the development team is going to sit and work for 6 months or 12 months on the software and then when ready, it will be shifted to testing. And when ready, it will be shifted to operation or release and then operations. So, this is the old way, sequential methodology. So, we look at the requirements, we look at the design or design phase, coding or development, building and testing, deployment and operation and maintenance and monitoring, and only when this is done, then we can take new requirements and we can work on a different project. But of course, this is only or or can fit with uh projects that have well-defined requirements. Today, every day we need a new feature. We get customer feedback and then we need to build a new feature. The fact that we can have all the requirements up front with no changes for 6 or 12 months is very rare to happen nowadays. Releases here are very slow, every 6 or 12 months to have a release. And the testing is done manually. So, this is completely, as you can see, waterfall is completely off the goal that we had. Manual testing and it only happens after development is complete. And operation teams will deploy the code and of course, this is silos. And we are talking here about operations team and there is, whenever they have time, they are going to look at the code and look into deploying that. Then evolved Agile. And Agile is more of a set of principles or um methodology. It's not only about project management that is used in software development. Agile is an iterative and flexible software development methodology. Usually in Agile, we agree on a milestone. Could be a feature, it could be a release, and it it is divided into sprints. Let's say the sprint will be 2 to 4 weeks. We are going to work on code and every 2 to 4 weeks, we are going to test and release. So, the goal is to deliver working software more frequently. The waterfall had two issues. The first one is it does not accommodate new requirements during the workflow. Second thing, it takes very long for that to complete before testing happens and of course, a long list of errors and bugs and all that will be discovered and integration issues that needs to be fixed and it takes a long time to be fixed. So, Agile said, "Okay, fine. We are going to fix that. We are going to iterate through the process. So, we are not going to have one long process for development workflow. Development is too long and then testing is too long and release and deployment is too long. We are going to do that frequently and we can gather new requirements and we can add it into the new sprints, the new milestones, and we can work on it, test and everything, and release every 2 to 4 weeks. So, as you can see here, we have planning, we have a plan phase, we have design, coding, building and testing, deploy, and review, and then it repeats. So, we can launch or deploy and then we have again planning, gathering new requirements, designing, and so on. So, it is an process that repeats at high frequency or close intervals, so we can release at close intervals as well. And testing is continuous, but it's semi-manual. So, it is very close to what we wanted, but the testing is semi-manual and also 2 to 4 weeks is a bit long. So, we are still aiming for a better solution. And the release manager coordinates development team and operations team to work on the deployment, but of course, it all depends on how available are the operations team because Agile focuses more on the development phase and not on the operations phase. So, the limitations in Agile, before DevOps, of course, it was widely adopted to make software development faster and more responsive, as we explained. However, Agile ended at the code handoff to operations. So, once the code is ready, tested, and then release manager coordinates the deployment, that's it. So, is the operations team Agile? And the answer was no. It did not transform operations. It did not include operations in the Agile process. And that is a problem because now we have a team that is collaborating, the testing and QA and all that and developers, but then the operation is a different silo. And operations team, because they are not Agile, they still used slow manual processes. And this caused friction, of course, between the development teams and the operations teams. And that is what necessitated finding out a new solution to this, which is DevOps. So, let's talk about DevOps. DevOps increased the automation and also married development, QA testing, and operations. Brought all of these and blended them in one ball. And this is the team responsible for the software delivery. So, the problem before DevOps that Agile created a fast dev, slow ops bottleneck. So, we needed to fix that. The code was ready every 2 weeks, but ops teams deployed monthly or quarterly. And developers and ops worked in silos. These were the issues that we discussed. So, what is DevOps? DevOps is a set of practices, tools, and a culture mindset that combines software development, development, and IT operation. It brings both of them as a collaborative bigger team. It's a full software life cycle investment. And it's a team undertaking. It's not one person that will decide I'm going to do DevOps. It has to be adopted and managed by the team. And DevOps enables better software development and delivery practices because it's going to fix or solve the bottleneck caused by the operations in Agile. And it accelerates the last mile of continuous delivery. So, that means DevOps did not cancel Agile. However, it extended Agile beyond dev into the deployment, infrastructure, operation, monitoring, and maintenance. And it brought automation, collaboration, and shared responsibility across the entire software life cycle or SDLC, not only until the coding and testing is done as Agile did. Goals and benefits of DevOps. Faster software delivery. An improved collaboration between teams, more reliable releases, so more automation. And automated testing, deployment, and monitoring. That's the way we can have better quality, better scalability and performance, and it will promote the collaboration among the different teams involved in the software delivery process. So, let's look at the areas or practices that are now considered under DevOps. First one is continuous integration. Every time the developers are going to make changes to the code, they will commit that code in a repository, GitHub for example, and that is going to automatically trigger the build and test. So, every time there are changes, build and test is going to be run automatically, and then we get into the continuous delivery, which is once build and test are done and feedback is done, iterations have been taken care of and no errors now, then software will be ready for release into production. Also, infrastructure as code, which is scripting the configurations, all the infrastructures that you build, the resources that you need in Terraform, for example, scripts or uh Python scripts or maybe CloudFormation scripts and so on. Then we have automated testing to have less errors and faster testing processes. And then configuration management, which is all about centralizing and standardizing how the software and the applications are being configured and set up after they are deployed. Now, let's look at the first two practices that we have looked at, the continuous integration and the continuous delivery, and we'll add to that also the continuous deployment. Taking a step back, CI/CD is all about continuous integration, continuous delivery, and continuous deployment. And these are software development practices in DevOps that are aimed at automating software development end-to-end, including the marriage between the dev development and operations. This will yield better software, better higher quality, faster releases, and better user experience as well. Let's look at CI. So, CI or continuous continuous integration refers to the DevOps practice that is going to trigger automatically a workflow each time developers are going to commit code changes. So, developers, every time they commit code changes, so they make changes and they upload them or push them into GitHub, that is going to trigger the CI tools to build and test. And that is going to be the continuous integration. So, automatically triggering the build and test process and the iterations and feedback until the software is ready for release in a staging the environment, this is what CI is. Now, let's look at the other part of CI/CD, which is continuous delivery and continuous deployment. Both are CD. So, this is CI. Continuous delivery means then once the release, the software is ready for release, ready to go in production, there will be a manual process, manual approval, manual scheduling, and then it will go into production deployment. So, code changes to a staging, testing, or production environment after the code build step, but with a manual approval, with a manual process. So, this is dependent on the team's plans and decisions for release time, changes need to be released. In continuous deployment, changes that pass all the CI, the build and test steps are deployed automatically without human intervention. And of course, because there is no human intervention, this is going to be risky, and that's why it's not commonly used, not in the critical applications at least. What is more common is CI, continuous integration, and continuous delivery, releasing and making sure that it's available, and once it is reviewed or approved, then it will be deployed. Uh question that I get frequently is, do I have to be a developer, a full-stack, a back-end, front-end developer in order to be able to get in DevOps? And because this is very important and it causes a lot of confusion, I decided that let's go ahead and discuss it in a video. So, do you have to be a developer or a programmer to work as DevOps engineer? The short answer is no, you don't have to. But let's explain the two schools of thought and the reason why there is a lot of DevOps engineer jobs that will expect you to be a developer. So, based on the company, and it differs from company to company and project to project, the two schools of thought are one expects you as a DevOps engineer to be a professional developer, so you have been a developer and then you got into DevOps. And the other one would say, we only need you to have the fundamentals of programming. So, you have the logic, you know the data types and data structures, and also you can do scripting and you can do file operations, like simple stuff using code. And of course, Python would be the easiest to learn in that case. So, the short answer is you don't have to be a full-stack developer or a back-end developer, but you must know the fundamentals of programming. You must know how to write Terraform scripts, bash scripting, and you need to know at least Python at the basic level. Why do you need to have these fundamental development or coding skills? Because you need it, you are going to sit in meetings with developers. So, you need to understand their lingo, what they talk about. Also, you are going to write automation scripts, whether it is um bash scripts, infrastructure as code, configuration management, or automation through Python, all of these are going to be scripting that you're going to scripting skills that you will need. And also, you may write scripts using SDKs, Python is one of them. So, you can deal with AWS and you can deal with different infrastructures through programs that you write in Python. Very simple, this is not like when you need to learn everything about Python and become an expert. I'm talking about a 6-to-10-hours course that will give you all the required skills. So, don't freak out and don't leave potential and and shiny careers just because you don't want or you are scared to learn. Also, for monitoring and alerting scripts, you will need that as well. And the recommended coding skills that you need to have for DevOps, Python or Go, Python has I think won the the deal, so now it's Python and Python. Bash or PowerShell, I would go with Bash because most of the servers you are going to deal with in the modern IT are going to be Linux, and Terraform for infrastructure as code, and Ansible for configuration management. These will be the ones that you need to learn. As DevOps evolved, we found out there is some area that has been overlooked by DevOps, and that is once the software is released and deployed. Who looks after the reliability, the performance, the availability, the uptime, the capacity planning of the infrastructure for the deployed releases and the ones that are coming up? Who's going to deal with incident management? This is not DevOps. Who's going to be awake at 3:00 in the morning when there is a problem trying to fix issues? That is not DevOps. So, DevOps overlooked these areas, and that's why the evolution by Google for the site reliability engineering emerged or surfaced, and it has been out for quite some time now, and it's gaining more popularity. Because it looks at the entire thing as a system that needs to be reliable, and it focuses on uptime, and it focuses on a lot of other things. So, let's contrast SRE to DevOps and see what are the difference between them. So, DevOps focuses more on the speed than on the stability and reliability of releases. So, we need to make sure that they don't have bugs, there are no errors, and they will be released more frequently. But once deployed, maybe they will be performing, maybe they will not be performing as expected. So, who looks after that? Not DevOps. DevOps does not define a role that focuses on the overall reliability of the deployed systems or applications. SRE will fill this gap. So, SRE will mainly look at the reliability and the performance and the uptime of releases and applications after DevOps. So, what would a site reliability engineer focus on? Incident response and reliability metrics, uh so they will have a lot of tools, logging tools, monitoring tools that will look at service level indicators, SLIs, service level objective as well, as error budgets. So, that's their focus. Root cause analysis, when a problem happens, finding out what happened and why it happened is also what the SRE should do. So, this is the one that will be notified at 3:00 in the morning to wake up and see what the problem is and fix problems and all that. And this is usually a team, not an individual. If we contrast DevOps and SRE, the focus of SRE is reliability and uptime and performance. Whereas the DevOps is the faster delivery of software and the frequent release. SRE will be more into the operation side, incident response, monitoring and alerting and capacity planning for the infrastructure. Whereas DevOps will focus on CI/CD, release automation, automating the process, environment builds to deploy the software on, and code configuration management as well as infrastructure as code. So, SRE and DevOps are different. Skills are different. However, the core skills are the same. You can't expect the SRE to go ahead and fix a problem in a Kubernetes cluster that is faulty without knowing Kubernetes. And you don't expect them as well that they are going to work or troubleshoot something in the cloud if they don't know the cloud. They would go into systems and find out why it happened and look at logs. So, they have to know about logging solutions. They have to know about Linux. They have to know about Bash. So, they have to know about a lot of things or the common skills are the same. However, when it comes to monitoring, uptime, capacity planning, and so on, these are specialized tools that are used by SREs more than DevOps. DevOps is going to focus on tooling or tools and pipelines that help developers in the software development life cycle to build, test, and deploy code quickly and automatically with less errors and high quality. Whereas SREs will focus on keeping the systems reliable, the applications deployed, the software deployed, and make sure that it is scalable and available in terms of uptime. So, they are going to use software engineering and tools in order to monitor these criteria or metrics and make sure they are up to expectations. DevOps will include CI/CD, infrastructure as code, configuration management, automated testing, and monitoring to an extent, not the full-fledged monitoring like SRE. Whereas SRE will include things like the error budgets, service level indicators, service level objectives that will be the focus of SREs. So, SRE is a way to implement DevOps, especially in large-scale complex systems. So, can there be a DevOps team and an SRE team? Absolutely. They can coexist because the focus is different. DevOps is going to take care of everything until deployment. SRE is going to take over from that point and make sure that it is reliable and up and running without any issues and up to the performance expectations. Here is a real-world example that shows how can DevOps and SRE work together. So, if we have a company like Google or Netflix, for example, the DevOps platform team or the DevOps team is going to maintain Kubernetes clusters, build CI/CD workflows, support thousands of the developers with the right tools to automate the process. The SRE team for a specific service or the entire infrastructure, the applications will ensure that the uptime meets the expected percentage, 99.99, for example. It will handle global traffic. If there is any issues or bottlenecks, they will figure it out and fix it. And it will make sure that they also deployed infrastructure or applications, they will scale on demand. And even if there is high traffic, it will still keep the performance expectations. So, this is DevOps and SRE. So, they are complementary and they are not mutually exclusive. It's not that you have SRE, so you don't need DevOps, or you have DevOps, so you don't need SRE. You need both. Or in some companies, smaller companies specifically, the DevOps person or the DevOps engineer is now requested to also deal with the uptime and the logging and the monitoring and all that as an SRE/DevOps. This is all good, but as we scale, we have problems. So, that's caused the emergence of what we call platform engineering that we are going to introduce next. A new concept that is evolving and being adopted right now is platform engineering. For the past couple of years, it has been a hot topic. And the reason why it evolved is because we have faced issues scaling DevOps. And also ensuring governance and standard standardization as we scale DevOps was an issue as well. So, let's understand the issue. I know maybe this will sound or will feel like above your head at this stage at the fundamentals, but you can always come back and reference this lecture when you hear the term platform engineer to understand what it is. It's It might not be relevant right now. Maybe it's 6 months, 9 months down the road in your career, but come back and watch the video again if you feel it's an overwhelm at the moment. So, what are the issues with DevOps? Two things. Number one, DevOps teams are getting overwhelmed. They have so many tasks they have to worry about, including building and running the infrastructure, running Kubernetes clusters, CI/CD pipelines, infrastructure as code scripts and deployment, security, as well as monitoring to an extent. And this is not limited to one tool in each one of these categories, but it could be multiple skills, multiple clouds, multiple tools that they need to work on based on the requirements from the dev team. And of course, that is overwhelming. That's the the first issue with DevOps. Since they are getting overwhelmed, they are becoming a bottleneck. So, they are slowing down processes. They are slowing down development teams because they can't cater or scale to the requests and requirements and the skills they need to learn at the same time. So, now the developers or development teams are being held back because of DevOps. And this is kind of contradict the main purpose of DevOps, which was to speed up and ensure faster delivery and so on. That's issue number one. Issue number two is as we scale DevOps, one of the solutions would be, since DevOps engineers are overwhelmed, let's not centralize that in one team. Let's have DevOps engineers in different projects with the different development teams. So, have application one, for example, has a group of developers, and let's say they need to use a set of tools, then let's get a DevOps engineer or two that they work work with them and they are proficient in these tools. App two, another tech stack, let's get them one or two DevOps engineers that can cater to these skills. App three team, also get them one or two DevOps engineers for their tech stack. But this be this becomes an issue because there is no consistency in the technology and tools used across the different teams. And there is no standardization in terms of security or even governance. We cannot have a policy that will be across because we have different teams working with different tools with different requirements. And we can't keep up on how the DevOps engineers are setting these tools. They could be secure, they could be not secure, they could be following best practices and maybe not. Of course, this will be an extra cost to the to the organization. The scripts and the stuff they would be using, since they use different tech stacks, the reuse is going to be minimal. And it will be harder to troubleshoot. I cannot even move DevOps engineers now between the different projects because they are proficient in what they do, but they don't know what's happening across in the in the other team or in the third team. So, because of these two issues in scaling DevOps, platform engineering emerged as a solution to this. And basically, what platform engineering is all about is why do we have to have developers wait for DevOps engineers to do stuff for them. Why don't we build the platform that can do all the automation they need? They can build repositories in GitHub. It can build pipelines. It can do uh infrastructure in the cloud. It will have all everything they need, and they can do it in a self-service fashion. So, basically, they log into that platform, they click, and then a repo is created. They click again, and then a Kubernetes cluster is deployed. They click third time, and there is a CI/CD pipeline. So, platform engineering is a discipline of designing and building tool chains and workflows that enable self-service. That is the bottom line. So, this is for software engineering organizations in the cloud-native era. That's what we need. So, the whole purpose is to build something called the internal development platform. That internal development platform, it will integrate or it will have all the tool sets that are required. So, for example, Kubernetes, OpenShift, Docker, Terraform, Jenkins, GitLab, Pulumi, Git and GitHub, GitHub Actions, Python. All the tools and the integration with the cloud environment is going to be ready-made. And then there is a portal where the users or the developers can log in, and then they can select, "Okay, here is what I need." They will tick a box for CI/CD pipeline. They will tick a box for uh AWS Azure Kubernetes cluster. They will tick a box for a GitHub repository. They will tick a box that I need monitoring using this tool. And it will be all done in the background for them without them having to wait for anyone to do it. That's what it is about and now the development teams, they can self-service their requirements and they don't have to wait for anyone. That's the core of platform platform engineering. So the internal developed platform is a self-service system that allows developers to do the following. Deploy code without worrying about infrastructure. In the infrastructure will be taken care of which used to be done by the DevOps engineers. Monitor their apps with minimal setup and run tests, stage environments or rollbacks easily. So they are doing the build and tests and stuff like that. Launch new services using templates and the ones who are going to build this platform, the platform engineering team is going to be proficient about these tools, the security requirements, the company policy and all that stuff. So they will set this properly such that the users of the platform which are the development team can work on that. So the platform engineer role is to build and maintain a reusable IDP including tools and system that will make it easier for developers and operation teams to build, test, deploy and run applications efficiently without having to wait for a human DevOps engineer to build stuff for them which might be a bottleneck. Platform engineering involves setting up cloud infrastructure. So everything that used to be done by the DevOps engineer. DevOps tools, operating systems, database servers, containers, Kubernetes orchestration tools according to best practices. Let's look at a real-world example. How the platform engineer play with DevOps and SRE. How in a big corporate. Of course, when you talk about platform engineering, we're talking about big corporates. We're not talking about a startup that has few people. However, in the job market, you might find platform engineering required for a smaller company. Basically, what they expect is they expect everything. They would expect it to know the DevOps, to know the SRE part and to know also the platform engineering part. So a company wants to deploy 100 microservices in Kubernetes. So the platform engineer, what they will do is they will build a self-service portal where developers click a button to get the following. A repository, a working CI/CD pipeline, a deployment target which could be the Kubernetes cluster for example. With built-in monitoring, logging and alerting hooks. And this will make the deployment feel easy to the developers. The DevOps team will set up Argo CD which is required for GitOps, Helm charts and CI/CD pipelines. A common question I get about this one is, would platform engineering kill DevOps? And the answer is no. They need to do work even if they are part of the platform engineer. The platform engineer needs to know all these services including CI/CD and how to set up the tools and all that stuff. So the platform engineering team will have DevOps engineers within because they need to be proficient in the different DevOps tools. So it could be shifting the jobs from a DevOps engineer into platform engineering team. Or it could be that I'm going to have DevOps engineers within the platform engineering team to set up the DevOps tools properly according to best practices. And maybe the development team are going to have a DevOps engineer that will be proficient in how to use the IDP, the internal development platform and the DevOps engineer will be working on that. So the short answer is platform engineer is not going to kill DevOps. It requires the skills of DevOps engineers. So this is what the platform engineer does and this is what the DevOps engineering will do and SRE will be handling the monitoring, the uptime, the SLIs, the SLOs and being on call and handle capacity planning and so on. Since you might end up being into security and we discussed DevOps, then it makes a lot of sense to look at how we can secure your pipelines. How we can secure it from the inception of the code by the developers all the way until it is deployed and ensuring who has the access and authorization to deal with these applications. DevSecOps is what looks after all of this. So let's find out what that is and there is a lot of people that are interested in building cloud as cloud security engineers and part of that is going to be DevSecOps. So DevSecOps stands for development plus security plus operations. So we have Dev and Ops and then we have Sec on top of that. So it means integrating security practices and tools into every stage of the DevOps pipeline. From planning and coding all the way to deployment and production monitoring. So in short, DevSecOps is security of the DevOps pipeline and the automation scripts and everything you use in DevOps. If you look at the different phases and how DevOps is going to act in each one of these, when you are doing the planning for DevOps, you have to include security requirements and threat modeling in design discussions. When coding, we need to use static code analysis tools, the SAST to catch vulnerabilities very early. And when you are building before testing, building the application, integrating the tool the software together, then we need to scan dependencies for known common vulnerabilities and exploits or vulnerabilities using tools like Snake, Trivy and Dependabot. And for CI/CD, of course, we need to automate security tests in pipelines for secret scanning, policy checks and so on in the code. The short or the summary of this is you have to think security in every step from the planning before the coding, through the coding and during building and when you are doing CI/CD testing as well, that should all include security tools to scan to ensure that you don't have backdoors in your code and you don't have any vulnerabilities in your code and so on. Moreover, when you are thinking about containers, you have to scan container images for vulnerabilities. You need to make sure that they are clean as well. When you are working on scripts infrastructure as code, you can use tools like Checkov and Terraform Sentinel to ensure secure infrastructure definitions and you don't have credentials for example in your code. For the secrets management, passwords and so on, licenses, keys and stuff like that, you need to use HashiCorp Vault secrets manager in AWS or sealed secrets tools where you can store these credentials without having to embed them in your code. And for production monitoring, of course, we need to look for security events and misconfiguration or drifts and there are tools to help you do that like Falco, OSSEC and AWS GuardDuty etc. So again, the message is think security in in every action, in every step, in every technology, every code, every image you are using in your DevOps. Congratulations on finishing up the course. Hopefully, it was interesting and you have done all that hands-on demo labs and all the practice examples and all that yourself in order to cement the knowledge. Again, if you would like to get more knowledge and more depth into this course, you you want to get more design assignments, more practice, more hands-on labs and also the IT tools track line that will give you a 50,000 ft view of what is Linux, what is Git, what is GitHub, what's Docker, what's Kubernetes, what's Bash scripting and Terraform, what's Docker and Kubernetes, this is going to be available on our website and you will also support us in creating more free content like this one at this quality for you to enjoy and for you to grow as well. This course can The supplementary material can be found at www.dolphinet.com/courses/ITF-course. Thank you very much for watching and looking forward to meeting you again in future videos.
Generated algorithmically for Search Engine
Indexing.