IP aliases configuration Introduction With the evolution of the _I_n_t_e_r_n_e_t and the power of the micro-comput- ers, it is now possible and useful for a computer to act as many, fak- ing several servers in one box. The trick to achieve this is to let the machine respond to more IP numbers. We are calling them IP aliases. 11.. DDeeffiinniinngg aalliiaasseess IP aliases are called this way because they are alternative IP numbers for a network device. Some software packages can use alternate configurations based on the target IP number of a request. Notably web servers (httpd) and the virtual POP email server distributed with Linuxconf. An alias is associated to a network device. Linuxconf provides you with the list of active network devices (Alias can only be define for active devices). Although any active device may be chosen, it is often simpler to pick one of the Ethernet device (eth0) of the computer. Further, using IP numbers originating from the same network number as the primary IP number of the device will simplify routing. You simply don't have to tell any other machine of the net- work about what you are doing. It just works. If you pick IP numbers unrelated to the network of the Ethernet device, you will need to define special routing on the other hosts of the network. Your server will look like a gateway to a "virtual network". This is often done in practice when you need a huge amount of aliases, exceeding the availability of free numbers for the local network. Once you have selected a network device, you are thrown in a simple dialog with many empty lines. Just enter the aliases (IP numbers) you wish to associate with this device. If you need more empty lines, use the _A_d_d button. 22.. UUssiinngg nnaammeess _L_i_n_u_x_c_o_n_f initializes the IP aliases well after the basic networking, so at this point, the DNS is fully reachable. You can safely use names to define aliases instead of just IP numbers. This is useful if you have few disparate (unrelated) aliases to define. 33.. DDeeffiinniinngg rraannggeess Big Internet _w_e_b servers host several "virtual domains". While we can define one aliases per virtual web server, it is much easier to allocate a range of IP numbers and map the virtual servers into that range. See the "IP allocation space" of the _D_N_S _c_o_n_f_i_g_u_r_a_t_o_r section of _L_i_n_u_x_c_o_n_f. So you can define, say fifty IP aliases just by entering a single line in the dialog. A line like the following just does it. 192.168.1.1-50 44.. HHooww mmaannyy aalliiaasseess ccaann LLiinnuuxx hhaannddllee Linux 2.0 handle 256 aliases per device. Since Linux 2.0.31 there is a soft limit on the kernel table used to store the aliases. The limit is set to 256 at boot time. This limit may be change by writing a new value in the file /proc/sys/net/core/net_alias_max But there is a small catch: This new limit only comes in action when you set the first alias of a device. If there is already some IP alias on a network device, they will have to be unset. When there is no aliases on a device, the table is deleted and it will be recreated with the new limit the next time you set the aliases. _L_i_n_u_x_c_o_n_f handles all this for you and will unset some aliases before attempting to grow the table. Some messages are sent to the log explaining this. So linux can handle a lot of aliases. 55.. AA sstteepp bbyy sstteepp eexxaammppllee We will show here how to setup one IP alias and help to create new one easily. 55..11.. FFiirrsstt,, aallllooccaattee aa bbuunncchh ooff aalliiaass In the IP alias dialog, define a full range of IP alias. This will be done once for a long time. Suppose your eth0 network is 192.168.1.0 and there is an unused section. Just enter 192.168.1.50-100 which will allocate 51 IP aliases waiting to be used. 55..22.. TTeellll tthhee DDNNSS aabboouutt tthhiiss Now, you in the "Configure domain name server" menu, and pick the "IP allocation space" entry. Enter the range and a small description such as "Virtual domains". The DNS is not always on the same machine where you define the IP aliases. 55..33.. EEaacchh ttiimmee yyoouu aallllooccaattee aa nneeww vviirrttuuaall WWWWWW ddoommaaiinn Go in the DNS and add a host for the domain, generally www.new_domain. For the IP number, hit ctrl-X and Linuxconf will compute the first unused IP number in the IP aliases range. Pick this number. Then go in the httpd configuration and add a section for the new www domain. Repeat this step for each new domain until you are out of IP aliases. Using this strategy (defining a bunch of aliases first, telling the DNS about them next and using them last), you will avoid many errors.