Alias ip address что это
Перейти к содержимому

Alias ip address что это

  • автор:

Assign Multiple IP Address

NOTE!: Above chnages lost when you restart system or reload/restart network service.

Permantly Setup
RedHat/CentOS
  • Let’s copy the Primary NIC configuration file.
  • Open ifcfg-eth0 and view the contents.
  • We have to modify DEVICE and IPADDR parameter for our virtual network interface (eth0:0 & eth0:1)
Debian/Ubuntu
  • Open /etc/network/interfaces file and view the contents.
  • We have to add following line to setup virtual network interface (eth0:0 & eth0:1)

NOTE!: Once, you’ve made all changes, save all your changes and restart the network service for the changes to reflect.

IP-Aliasing¶

IP-aliases are an obsolete way to manage multiple IP-addresses/masks per interface. Newer tools such as iproute2 support multiple address/prefixes per interface, but aliases are still supported for backwards compatibility.

An alias is formed by adding a colon and a string when running ifconfig. This string is usually numeric, but this is not a must.

Alias creation¶

Alias creation is done by ‘magic’ interface naming: eg. to create a 200.1.1.1 alias for eth0 …

The corresponding route is also set up by this command. Please note: The route always points to the base interface.

Alias deletion¶

The alias is removed by shutting the alias down:

Alias (re-)configuring¶

Aliases are not real devices, but programs should be able to configure and refer to them as usual (ifconfig, route, etc).

IP алиасинг — FreeBSD

Обычно сервер не ставят ради одного единственного сайта, а размещают сразу несколько. Или даже множество в случае если это сервер для виртуального хостинга.

Можно конечно повесить все сайты на один IP, но это на мой взгляд не кошерно. Соответственно нам необходимо привязать некое количество IP адресов к серверу. Для этого будет использован IP — алиасинг.

Прикручивание IP — алиасов выполняется через всеми любимый ifconfig.

ifconfig lo0 alias inet IP _ADDRESS netmask NET_MASK

ifconfig lo0 alias inet 217.23.45.5 netmask 255.255.255.255

Использовать интерфейс обратно петли — lo0 вовсе не обязательно, алиасы можно поднять и на сетевом интерфейсе, например em0 или на VLAN если они используются…

Далее необходимо заставить наши алиасы подниматься автоматически при старте системы. Для этого идем в /etc/rc.conf и прописываем следующее:

ifconfig_lo0_alias0=«inet IP _ADDRESS netmask NET_MASK»

ifconfig_lo0_alias0=«inet 217.23.45.5 netmask 255.255.255.255»

Заметьте, что записи синонимов должны начинаться с alias0 и идти далее в определенном порядке — alias0, alias1. alias10.

Теперь эти IP, поднятые как алиасы могут использоваться в системе по Вашему усмотрению.

Linux Network Administrator's Guide, 3rd Edition by Tony Bautts, Terry Dawson, Gregor N. Purdy

Get full access to Linux Network Administrator's Guide, 3rd Edition and 60K+ other titles, with a free 10-day trial of O’Reilly.

There are also live events, courses curated by job role, and more.

Chapter 4. Configuring TCP/IP Networking

In this chapter, we walk you through all the necessary steps to set up TCP/IP networking on your machine. Starting with the assignment of IP addresses, we slowly work our way through the configuration of TCP/IP network interfaces and introduce a few tools that come in handy when hunting down network installation problems.

Most of the tasks covered in this chapter will generally have to be done only once. Afterward, you have to touch most configuration files only when adding a new system to your network or reconfiguring your system entirely. Some of the commands used to configure TCP/IP, however, have to be executed each time the system is booted. This is usually done by invoking them from the system /etc/rc scripts.

Commonly, the network-specific part of this procedure is contained in a script. The name of this script varies in different Linux distributions. In many older Linux distributions, it is known as rc.net or rc.inet . Sometimes you will also see two scripts named rc.inet1 and rc.inet2 ; the former initializes the kernel part of networking and the latter starts basic networking services and applications. In modern distributions, the rc files are structured in a more sophisticated arrangement; here you may find scripts in the /etc/init.d/ (or /etc/rc.d/init.d/ ) directory that create the network devices and other rc files that run the network application programs. This book’s examples are based on the latter arrangement.

