Help - Multi-Homed Servers | ||
---|---|---|
Introduction
This page allows you to set up a multi-homed server. Each IP address can refer to a separate sub-directory within the document root, allowing you to show a different subset of your documents according to the IP address the user connected with.
This facility is also known as having multiple virtual servers.
Note that you will want to register a separate domain name for each of your IP addresses. You will need to set up your domain name server (DNS) to achieve this, as well as notifying the people responsible for your parent domain.
Each entry in this table is an IP address of the host and its corresponding sub-directory of the server's document directory root.
Wildcards are not allowed.
When a multi-homed server is operational, you can determine which IP address the client chose, by examining the server's object variables:
Connection:/LocalAddress gives the server IP address, and
Connection:/LocalHost gives the server host name
These variables can be accessed from Web Macros or API Extensions, allowing you to present different content back to the remote client according to the IP address that user connected to. This facility is in addition to the ability to have a custom document root for each IP address.
A new multi-home IP address wizard has been added to automate the creation of multiple IP addresses for a single network card. If you use this wizard, you do not need to read further.
This is how to set up an OS/2 machine for up to 32 IP addresses on one network adapter, assuming that SLIP and PPP dialup will not be used on the server machine:
FILE \tcpip\bin\virtuate.cmd: (call ONCE as part of TCPIP init, after running PPP for your main ppp0 connection)
/* virtuate.cmd */ /* These are all the setup variables: */ comport = 'com2' /* This is a dummy com port set up with SIO.SYS */ multiple = 9 /* This is how many IP addresses you want, up to 32 */ realppp = '127.0.0.1' /* This is the IP through which you will route */ baseppp = '196.7.0' /* This is the class C ip base address */ /* Now the work begins ... */ call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" call SysLoadFuncs do multiple '@start "'|| ppp || '" ppp' comport ' idle 1 silent' rc=syssleep(1) end /* Configure the routing IP if not already set up */ '@ifconfig lo' realppp /* Configure each interface and its routing in turn */ do interface=0 to multiple-1 ip = interface + 1; call setup 'ppp'interface baseppp'.'ip end return setup: parse arg int virtual '@ifconfig' int virtual realppp 'up' '@route delete' realppp virtual '@route add' virtual realppp '0' '@arp -s' virtual value('ether',,'os2environment') 'pub' returnNOTE: the environment variable ETHER, must be set in your CONFIG.SYS, and contain the MAC address of the ethernet card in your machine. For example:
SET ETHER=00:11:22:33:44:55
The MAC address of your card can be determined by running:
netstat -n
This is how to set up an OS/2 machine for up to 9 IP addresses on one network adapter, assuming that SLIP and PPP dialup will not be used on the server machine:
FILE \tcpip\etc\slip.cfg:
# Set up slip interfaces, one for each extra address interface sl0 { device=COM1, mtu=296, compression=off } interface sl1 { device=COM1, mtu=296, compression=off } # repeat for as many interfaces as you needFILE \tcpip\bin\virtuate.cmd: (call ONCE as part of TCPIP init)
/* virtuate.cmd */ call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" call SysLoadFuncs 'start slip' call SysSleep 10 /* give SLIP time to load before we configure the interfaces */ 'ifconfig lo 127.0.0.1' call setup 'sl0 204.50.168.1' /* each extra IP gets a line here */ call setup 'sl1 204.50.168.2' /* terminate slip.exe - you can also use killit2, killer, etc... */ go -k slip.exe return setup: parse arg int virtual 'ifconfig' int virtual '127.0.0.1 up' 'route delete 127.0.0.1' virtual 'route add' virtual '127.0.0.1 0' 'arp -s' virtual value('ether',,'os2environment') 'pub' returnAlso, if you run this batch file twice, strange things happen to the routing tables, and you will have to re-boot to recover.
You will need to obtain a public domain process killer program, such as go, killit2, killer, etc... for this Rexx script to work.
To make sure everything is working check out
netstat -a
and you should see all the addresses listed.
netstat -r
and you should see all the standard routing.