Table of Contents
As a starting point lets review a document from "The Linux Documentation Project" named Introduction to Linux/Networking for our introduction to Linux Networking.
When it comes to networking, Linux is your operating system of choice, not only because networking is tightly integrated with the OS itself and a wide variety of free tools and applications are available, but for the robustness under heavy loads that can only be achieved after years of debugging and testing in an Open Source project. |
||
--The Linux Documentation Project Introduction to Linux/Networking |
We are going to start by looking at the network manager from Ubuntu 12.04 as a starting point.
This is the opening screen of the network manager. You will notice that we are looking at the page for Wired connections. There are also tabs for Wireless, Mobile Broadband, VPN, and DSL. For this talk we are only going to deal with the wired and part of the wireless tab.
Next lets look at the entry Auto Ethernet when you choose to edit it.
This tab is displaying the Device MAC address:. This is a hardware serial number which is supposed to be globally unique. I say supposed to be because some modems allow you to set the MAC Media Access Control address.
The next item of interest is the MTU. This is a packet size setting, which is normally best left to Automatic because the maximum transmission unit (MTU) is not needed except for some uses by a modem.
Now we will look at the IPv4 page.
This page is where we specify how the ip address, gateway, DNS, and search domains are set. In this example you will notice the method is set for Automatic (DHCP). By using Dynamic Host Configuration Protocol (DHCP) we let the computer decide what values to use when connecting to the network. This method is convenient when the network routers are set up correctly.
But suppose you want to use fixed values for your network addresses. In many businesses it is common to use fixed IP values for the servers. So here is a page showing the setup for a Static IP.
Let have a look at the items on this page one by one:
Addresses: This is the section which contains three fields of interest.
Now we have see how to setup the network when we have a graphical interface. But what happens if we only have a command line.
In this tutorial we will be combining troubleshooting and network configuration so hang on for a wild ride. But first let me say that this is only my take on how to perform the tasks.
I am going to use a series of question and answers because that is the best method I know for troubleshooting network issues. I will assume you have logged into the computer and have a bash shell prompt. I am going to use the devices eth0 for a wired connection and wlan0 for a wireless connection.
First step is to check if you have a working connection. To do this we will start by looking for an IP address.
ifconfig eth0
or
ip addr show eth0
will display IP information. If you were looking for a wireless IP address use wlan0 instead of eth0.
Checking for a route to the gateway use
route eth0
or
ip route
cat /etc/resolv.conf
will display the name server information.
iwconfig
will display the network cards, especially the
wireless cards. In the future the command will be
iw list
but that does not
work yet on my network card.
ifconfig eth0 192.168.2.2 netmask 255.255.255.0
or
ip addr add 192.168.2.2/24 dev eth0
will set eth0 to the ip address 192.168.2.2 with a netmask of 255.255.255.0/24.
route add default gw 192.168.1.70
or
ip route add default via 192.168.1.70
Sets the gateway for the eth0 card to eth0.
nslookup www.google.com
This command will attempt to convert the name
www.google.com to
an IP address. If DNS is working you will get back an IP
address. If this command fails, you need to assign some
nameserver addressed in the field /etc/resolv.conf
.
nslookup server 8.8.8.8 www.google.com
This will attempt to use the name server 8.8.8.8 to look up the IP address of Google. This is google’s name server so we would hope it knows where to find Google.
ping -c4 www.google.com ping -c4 168.100.1.2
The ping command allows you to sent a simple packet to a computer which responds by returning the ping. In the first case you are using a name server to look up www.google.com and then send a ping request. In the second case, you are supplying the IP address so no name server look up is needed.
ip route ping -c4 <ip address of gateway>
This allows you to make sure your computer can talk to the gateway computer. Sometimes DHCP will give you a gateway address which is not active or not in your subnet.
whois <URL>
When you get a strange link in an email, you can check if the owner of the name is someone you want to talk to. If there is no information available for the URL it is a good bet this is a malware address.
Here are three web sites which can help answer this question
This last site What Is My IP has a number of tools to look up more information on the Web.
This document GNU/Linux Networking Tutorial for Newbies is a good source of information, although it is detailed.
Linux Networking Clearly Explained deals with setting up a Modem and other low level networking issues.
Your Linux networking journey starts with the fundamentals— setting up your modem and creating an Internet connection. This chapter fully surveys the knowledge you will need to create such a connection successfully. |
||
--Bryan Pfaffenberger Linux Networking Clearly Explained |
This book covers the details needed for PPP, and modem communications. Even though this is no longer needed by most people, it is still of use to some, so I included it here.
Linux Networking Cookbook is a how to from O’Reilly
So there you are, staring at your computer and wondering why your Internet connection is running slower than slow, and wishing you knew enough to penetrate the endless runaround you get from your service provider. Or, you’re the Lone IT Staffer in a small business who got the job because you know the difference between a switch and hub, and now you’re supposed to have all the answers. Or, you’re really interested in networking, and want to learn more and make it your profession. Or, you are already knowledgeable, and you simply have a few gaps you need to fill. But you’re finding out that computer networking is a subject with reams and reams of reference material that is not always organized in a coherent, useful order, and it takes an awful lot of reading just to figure out which button to push. |
||
--Carla Schroder Linux Networking Cookbook |
This book has several interesting chapters, for those of you dealing with sophisticated networking this book has answers and explanations.
Here is a list of the sections in the book.