This chapter discusses parts of the script that configure your network interfaces. After finishing this chapter, you should have established a sequence of commands that properly configure TCP/IP networking on your computer. You should then replace any sample commands in the configuration scripts with your commands, make sure the script is executed from the basic rc script at startup time, and reboot your machine. The networking rc scripts that come along with your favorite Linux distribution should provide a solid example from which to work.

Understanding the /proc Filesystem

Linux 2.4 distributions rely on the /proc filesystem for communicating with the kernel, 2.6 uses the new sysfs. Both interfaces permit access to kernel runtime information through a filesystem-like mechanism. For purposes of this chapter, we’ll focus more on the /proc filesystem, as it is currently more widely used. This filesystem, when mounted, can list files like any other filesystem, or display their contents. Typical items include the loadavg file, which contains the system load average, and meminfo , which shows current core memory and swap usage.

To this, the networking code adds the net directory. It contains a number of files that show things such as the kernel ARP tables, the state of TCP connections, and the routing tables. Most network administration tools get their information from these files.

The proc filesystem (or procfs , as it is also known) is usually mounted on /proc at system boot time. The best method is to add the following line to /etc/fstab :

Then execute mount /proc from your /etc/rc script.

The procfs is now configured into most kernels by default.

Installing the Tools

Prepackaged Linux distributions contain the major networking applications and utilities along with a coherent set of sample files. The only case in which you might have to obtain and install new utilities is when you install a new kernel release. Because they occasionally involve changes in the kernel networking layer, you will need to update the basic configuration tools. This update at least involves recompiling, but sometimes you may also be required to obtain the latest set of binaries. These binaries are available at their official home site at ftp://ftp.inka.de/pub/comp/Linux/networking/NetTools/, packaged in an archive called net-tools-XXX.tar.gz , where XXX is the version number.

If you want to compile and install the standard TCP/IP network applications yourself, you can obtain the sources from most Linux FTP servers. All modern Linux distributions include a fairly comprehensive range of TCP/IP network applications, such as World Wide Web browsers, Telnet and FTP programs, and other network applications such as talk. If you do find something that you need to compile yourself, the chances are good that it will compile under Linux from source quite easily if you follow the instructions included in the source package.

Setting the Hostname

Most, if not all, network applications rely on you to set the local host’s name to some reasonable value. This setting is usually made during the boot procedure by executing the hostname command. To set the hostname to name , enter:

It is common practice to use the unqualified hostname without specifying the domain name. For instance, if we had a site called the Virtual Brewery (an imaginary but typical small network used in several chapters of this book) a host might be called vale.vbrew.com or vlager.vbrew.com . These are their official fully qualified domain names (FQDNs). Their local hostnames would be the first component of the name, such as vale . However, because the local hostname is frequently used to look up the host’s IP address, you have to make sure that the resolver library is able to look up the host’s IP address. This usually means that you have to enter the name in /etc/hosts .

Some people suggest using the domainname command to set the kernel’s idea of a domain name to the remaining part of the FQDN. This way you could combine the output from hostname and domainname to get the FQDN again. However, this is at best only half correct. domainname is generally used to set the host’s NIS domain, which may be entirely different from the DNS domain to which your host belongs. Instead, to ensure that the short form of your hostname is resolvable with all recent versions of the hostname command, either add it as an entry in your local Domain Name Server or place the fully qualified domain name in the /etc/hosts file. You may then use the —fqdn argument to the hostname command, and it will print the fully qualified domain name.

Assigning IP Addresses

If you configure the networking software on your host for standalone operation, you can safely skip this section, because the only IP address you will need is for the loopback interface, which is always 127.0.0.1 .

