LPI 010-160 – Networking Basics part 1
- Network Features
Networking is a critical part of modern computing. Most Linux distributions are already capable of creating network connections automatically for you. On some rare occasions, though, this process simply doesn’t work right. Or there may be a need to tweak the connection or debug a problem that’s occurring. To begin, there are some common networking terms and definitions that we need to discuss. DNS is our first one. DNS is the domain Name system. And DNS is a global network of servers that translates between host names and IP addresses. I like to think about this like the Internet phone book. If you think about the old phone book, you could look up my name Jason Dion and you’d get my phone number 5555.
Well, the Internet works the same way. When you look up deon training, you get an IP address back so that your computer knows where to go. DNS is what does that. Next we have Dhcp. And Dhcp is the dynamic host configuration protocol. This is a way for computers on a network to be able to obtain configuration information from another computer on the network. And so when I connect my computer to a new wireless network, my computer connects to the Dhcp server and the Dhcp server says jason, your laptop is going to be known by this IP address with this subnet mask, this DNS server and this gateway. Dhcp does that all for you automatically.
Next. We have Ethernet. Now, Ethernet is a wired network hardware that’s used by most computers today. Even if you’re using WiFi, you’re still technically using Ethernet because you’re doing wireless using the Ethernet standard over the airwaves. But if you use an old school method of plugging your computer in with a Cat Five cable, that is Ethernet as well. Next. We have Hostnames. And Hostnames is the name a computer gets for the benefit of us human beings because we as humans like things that are easy to read and remember. So for example, instead of remembering the Mac address of my computer and trying to reach it that way, you might remember server deontraining. com.
And that’s easier for you as a human to remember because host names are going to contain a computer portion of this which is server and then this network portion deontraining. com. You can put those together to get the full hostname and be able to address it. Next. We have the Internet. And as you know, the Internet refers to the globe spanning network of interconnected computers that we use the standard Internet Protocol Suite, or TCP IP to communicate over. When you’re watching this video, you’re on the Internet. So I think you know what the Internet is. Next one we have is an IP address, and I mentioned these earlier.
This is like a phone number for a computer. It’s going to tell you how to be able to reach it, right? An IP address stands for Internet Protocol Address and it’s a number assigned to a computer for network addressing purposes. For example, if you want to get to Google’s DNS server, its IP address is actually eight. Eight computers communicate with each other by these IP addresses. And in the old days, we had a four byte iPV four address, which is something like eight eight eight. Each number could be anywhere from zero up to 255 in each of those four octaves. But recently, we’ve been starting to work towards these new IP addresses called iPV six, which are 16 byte addresses or 128 bits. Most of us, though, are still using iPV four.
And over the next five to ten years, you’re going to see iPV six take over an iPV Four move to the wayside. Next, we have a network mask. And a network mask is a way to distinguish between the network and the machine portion of an IP address. So if I gave you something like 192, dot 168, dot one, dot one, and the subnet mask was 255 dot 255, dot 255, dot zero, the three sets of 255s tells me what the network portion is. In the case of this example, 192, 168 one, the last dot one or that zero inside that subnet mask is what tells me what the computer is. So this computer is the one computer on the 192, 168 one network.
That’s how we use these subnet masks. So between your IP address and your subnet mask, you’re able to figure out which computer it is and where it’s located. Next, we have a router. Now, a router is a device that connects two or more networks together, and it serves as a gateway between those two networks. When you want to connect your computer to the Internet, there’s actually a router between you and the Internet that does that. Now, to be able to find that router, we have to have its IP address, and the IP address of that is known as the gateway.
So this router is going to link together with another network, and that might connect to another router, and another router and another router until you get from one computer to the server you want on the network. Now, homes and small businesses often use a single device that combines a switch, a router, and a modem altogether. This is how you connect to the Internet if you’re using something like a cable or a DSL line. But in the real world, once you get out into big networks, we have dedicated routers that do these functions. These things might also have built in DNS, Dhcp and other useful services for you. Then we have TCP IP.
Now, TCP IP is a set of standards that underlie most modern network connections at the software level. TCP stands for the Transmission Control Protocol. And IP, of course, is Internet Protocol. TCP IP is the backbone of the Internet and all of the things that we deal with on a daily basis. Next, we have the term WiFi, and you’re probably familiar with this term. It’s a common name for wireless networking. More specifically, the IEEE 800 and 211 standard. All right, so that was a lot of definitions. Now, let’s bring this all together of how this works in the real world. Now, the process of creating a network connection is to assign a computer with an IP address and an associated net mask.
In fact, there are four things you need to have a valid network connection if you’re a computer. And I talked about these back in the Dhcp address, we have an IP address, a net mask, a router’s IP address, and the DNS server’s IP address. You get all four of those things. You have the of being able to make a network connection. Now, I do want to note something with net mask. In Linux, we call it a Net mask. If you’re dealing with a Windows machine, it’s often referred to as a subnet mask or a subnet either way is okay, but for the purposes of our course, you may hear me refer to it either way, either as a net mask or a subnet mask.
- Configuring a Network Connection
Now, in most cases the network connection is going to come up automatically for you. Sometimes, though, the configuration has to be adjusted manually or you have to activate it yourself depending on your Linux distribution. If it’s available, automatic configuration will be handled by the Dhcp server and the Dhcp protocol on your Linux machine. As discussed earlier, a computer requires at least two key pieces of information for it to be able to connect to a typical computer network. This is your IP address and your net mask. However, configuring every computer on a large network with all of this information would be really, really time consuming.
Worse, it can also lead to problems caused by human errors such as typos in the IP addresses or subnet masks for this reason, most networks are going to provide a Dhtp server and this server will provide the information needed to all of the other computers on your network. Now, depending on the configuration of your Dhcp server, dhcp can be used to deliver IP addresses in one of two ways. You can either do it fixed or dynamic. When you’re using a fixed Dhcp scheme, each computer is going to receive the exact same IP address every time it boots up. So essentially, your Dhtp server remembers who connected to it before and it always gives them the exact same IP.
Now, the other way is what we call dynamic and with dynamic each time a computer connects it’s going to receive an IP address from the Dhcp server but that IP address may be different each time. Now, when you’re dealing with WiFi connections, these are most often going to be used on laptops and portable computers, smartphones and tablets. And because these devices don’t have a physical network cable, they often have to use wireless networking capabilities. Again, they’re usually going to use Dhcp to configure their network, but you can also configure them using a static IP if you desire.
Now, a lot of newer desktops also have WiFi capabilities because WiFi is growing increasingly popular across both organizational networks, business networks, and home networks. Whatever type of computer you have, the easiest method of configuring your wireless connection is going to be using your graphical user interface. The details of how to do this is going to vary from one distribution to another. The graphical user interface method is going to allow you to establish a WiFi connection almost the same way that you do it in a Windows machine. Now, to fine tune that connection the user can then use various tools to probe and manage wireless links.
The two most important tools that we use is IW list and iwconfig. Both of these are terminal commands that you’ll enter through the shell. IW list is a command that can identify nearby wireless networks if you type IW list scan or IW list scanning as the root user you’re going to get a list of the nearby networks that you may want to connect to the second command is known as iwconfig. Now, this terminal utility is going to connect to and disconnect from specific wireless networks. Again, if you’re using the graphical user interface though, you don’t need to use these two commands because it’s going to do it all for you automatically.
If you’re trying to set up your wireless connection through the terminal, though, IW, List and iwconfig are very important. Now, in addition to the wireless graphical user interface network configuration tools, there’s also wired network configuration tools as part of the GUI too. These are easy to use and they work really well most of the time, but sometimes you need to get a little bit more in depth and you want to have more flexibility. And so that’s when we go to our shell and use our terminal tools instead. The first of these tools is known as if config.
If configig is a program that will bring up or shut down a specific network connection and associate an IP address and network mask to a particular piece of network hardware like your network adapter, I’ll show you how to use if config in the demonstrations. Next, we have Route, and Route is a program that will adjust the computer’s routing table. This will tell the computer how it should send its traffic throughout the network based on specific network packets and the specific paths and routes you want set. Next we have Slash, Etc, Resolve, Co, and F.
This is a configuration file, and it’s going to contain the IP addresses of up to three DNS servers, as well as the name of the computer’s Internet domain and all of the other domains that should be searched when a user doesn’t put in a domain name from the host name. So if I open up a web browser and I type in Jason and hit Enter, that’s not a valid domain name, but if I had Json listed inside of my Resolve config file, it would actually know what IP address to use because I manually made that association. Next, we have a Dhcp client, and a Dhcp client program like dhclient or Dhcpcd can often configure a network connection automatically for you.
Again, your Dhcp protocol should be set up properly on your machine through the graphical user interface, but if it’s not, Dhcp client can do it for you from the command line. We also have distribution specific networking scripts. Depending on the distribution you’re using, there may be already configured scripts that you can use. This is because the ifconfig route and Dhcp client programs will produce temporary changes to your computer’s network configuration. But if you want to make those changes permanent, those settings have to be stored in some kind of configuration file. The name and format of this file is going to vary from one distribution to another, and so a lot of them have created scripts to make it much easier for you to use.
- Network Testing
In most cases the network connection is going to work fine from the moment you start up your Linux system. However, sometimes there’s going to be an issue and you may need to diagnose these problems either because a formerly working connection stopped working or it never worked at all. Now, in this video we’re going to describe several types of tests that you can do to check for network connectivity. The first test for network connectivity is by checking your routing table using the route command. You want to make sure that the default route has been set and you want to check that routing is sensible and makes a lot of logical sense in the way that things are being routed around your network.
In most cases if you type route by itself and hit Enter, this will do the job. You’ll be able to see the routing table and the routing table of a typical workstation or server is really quite simple and can be automatically configured by itself. On the other hand, network routers will often have complex routing tables which are way beyond the scope of this lesson and this course. If you’re going to be working on network routing devices and trying to set up routers and switches, you really do need to get into a networking class to dive into that topic in depth. The next tool we have is the most basic network test that we have. It’s known as Ping.
Ping is going to send a simple network packet to the system that you tell it to based on its IP address or hostname and then it’s going to wait for reply. Now in Linux, whenever you use Ping it’s going to keep sending out packets 1 /second until it’s interrupted by you when you enter the control C keystroke. This will cancel the command and stop it. If you’re doing this on Windows it by default only sends out four packets and then stops. By using Ping, you can help determine where the problem resides in your network. For example, if you can ping your local systems but you can’t ping a remote system like my web server or Google, then the problem is probably your router or there’s an improper route that’s been specified.
Now, if you can ping the IP address but you can’t ping the name of a device. This means you probably have an issue with your DNS server or your DNS configuration if you can’t ping it at all. Neither local nor remote, not by hostname, not by IP address. Well, you probably have some kind of fundamental configuration problem within your network device. Now another way for you to test your network connectivity is to test for breaks in that connectivity. For us to be able to do this, we use a command known as Traceroute. Now, Trace route is actually going to send a series of three test packets to each computer between your system and a specified target system.
Basically, it’s sending multiple series of pings to different locations between you and the destination server. Now, among other things, trace route is really helpful for determining where a problem exists in the network connectivity because as you get those responses back, you can find out if it’s your router, your ISPs router, or a router downstream all the way down by the server that you’re trying to connect to. Trace route is really, really helpful to figure out where that problem is next. We have domain name servers. And domain name servers are the Internet’s equivalent of a phone book.
They maintain a big directory of all of the domain names and translate them into IP addresses. Now, this is necessary because although domain names are easier for us as people to remember, for computers and machines, they like to do everything based on numbers. And so you can actually have issues where if you have a DNS problem, you can’t translate the name to the number. For example, when you go to watch my videos, you’re going to go to deontraining. com. Well, your computer doesn’t really know what deon training is. Instead, it knows what our IP address is. And so a DNS server will do that conversion from deon training. com to its associated IP address.
Now, DNS problems can cause networks to fail almost as badly as a physical cable being cut. And this is again, because you don’t know IP addresses for all of the things you need to access, you just know the names. You know deon training. com or Google. com or Facebook. com or whatever it is you’re trying to access. Now, because both people and many network tools rely on these host names, if DNS resolution doesn’t work, the network becomes essentially useless. You can test your network’s DNS server by using a number of different tools like Host, Dig or NSLookup.
Another useful diagnostic tool is known as Netstat. Netstat is kind of the Swiss Army knife of networking tools because it can be used in place of so many other things depending on the parameters that you pass to it. For example, if you use the A or all options, you’re going to be able to see all of the ports on that server that are open and listening for network connections, in addition to any of the already open connections and what their status is. If you want to learn more about Netstat, I highly recommend taking a look at its man page by typing man space netstat and hitting Enter at your terminal prompt.