Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [411]

By Root 3065 0
/etc/hosts

10.1.2.9 overkill overkill.domain

At boot time, both of these addresses are automatically configured (along with the loopback address, which we omitted from the output shown below):

% ifconfig -a

hme0: flags=863 mtu

1500 inet 10.1.2.9 netmask ffffff00 broadcast 10.1.2.255

hme0:1: flags=863 mtu

1500 inet 206.0.1.133 netmask ffffff80 broadcast 206.0.1.255

HP-UX virtual interfaces

HP-UX versions 11.00 and later support virtual or “secondary” interfaces through a naming convention much like that of Solaris. If lan0 is the name of a physical network interface, lan0:1 is the first virtual interface associated with it. The “:1” is called an IP index number. Each interface (real or virtual) can be configured with its own IP address, netmask, and options by the ifconfig command.

HP-UX 10.20 has the beginnings of virtual interfaces, but you have to install a patch. The patch adds the ifalias command, which configures the virtual interfaces.

Red Hat virtual interfaces

Red Hat virtual interfaces are named with the same interface:instance notation used by Solaris and HP-UX. For example, if your Ethernet interface is eth0, then the virtual interfaces associated with it would be eth0:0, eth0:1, and so on. All interfaces are configured with the ifconfig command. For example, the command

# ifconfig eth0:0 128.138.243.150 netmask 255.255.255.192 up

configures the interface eth0:0 and assigns it an address on the 128.138.243.128/26 network. To make virtual address assignments permanent, you must make files for them in the /etc/sysconfig/network-scripts directory.

For example, the file ifcfg-eth0:0 corresponding to the ifconfig command shown above would contain

DEVICE=eth0:0

IPADDR=128.138.243.150

NETMASK=255.255.255.192

NETWORK=128.138.243.128

BROADCAST=128.138.243.191

ONBOOT=yes

FreeBSD virtual interfaces

FreeBSD supports virtual interfaces (“IP aliases”) with the ifconfig option alias. For example, the following command binds an additional IP address to the xl0 interface:

# ifconfig xl0 inet 192.168.0.1 netmask 255.255.255.255 alias

To see the full configuration of the interface, we can run ifconfig again:

% ifconfig xl0

xl0: flags=8843 mtu 1500

inet 192.108.21.9 netmask 0xffffff00 bcast 192.108.21.255

inet 192.168.0.1 netmask 0xffffffff bcast 192.168.0.1

ether 00:60:97:9b:69:9a

media: 10baseT/UTP

supported media: autoselect 100baseTX

100baseTX 100baseTX 10baseT/UTP duplex> 10baseT/UTP 10baseT/UTP

Note the two different IP addresses listed in the second and third lines of output.

To delete a virtual interface, just use ifconfig with the keyword delete. For example:

# ifconfig xl0 inet 192.168.0.1 delete

To configure virtual interfaces at boot time, add lines such as these to the rc.conf file:

ifconfig_xl0_alias0="inet 192.168.0.1 netmask 255.255.255.255"

ifconfig_xl0_alias1="..."

The numbering must start at alias0 and must be contiguous.

Telling Apache about a virtual interface


In addition to creating the virtual interfaces with ifconfig, you need to tell Apache what documents to serve when a client tries to connect to each interface. You do this with a VirtualHost clause in the httpd.conf file, one VirtualHost clause for each virtual interface that you’ve configured. Here’s an example:

ServerAdmin webmaster@www.company.com

DocumentRoot /usr/local/apache/htdocs/company

ServerName www.company.com

ErrorLog logs/www.company.com-error_log

TransferLog logs/www.company.com-access_log

When a client connects to the virtual host 192.225.33.37, it will be served documents from the directory /usr/local/apache/htdocs/company, which should be unique to this site.

22.5 CACHING AND PROXY SERVERS


The Internet and the information on it are growing exponentially. Ergo, the bandwidth and computing resources required

Return Main Page Previous Page Next Page

®Online Book Reader