Things are a little more complicated with real networks such as Ethernets. If you want to connect your host to an existing network, you have to ask its administrators to give you an IP address on this network, though this is not always the case. Many networks now have a system of dynamically assigned IPs called Dynamic Host Configuration Protocol (DHCP), which we will discuss in the next section. When setting up a network all by yourself, you have to assign IP addresses by hand or by configuring a DHCP server. If you have a machine connected directly to the Internet, you will need to obtain an IP address from your ISP, DSL provider, or cable network.

Hosts within a local network usually share addresses from the same logical IP network, meaning that the first octets of their IP addresses are usually the same. If you have several physical networks, you have to either assign them different network numbers, or use subnetting to split your IP address range into several subnetworks. Subnetting will be revisited in the “Creating Subnets” section later in this chapter.

If your network is not connected to the Internet or will use network address translation to connect, you are free to choose any legal network address. Just make sure no packets from your internal network escape to the real Internet. To make sure no harm can be done even if packets do escape, you should use one of the network numbers reserved for private use. The Internet Assigned Numbers Authority (IANA) has set aside several network numbers from classes A, B, and C that you can use without registering. These addresses are valid only within your private network and are not routed between real Internet sites. The numbers are defined by RFC 1918 and are listed in Table 2-1 in Chapter 2. Note that the second and third blocks contain 16 and 256 networks, respectively.

Picking your addresses from one of these network numbers is not only useful for networks completely unconnected to the Internet; you can still implement restricted access to the Internet using a single host as a gateway. To your local network, the gateway is accessible by its internal IP address, while the outside world knows it by an officially registered address (assigned to you by your provider). We come back to this concept in connection with the IP masquerade facility in Chapter 9.

Throughout the remainder of the book, we will assume that the brewery’s network manager uses a class B network number, say 172.16.0.0 . Of course, a class C network number would definitely suffice to accommodate both the brewery’s and the winery’s networks. We’ll use a class B network here for the sake of simplicity; it will make the subnetting examples in the next section of this chapter a little more intuitive.

Using DHCP to Obtain an IP Address

Many networks now use the Dynamic Host Configuration Protocol (DHCP). This protocol runs on network layer two and listens for DHCP requests. The DHCP server has a predefined listing of IP address assigned by the network administrator, which can be assigned to users. When the DHCP receives a request for an IP address, it replies by issuing a DHCP lease. The lease means that the IP address is assigned to the requesting client for a predetermined amount of time. Busy networks often set the lease for a fixed number of hours to prevent the use of an address by an idle machine. Some networks set the threshold as low as two hours. Smaller networks may wish to set the DHCP lease times to a longer value, perhaps a day, or even a week. The value is entirely up to the network administrator and should be based on network usage.

To request a DHCP lease on a network, you will need to have the dhcpcd software. The latest version of the software can be obtained by visiting its home site http://www.phystech.com/download/dhcpcd.html. There you will find the latest versions of the software as well as supporting documentation. Many modern Linux distributions will come with this software preinstalled and will even allow you to configure your interfaces with DHCP during the initial setup and configuration of the system.

Obtaining an IP address via DHCP is simple and is accomplished by issuing the following command:

The daemon will at this point, reconfigure your eth0 interface, not only assigning an IP address, but also properly configuring the subnetting. Many DHCP servers will also provide default route and DNS information. In the case of the latter, your /etc/resolv.conf file will be rewritten with the updated DNS server information. If for some reason you do not want the daemon to rewrite your resolv.conf file, you can specify -R on the command line. There are a number of additional command-line options available for dhcpcd, which may be needed in some environments. For a list of these, please contact the dhcpcd manpage. The resolv.conf file will be discussed in greater detail in the chapter on DNS.

Running a DHCP server

With larger, more dynamic networks, DHCP is essential. However, in order for this service to be offered, the clients must receive their IP address from a DHCP server. While a number of routers, firewalls, and other network devices will offer this functionality, a network administrator may wish to consider using a Linux machine to provide it. Linux DHCP servers tend to provide a greater flexibility with their configuration options. There are a number of DHCP servers available, but one of the more popular and better recommended offerings comes from the ISC and can be found at ftp://ftp.isc.org/isc/dhcp/. The configuration and installation of this is very standard and uses the well-known automake configuration script. When the software has been compiled and installed, you are ready to begin configuration.

