Linux, the popular open-source operating system based on UNIX, is fast becoming standard in today’s network infrastructure. Have you ever set up a Linux box to talk on your network? If not, then this lesson on Linux basics may help you understand how to connect your Linux machine to your company’s LAN.
Configure your Linux box to connect to the network
To make this process simple, we’re going to set up the network in the GUI. This way, we have a friendly user interface to use when configuring the box to connect to the network. I personally use GNOME, but you should find that you have the same experience if you use another GUI, such as KDE.
To start this lesson, you need to be logged into your machine as root. If you have already signed onto the machine, open Xterm and type in the su command to gain administrative privileges to root. After typing su, you’ll be prompted for the root password. Type in the password and press [Enter] for root access.
Now that we’re in root, type in netconf in Xterm. A window will appear labeled Network Configurator, which will allow you to configure a TCP/IP network from scratch by using either an Ethernet connection or modem. You’ll have several areas to choose from to put in information at this point. We’ll start from the top of the list and work our way down.
Basic host information
Your first task will be to put in your basic host information. Click on the Basic Host Information button, found next to the icon of the computer with keyboard. This will open a window called This Host Basic Configuration. From here, you can configure the computer host name and the adaptor that you will be using to connect to the network.
Under the host name tab, you will see a blank where you can enter the host name of the Linux box. You can either make up a host name, or you may need to acquire a name from your network administrator.
Next, you’ll see a tab labeled Adaptor 1, followed by 2, 3, and 4, which has the information about your Ethernet cards, your IP addresses, primary domain names, and more. Upon clicking the Adaptor 1 tab, you’ll see a button next to the word Enabled. Make sure this button is clicked before you continue. Doing so will enable this specific configuration to be used.
After clicking on the Enabled button, you will see three options for the configuration mode. You can choose from Manual, DHCP, or BOOTP. In this specific example, we will be selecting Manual, but if you have a DHCP server, you will need to select it instead. Doing so will allow the network’s DHCP server to assign you an IP address automatically.
Next, you will be instructed to provide your primary name and domain name. Here’s an example of how this might look: primary.yourdomain.com. Next, you need to put in your static IP address where provided. Make sure that you have a correct IP address provided by your system administrator, or you risk creating conflicts on the network. The next option that you select will be the Net Device. If this is the first network card on your machine, you will need to select eth0. Otherwise, you will need to select another device. For example, if you were configuring the second NIC in your machine, this would need to be eth1.
Finally, you will see Kernel Module, which is where you select the type of Ethernet card that you will be using. The standard listed is ne2k-pci. This module means that the Ethernet card that you will be using is an NE2000 compatible PCI card. However, there are several other selections available. It is advised that you choose the module that best fits your NIC. After you have filled in the necessary information, click on Accept to continue configuration of your machine.
Name server specification
Now it’s time to configure your machine to work with the network’s DNS server. After clicking on the Name Server Specification (DNS) button, a window will appear titled Resolver Configuration. In this window, you can specify which name server should be used to resolve your host IP number.
First, you will see DNS usage, with a button next to it. Make sure that this button is selected, as it allows your machine to operate using DNS. If you don’t have this option selected, your machine will not be able to communicate to the DNS server, which means you will not be able to resolve host names to IP addresses.
Next, you need to input the default domain of the network that you are trying to connect to. This information can be acquired by asking your network administrator.
Finally, Linux needs to know where the DNS server is located. Generally, there will be one or two DNS servers on a network. Sometimes there can be more, but let’s assume that we have two DNS servers: a primary DNS server and a backup DNS server. In the blanks provided for the IP of name server 1 and 2, simply enter the IP addresses of the two DNS servers. If you need the IP addresses, contact your system administrator. Once you have completed the task, click on Accept to continue.
Routing and gateways
Now that we have the DNS server located on our Linux box, we need to set up the gateway. To do this, click on Routing And Gateways to open the Routes To Other Networks window. After doing this, you’ll notice that you have several options available to you. Don’t fret; we’re going to make this simple!
To set the gateway, click the Defaults button to bring up the Defaults window. Here, you can enter the IP number of the main gateway, and you can enable routing if it is available on your network. After making the changes, click on Accept to return to the Routes To Other Networks window. To finish, simply click on the Quit button. From this point, you will be returned to the Network Configurator window. Click on Quit at the bottom of the window to continue.
Activate and test your connection
Once you click on Quit in the Network Configurator window, you will see yet another window that will ask you if you want to activate the changes that you have just made. Click on the Activate button, followed by the Quit button located at the bottom of the window.
Now it’s time to test your connection to the network. Click back into the Xterm window, and use the ping command to test your connection to another IP address in the network. If you need an IP address to ping, I suggest using the address of the gateway. If you receive a successful ping, then your network connection is complete. However, if for some reason the ping command returns “ping: unknown host xxx.xxx”, then it is suggested that you restart your box to make sure that your Ethernet card is loaded into the kernel correctly.
Ed Engelking is a Web editor for TechRepublic. In his spare time, he operates UCANweb.com, a Web-site hosting company he cofounded in 1997.
Do you have an interesting story about setting up a network on a Linux box? If so, we’d love to hear about it! Feel free to post a message below or send us a note with your stories.