Re: Multihomed hosts and virtual web hosts
Jonathan Hogg <[email protected]> Wed, 07 May 2003 08:33:46 +0100
| Newsgroups | gmane.comp.sysutils.ark.devel |
|---|---|
| Organization | One Good Idea Ltd. |
| Message-ID | <BADE756A.1AE58%[email protected]> |
On 6/5/03 21:08, Will Partain wrote:
> I wish there was a way to get rid of that very last
> "hme0"...
>
> My verdict, which you're welcome to laugh at :-) [*], is that
> it's not too bad.
>
> Will
>
> [*] My main reason for posting ugly hacks is so that
> Jonathan will come out and fix them :-)
Heh, I dunno about fixing them, but how about considering network interfaces
to be members of networks and give the networks arbitrary names. My thought
is that in a prototype you might have:
<network-interfaces>
<entry name="internal"><table>
<entry name="network"> 192.168.1.0 </entry>
<entry name="netmask"> 255.255.255.0 </entry>
<entry name="broadcast"> 192.168.1.255 </entry>
<entry name="gateway"> 192.168.1.1 </entry>
</table></entry>
<entry name="external"><table>
<entry name="network"> 12.34.56.80 </entry>
<entry name="netmask"> 255.255.255.240 </entry>
<entry name="broadcast"> 12.34.56.95 </entry>
<entry name="gateway"> 12.34.56.94 </entry>
</table></entry>
</network-interfaces>
Then in a particular machine file you might have:
<network-interfaces>
<entry name="internal"><table>
<entry name="interface"> hme0 </entry>
<entry name="ip-address"> 192.168.1.135 </entry>
<entry name="aliases"><list>
<item> pooh </item>
<item> pooh-int </item>
</list></entry>
</table></entry>
<entry name="external"><table>
<entry name="interface"> hme1 </entry>
<entry name="ip-address"> 12.34.56.93 </entry>
<entry name="aliases"><list>
<item> web1 </item>
<item> pooh-ext </item>
</list></entry>
</table></entry>
</network-interfaces>
Or if the machine only sits on one network:
<network-interfaces>
<entry name="internal"><table>
<entry name="interface"> qfe0 </entry>
<entry name="ip-address"> 192.168.1.129 </entry>
<entry name="aliases"><list>
<item> tigger </item>
</list></entry>
</table></entry>
</network-interfaces>
Then to generate the appropriate interface config files for the platform,
you just iterate through each member of the <network-interfaces/> table
pulling out the appropriate keys from each member table and spitting out
appropriately named files.
If an entry doesn't have an "ip-address" key, then you just skip it and move
on - since it's most likely a half-finished prototype entry in that case.
This also allows you to put the interface name into a prototype if it makes
sense, i.e., if the web-facing netras always have two interfaces names hme0
and hme1 that will be connected to the internal and external networks
respectively, then that information could be put into the prototype for that
host:
<network-interfaces>
<entry name="internal"><table>
<entry name="interface"> hme0 </entry>
</table></entry>
<entry name="external"><table>
<entry name="interface"> hme1 </entry>
</table></entry>
</network-interfaces>
Which allows you to simplify the host config to just:
<network-interfaces>
<entry name="internal"><table>
<entry name="ip-address"> 192.168.1.135 </entry>
<entry name="aliases"><list>
<item> pooh </item>
<item> pooh-int </item>
</list></entry>
</table></entry>
<entry name="external"><table>
<entry name="ip-address"> 12.34.56.93 </entry>
<entry name="aliases"><list>
<item> web1 </item>
<item> pooh-ext </item>
</list></entry>
</table></entry>
</network-interfaces>
Which contains just the most specific information for that host. You could
probably tweak this even more with params so that the ip-address and aliases
were automagically generated from a web host number (like '1' for 'web1').
Jonathan
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com