First, though, you need to make sure that your network interfaces are configured for multicast support. This is most easily checked by using the ifconfig command:

If you don’t see MULTICAST specified in the output, you need to reconfigure your kernel to support network multicast. The likelihood of this is slim because most kernel configurations contain this as a default option.

Now you’re ready to write a dhcpd.conf file. A sample dhcpd.conf file looks like this:

This configuration will create which will assign addresses on the 172.16.1.0 network. It can assign a total of 40 IP addresses from 172.16.1.10 to 172.16.1.50 . The option routers and domain-name-servers commands allow you to set the default router and DNS servers for the clients.

Here’s a brief listing of some of the more useful DHCP server configuration options:

Between quotes, you have the ability to specify the domain name for your network. This isn’t necessary, but may be useful to speed up local name lookups.

While considered optional, in most cases it is not. This is where the IP addresses or the FQDN domain name servers are listed.

When a host asks for a lease and does not request a specific amount of time, this value, in seconds, is assigned.

This option specifies the maximum amount of time that will be assigned as a lease.

The fixed address option lets you assign a fixed IP address to specific clients. This option is generally paired with the MAC address filtering options.

With this option, network administrators can specify which MAC addresses will receive IP address allocations. This can be used to secure a DHCP range, or can be used to pair MAC addresses with specific IP addresses.

The DHCP server can use the client MAC address as a method to restrict or assign IP addresses. This type of configuration might be necessary in higher security environments where only known machines are to be assigned addresses. The following example shows how the DHCP server can assign a specific address to a host based on its MAC address, also important to note is that the range directive can be used here as well:

Make sure that your DHCP address pool ranges do not contain statically assigned addresses, otherwise IP address conflict problems are sure to follow.

Creating Subnets

To operate several Ethernets, you have to split your network into subnets. Note that subnetting is required only if you have more than one broadcast network—point-to-point links don’t count. For instance, if you have one Ethernet, and one or more PPP links to the outside world, you don’t need to subnet your network. This is explained in more detail in Chapter 6.

To accommodate the two Ethernets, the brewery’s network manager decides to use 8 bits of the host part as additional subnet bits. This leaves another 8 bits for the host part, allowing for 254 hosts on each of the subnets. She then assigns subnet number 1 to the brewery and gives the winery number 2. Their respective network addresses are thus 172.16.1.0 and 172.16.2.0 . The subnet mask is 255.255.255.0 .

vlager , which is the gateway between the two networks, is assigned a host number of 1 on both of them, which gives it the IP addresses 172.16.1.1 and 172.16.2.1 , respectively.

Note that in this example we are using a class B network to keep things simple, but a class C network would be more realistic. With the new networking code, subnetting is not limited to byte boundaries, so even a class C network may be split into several subnets. For instance, you could use two bits of the host part for the netmask, giving you 4 possible subnets with 64 hosts on each. [1]

Writing Hosts and Networks Files

After you have subnetted your network, you should prepare for some simple sort of hostname resolution using the /etc/hosts file. If you are not going to use DNS or NIS for address resolution, you have to put all hosts in the hosts file.

Even if you want to run DNS during normal operation, you should have some subset of all hostnames in /etc/hosts . You should have some sort of name resolution, even when no network interfaces are running, for example, during boot time. This is not only a matter of convenience, but it allows you to use symbolic hostnames in your network rc scripts. Thus, when changing IP addresses, you only have to copy an updated hosts file to all machines and reboot, rather than edit a large number of rc files separately. Usually you put all local hostnames and addresses in hosts , adding those of any gateways and NIS servers used.

You should make sure that your resolver uses information from the hosts file only during initial testing. Sample files that come with your DNS software may produce strange results. To make all applications use /etc/hosts exclusively when looking up the IP address of a host, you have to edit the /etc/host.conf file. Comment out any lines that begin with the keyword order by preceding them with a hash sign, and insert the line:

