651 653




Linux Unleashed, Third Edition:Networking





-->















Previous
Table of Contents
Next




Messages sent using TCP/IP use the IP address to identify sending and receiving devices, as well as any routing information put within the message headers. If you are going to connect to an existing network, you should find out what their IP addresses are and what numbers you can use. If you are setting up a network for your own use but plan to connect to the Internet at some point, you should contact the Network Information Center for an IP Address. On the other hand, if you are setting up a network for your own use and don’t plan to have more than a telephone connection to other networks (including the Internet), you can make up your own IP addresses.

If you are only setting up a loopback driver, you don’t even need an IP address. The default value for a loopback driver is 127.0.0.1.
Network Mask
Next, you need a network mask. This is pretty easy if you have picked out an IP address. The network mask is the network portion of the IP address set to the value 255, and it’s used to blank out the network portion to determine routing.

If you have a Class C IP address (three bytes for network and one for devices), your network mask is 255.255.255.0. A Class B network has a network mask of 255.255.0.0, and a Class A network mask is 255.0.0.0.
If you are configuring only a loopback driver, your network mask is 255.0.0.0 (Class A).
Network Address
The network address is, strictly speaking, the IP address bitwise-ANDed to the netmask. In English, what this means is that it’s the network portion of your IP address, so if your IP address is 147.120.46.7 and it’s a Class B network, the network address is 147.120.0.0.
To get your own network address, just drop the device-specific part of the IP address and set it to zero. A Class C network with an IP address of 201.12.5.23 has a network address of 201.12.5.0.
If you’re working with only a loopback address, you don’t need a network mask.
Broadcast Address
The broadcast address is used when a machine wants to send the same packet to all devices on the network. To get your broadcast address, you set the device portion of the IP address to 255. Therefore, if you have the IP address 129.23.123.2, your broadcast address will be 129.23.123.255. Your network address will be 129.23.123.0.
If you are configuring only a loopback driver, you needn’t worry about the broadcast address.
Gateway Address
The gateway address is the IP address of the machine that is the network’s gateway out to other networks (such as the Internet). You need a gateway address only if you have a network that has a dedicated gateway out. If you are configuring a small network for your own use and don’t have a dedicated Internet connection, you don’t need a gateway address.

Normally, gateways have the same IP address as your machines, but they have the digit 1 as the device number. For example, if your IP address is 129.23.123.36, chances are that the gateway address is 129.23.123.1. This convention has been used since the early days of TCP/IP.
Loopback drivers do not require a gateway address, so if you are configuring your system only for loopback, ignore this address.
Nameserver Address
Many larger networks have a machine whose purpose is to translate IP addresses into English-like names and vice versa. It is a lot easier to call a machine bobs_pc instead of 123.23.124.23. This translation is done with a system called the Domain Name System (DNS). If your network has a name server, that’s the address you need. If you want to have your own machine act as a name server (which requires some extra configuration not mentioned here), use the loopback address 127.0.0.1.
Loopback drivers don’t need a name server because the machine talks only to itself. Therefore, you can ignore the nameserver address if you are configuring only a loopback driver.
Setting Up the Dummy Interface
What’s a dummy interface? It’s a bit of a trick to give your machine an IP address to work with when it uses only SLIP and PPP interfaces. A dummy interface solves the problem of a standalone machine (no network cards connecting it to other machines) whose only valid IP address to send data to is the loopback driver (127.0.0.1). While SLIP and PPP may be used for connecting your machine to the outside world, when the interface is not active, you have no internal IP address that applications can use.
The problem arises with some applications that require a valid IP address to work. Some word processors and desktop layout tools, for example, require the TCP/IP system to be operational with an IP address for the target machine. The dummy interface essentially sets an IP address for your local machine that is valid as far as TCP/IP is concerned, but doesn’t really get used except to fool applications.
Creating a dummy interface is very simple. If your machine has an IP address already assigned for it in the /etc/hosts file, all you need to do is set up the interface and create a route. The following two commands are required:


ifconfig dummy machine_name
route add machine_name


Where machine_name is your local machine’s name (such as darkstar). This creates a link to your own IP address. If you do not have an IP address for your machine in the /etc/hosts file, you should add one before you create the dummy interface.
Configuration Files
Configuring Linux for TCP/IP is not difficult because only a few configuration files need to have the information about IP address and such added to them. You can do this with any editor, as long as it saves the files in ASCII format. It is advisable to make copies of the configuration files before you modify them, just in case you damage the format in some way.

Many of these files are similar in every version of UNIX, including most versions of Linux, except for one or two slight naming variations. If you’ve ever set up a UNIX system (or snooped around one in detail), these files and steps might seem familiar. If you haven’t done anything with Linux or UNIX before, just take it one step at a time and follow the instructions.



Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
653 Koszty i przychody w firmie deweloperskiej
634 653 (2)
647 651
649 651
651 Księgi rachunkowe w spółce z o o o w organizacji
653 1
Nuestro Circulo 651 90 ANOS DE NAYMARK

więcej podobnych podstron