Networking Basics

Networking Basics

You will learn about the basics of configuring and determining network information on the Linux OS.

This module will not cover any networking theory, it is expected that you'd learn those topics in ICS 184. This module we will look at how to configure Linux networking interfaces using both static IP addresses and Dynamic IP Addresses (here are examples ). We will also look at ways to troubleshoot our Linux system if we are having connectivity issues.

Static IP

When a static IP is configured on a system the system will always maintain that IP Address. In other words, the IP Address does not change. It is configured to always be the same IP Address. This has many advantages when running a server. Just imagine if the IP Address changed all the time of a webserver. You'd have to continuously update the DNS entry to point to the new IP Address. Also, if you are running PAT (Port Address Translation) you'd possibly have to update your firewall rules to work with the new IP Address. These are some reasons why we like to use a static IP.

Dynamic IP

When a system is configured to use a dynamic IP the address can change. With a dynamic address you are relying on a DHCP Server to provide you with required information to be able to communicate online (IP address, subnet mask, default gateway, and DNS servers). Using dynamic addresses does make configuration easier as you do not need to manually configure all the networking information.

Static vrs Dynamic

Both static and dynamic addressing are useful and have their places for use. It is important to understand how we configure Linux to support either of these options. You can read more about the advantages and disadvantages.

ip & iw

The ip command is very powerful in Linux. This command can display your IP address, your routing table and even enable or disable interfaces! You can also use the ip command to configure a static IP address! I highly suggest you read 10 Useful IP Commands to Configure Network Interfaces as it provides you with common uses of the ip command.

If you are running Linux on a laptop you will want to be familiar with the iw command. This command allows you to manipulate wireless interfaces. Though, most of the time if you are running Linux on a laptop you will have a GUI and most likely access to wireless configuration tools. Though, if by chance your GUI does not provide a wireless configuration tool it is possible to configure a wireless interface on the command line.

https://linux.die.net/man/8/ip

https://linux.die.net/man/8/iw

https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/

On some Linux distros you might come across two deprecated commands: ifconfig and iwconfig. I want to just mention these as they have been replaced by ip and iw.

hostname

The hostname command is a very simple command and is useful for showing the hostname information of your Linux system.

https://linux.die.net/man/1/hostname

dig

The dig command is a powerful command. This command is used to learn DNS information. When you use the dig command you are querying a DNS server and are asking it to provide you with information about DNS records. These DNS records could be host addresses, main exchanges and even name server.

The video shows various uses of the dig command to gain information. The image shows what the output of the dig <domain> ANY would look like.

https://linux.die.net/man/1/dig

I highly encourage you to read and test the commands in the 10 Linux Dig (Domain Information Groper) Commands to Query DNS article.

traceroute

The traceroute command is a great utility to determine if you can reach a specific site. If by some reason you are not able to reach a site it could mean routing issues or even DNS issues. The traceroute command can also help to determine a slow portion of the route data is traversing.

https://linux.die.net/man/8/traceroute

tcpdump

In ICS 184 you probably learned a bit about packet capturing and using Wireshark. Well, tcpdump is a command line version of wireshark. It just does not provide you with a pretty GUI and advanced features.

If you run this in a VM on your host OS you might need to provide the VM permission to monitor the network. In the video you can see I had to do this on my Mac Laptop.

https://linux.die.net/man/8/tcpdump

https://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/