The configuration of the resolver library is covered in detail in Chapter 6.

The hosts file contains one entry per line, consisting of an IP address, a hostname, and an optional list of aliases for the hostname. The fields are separated by spaces or tabs, and the address field must begin in the first column. Anything following a hash sign (#) is regarded as a comment and is ignored.

Hostnames can be either fully qualified or relative to the local domain. For vale , you would usually enter the fully qualified name, vale.vbrew.com , and vale by itself in the hosts file, so that it is known by both its official name and the shorter local name.

This is an example how a hosts file at the Virtual Brewery might look. Two special names are included, vlager-if1 and vlager-if2 , which give the addresses for both interfaces used on vlager :

Just as with a host’s IP address, you should sometimes use a symbolic name for network numbers, too. Therefore, the hosts file has a companion called /etc/networks that maps network names to network numbers, and vice versa. At the Virtual Brewery, we might install a networks file as shown in the following. [2]

Interface Configuration for IP

After setting up your hardware as explained in Chapter 3, you have to make these devices known to the kernel networking software. A couple of commands are used to configure the network interfaces and initialize the routing table. These tasks are usually performed from the network initialization script each time you boot the system. The basic tools for this process are called ifconfig (where “if” stands for interface) and route.

ifconfig is used to make an interface accessible to the kernel networking layer. This involves the assignment of an IP address and other parameters, and activation of the interface, also known as “bringing up” the interface. Being active here means that the kernel will send and receive IP datagrams through the interface. The simplest way to invoke it is with:

This command assigns ip-address to interface and activates it. All other parameters are set to default values. For instance, the default network mask is derived from the network class of the IP address, such as 255.255.0.0 for a class B address. ifconfig is described in detail later in this chapter.

route allows you to add or remove routes from the kernel routing table. It can be invoked as:

The add and del arguments determine whether to add or delete the route to target . The -net and -host arguments tell the route command whether the target is a network or a host. The if argument is again optional, and allows you to specify to which network interface the route should be directed—the Linux kernel makes a sensible guess if you don’t supply this information. This topic will be explained in more detail in succeeding sections.

The Loopback Interface

Almost always, the very first interface to be activated is the loopback interface:

Occasionally, you will see the dummy hostname localhost being used instead of the IP address. ifconfig will look up the name in the hosts file, where an entry should declare it as the hostname for 127.0.0.1 :

To view the configuration of an interface, you invoke ifconfig , giving it only the interface name as argument:

As you can see, the loopback interface has been assigned a netmask of 255.0.0.0 , since 127.0.0.1 is a class A address.

Now you can almost start playing with your mini-network. What is still missing is an entry in the routing table that tells IP that it may use this interface as a route to destination 127.0.0.1 . This is accomplished by using:

Again, you can use localhost instead of the IP address, provided you’ve entered it into your /etc/hosts .

Next, you should check that everything works fine, for example, by using ping . ping is the networking equivalent of a sonar device. The command is used to verify that a given address is actually reachable, and to measure the delay that occurs when sending a datagram to it and back again. The time required for this process is often referred to as the “round-trip time”:

When you invoke ping as shown here, it will continue emitting packets forever, unless interrupted by the user. The ^C marks the place where we pressed Ctrl-C.

The previous example shows that packets for 127.0.0.1 are properly delivered and a reply is returned to ping almost instantaneously. This shows that you have successfully set up your first network interface.

If the output you get from ping does not resemble that shown in the previous example, you are in trouble. Check any errors if they indicate that some file hasn’t been installed properly. Check that the ifconfig and route binaries you use are compatible with the kernel release you run, and above all, that the kernel has been compiled with networking enabled (you see this from the presence of the /proc/net directory). If you get an error message saying “Network unreachable,” you probably got the route command wrong. Make sure you use the same address that you gave to ifconfig .

The steps previously described are enough to use networking applications on a standalone host. After adding the lines mentioned earlier to your network initialization script and making sure it will be executed at boot time, you may reboot your machine and try out various applications. For instance, ssh localhost should establish an ssh connection to your host, giving you an SSH login prompt.

However, the loopback interface is useful not only as an example in networking books, or as a test bed during development, but is actually used by some applications during normal operation. [3] Therefore, you always have to configure it, regardless of whether your machine is attached to a network or not.

Ethernet Interfaces

Configuring an Ethernet interface is pretty much the same as the loopback interface; it just requires a few more parameters when you are using subnetting.

At the Virtual Brewery, we have subnetted the IP network, which was originally a class B network, into class C subnetworks. To make the interface recognize this, the ifconfig incantation would look like this:

This command assigns the eth0 interface the IP address of vstout ( 172.16.1.2 ). If we omitted the netmask, ifconfig would deduce the netmask from the IP network class, which would result in an incorrect netmask of 255.255.0.0 . Now a quick check shows:

You can see that ifconfig automatically sets the broadcast address (the Bcast field) to the usual value, which is the host’s network number with all the host bits set. Also, the maximum transmission unit (the maximum size of IP datagrams the kernel will generate for this interface) has been set to the maximum size of Ethernet packets: 1,500 bytes. The defaults are usually what you will use, but all these values can be overidden if required, with special options that will be described under later in this chapter.

Just as for the loopback interface, you now have to install a routing entry that informs the kernel about the network that can be reached through eth0 . For the Virtual Brewery, you might invoke route as:

At first this looks a little like magic, because it’s not really clear how route detects which interface to route through. However, the trick is rather simple: the kernel checks all interfaces that have been configured so far and compares the destination address ( 172.16.1.0 in this case) to the network part of the interface address (that is, the bitwise AND of the interface address and the netmask). The only interface that matches is eth0 .

Now, what’s that -net option for? This is used because route can handle both routes to networks and routes to single hosts (as you saw before with localhost ). When given an address in dotted quad notation, route attempts to guess whether it is a network or a hostname by looking at the host part bits. If the address’s host part is zero, route assumes it denotes a network; otherwise, route takes it as a host address. Therefore, route would think that 172.16.1.0 is a host address rather than a network number because it cannot know that we use subnetting. We have to tell route explicitly that it denotes a network, so we give it the -net flag.

Of course, the route command is a little tedious to type, and it’s prone to spelling mistakes. A more convenient approach is to use the network names we defined in /etc/networks . This approach makes the command much more readable; even the -net flag can be omitted because route knows that 172.16.1.0 denotes a network:

Now that you’ve finished the basic configuration steps, we want to make sure that your Ethernet interface is indeed running happily. Choose a host from your Ethernet, for instance vlager , and type:

If you don’t see similar output, something is broken. If you encounter unusual packet loss rates, this hints at a hardware problem, such as bad or missing terminators. If you don’t receive any replies at all, you should check the interface configuration with netstat , described later in the chapter. The packet statistics displayed by ifconfig should tell you whether any packets have been sent out on the interface at all. If you have access to the remote host too, you should go over to that machine and check the interface statistics. This way you can determine exactly where the packets got dropped. In addition, you should display the routing information with route to see whether both hosts have the correct routing entry. route prints out the complete kernel routing table when invoked without any arguments ( -n just makes it print addresses as dotted quad instead of using the hostname):

The detailed meaning of these fields is explained later in the chapter. The Flags column contains a list of flags set for each interface. U is always set for active interfaces, and H says the destination address denotes a host. If the H flag is set for a route that you meant to be a network route, you have to reissue the route command with the -net option. To check whether a route you have entered is used at all, check to see if the Use field in the second to last column increases between two invocations of ping.

Routing Through a Gateway

In the previous section, we covered only the case of setting up a host on a single Ethernet. Quite frequently, however, one encounters networks connected to one another by gateways. These gateways may simply link two or more Ethernets but may also provide a link to the outside world, such as the Internet. In order to use a gateway, you have to provide additional routing information to the networking layer.

The Ethernets of the Virtual Brewery and the Virtual Winery are linked through such a gateway, namely the host vlager . Assuming that vlager has already been configured, we just have to add another entry to vstout ’s routing table that tells the kernel it can reach all hosts on the winery’s network through vlager . The appropriate incantation of route is shown below; the gw keyword tells it that the next argument denotes a gateway:

Of course, any host on the winery network you wish to talk to must have a routing entry for the brewery’s network. Otherwise you would only be able to send data to the winery network from the brewery network, but the hosts on the winery would be unable to reply.

This example describes only a gateway that switches packets between two isolated Ethernets. Now assume that vlager also has a connection to the Internet (say, through an additional SLIP link). Then we would want datagrams to any destination network other than the brewery to be handed to vlager . This action can be accomplished by making it the default gateway for vstout :

The network name default is shorthand for 0.0.0.0 , which denotes the default route. The default route matches every destination and will be used if there is no more specific route that matches. You do not have to add this name to /etc/networks because it is built into route .

If you see high packet loss rates when pinging a host behind one or more gateways, this may hint at a very congested network. Packet loss is not so much due to technical deficiencies as to temporary excess loads on forwarding hosts, which makes them delay or even drop incoming datagrams.

Configuring a Gateway

Configuring a machine to switch packets between two Ethernets is pretty straightforward. Assume we’re back at vlager , which is equipped with two Ethernet cards, each connected to one of the two networks. All you have to do is configure both interfaces separately, giving them their respective IP addresses and matching routes, and that’s it.

It is quite useful to add information on the two interfaces to the hosts file as shown in the following example, so we have handy names for them, too:

The sequence of commands to set up the two interfaces is then:

If this sequence doesn’t work, make sure your kernel has been compiled with support for IP forwarding enabled. One good way to do this is to ensure that the first number on the second line of /proc/net/snmp is set to 1 .

The Point-to-Point Interface

A PLIP link used to connect two machines is a little different from an Ethernet. PLIP links are an example of what are called point-to-point links, meaning that there is a single host at each end of the link. Networks like Ethernet are called broadcast networks. Configuration of point-to-point links is different because unlike broadcast networks, point-to-point links don’t support a network of their own.

PLIP provides very cheap and portable links between computers. As an example, we’ll consider the laptop computer of an employee at the Virtual Brewery that is connected to vlager via PLIP. The laptop itself is called vlite and has only one parallel port. At boot time, this port will be registered as plip1 . To activate the link, you have to configure the plip1 interface using the following commands: [4]

The first command configures the interface, telling the kernel that this is a point-to-point link, with the remote side having the address of vlager . The second installs the default route, using vlager as gateway. On vlager , a similar ifconfig command is necessary to activate the link (a route invocation is not needed):

Note that the plip1 interface on vlager does not need a separate IP address, but may also be given the address 172.16.1.1 . Point-to-point networks don’t support a network directly, so the interfaces don’t require an address on any supported network. The kernel uses the interface information in the routing table to avoid any possible confusion. [5] Now we have configured routing from the laptop to the brewery’s network; what’s still missing is a way to route from any of the brewery’s hosts to vlite . One particularly cumbersome way is to add a specific route to every host’s routing table that names vlager as a gateway to vlite :

Dynamic routing offers a much better option for temporary routes. You could use gated , a routing daemon, which you would have to install on each host in the network in order to distribute routing information dynamically. The easiest option, however, is to use proxy ARP (Address Resolution Protocol). With proxy ARP, vlager will respond to any ARP query for vlite by sending its own Ethernet address. All packets for vlite will wind up at vlager , which then forwards them to the laptop. We will come back to proxy ARP in the section “Checking the ARP Tables,” later in the chapter.

Current net-tools releases contain a tool called plipconfig, which allows you to set certain PLIP timing parameters. The IRQ to be used for the printer port can be set using the ifconfig command.

The PPP Interface

Although PPP links are only simple point-to-point links like PLIP connections, there is much more to be said about them. We discuss PPP in detail in Chapter 6.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *