-->
Previous Table of Contents Next


Setting up TCP/IP Information

The files that control TCP/IP configuration are stored in the /etc directory. When you first set up Linux and are asked about machine names and domain names, this information is sent to the /etc/hosts file. While you don’t need to mess with this file if you’re connected to the Internet (it does many of the same things that a Domain Name Server does), it’s a good thing to place the names of essential servers in this file. And if you’re not connected to the Internet but you are maintaining a small network, this is the place to store the IP addresses for the workstations on your system. (Again, this could be done via a DNS on your local system, but it’s a lot easier to use the /etc/hosts file.)

Another file to check is the /etc/networks file, used to configured different networks in the TCP/IP subsystem. This file is summoned when the system launches, and its functions are handled by DNS servers if you’re working on the Internet. Again, if you’re not connected to the Internet but you want to have subnetworks and such (you really don’t; we’re speaking hypothetically here if you’re working on a small network), you’d use this file instead of a DNS.


NOTE:  If you have an ethernet card, you can configure it using the “netconfig” command. You might also need to edit /etc/rc.d/rc.modules to load support for your card.

You’ll also want to run the ifconfig command, which essentially tells the kernel about your Ethernet card and the IP addresses if you’ve not done so already. To see the current state of your system, use the command with no options:


gilbert:/$ ifconfig

lo    Link encap:Local Loopback

      inet addr:127.0.0.1  Bcast:127.255.255.255  Mask:255.0.0.0

      UP BROADCAST LOOPBACK RUNNING  MTU:2000  Metric:1

      RX packets:0 errors:0 dropped:0 overrun:0

      TX packets:40 errors:0 dropped:0 overruns:0

In this case, we’re actually using Linux without a network card or a connection to a network—but Linux thinks it’s on a network using a tool called loopback. Loopback allows applications and daemons that need to communicate via TCP/IP to connect to local resources.

Summary

Linux networking is an involved subject and one beyond the goals of this book. You’ll want to check out some of the reference works in Appendix A for more information.


Previous Table of Contents Next