The requirement was to have a machine with three IP addresses; two IP addresses were to be static and the other was to be allocated dynamically by a DHCP server.
The situation at the end of the initial experiments was not perfect; the scheme seemed to work although the rcnetwork script reported that it had failed when it was told to restart the network. I haven't yet investigated any further to see what exactly it was objecting to.
This experiment was performed on a computer on which SuSE Linux professional version 9.0 had recently been installed.
The files I created were:
I also modified the file: /etc/sysconfig/network/dhcp
Previously the above file was in whatever state the SuSE 9.0 professional installation had left it since I do not normally use DHCP on my network.
The contents of each file are shown below exactly as they are on my computer except that I changed a couple of critical numbers to protect the innocent:
BOOTPROTO='dhcp' STARTMODE='onboot' UNIQUE='<Your own computer will generate a number>'
BOOTPROTO='static' BROADCAST='192.168.0.255' IPADDR='126.96.36.199' MTU='' NETMASK='255.255.255.255' NETWORK='188.8.131.52' REMOTE_IPADDR='' STARTMODE='onboot' UNIQUE='<Your own computer will generate a number>'
BOOTPROTO='static' BROADCAST='192.168.0.255' IPADDR='192.168.0.34' MTU='' NETMASK='255.255.255.0' NETWORK='192.168.0.0' REMOTE_IPADDR='' STARTMODE='onboot' UNIQUE='<Your own computer will generate a number>'
The file dhcp was modified in respect of the parameters listed below:
DHCLIENT_CLIENT_ID="YellowBananaSansFreckles" DHCLIENT_MODIFY_RESOLV_CONF="yes" DHCLIENT_SET_DEFAULT_ROUTE="yes"
The text shown above for DHCLIENT_CLIENT_ID is not significant; you can put whatever you like so long as it is unique for your network and so long as it isn't the network interface's hardware address. This parameter is one of the few that can be set from YaST but I think the other two have to be changed by editing the file. Also, if I understood correctly, these parameters could have been placed directly into the ifcfg-eth0 file to make them apply only to that one configuration.
With these configuration options the computer is accessible locally at 192.168.0.34 and also at whatever address the DHCP server allocates, generally 192.168.0.2. It is also accessible globally on the internet.
Notice that the UNIQUE parameter will be determined by your own computer for each network interface. All the configuration files for one particular interface will all receive the same value for UNIQUE.
The file ifcfg-eth0 allows the computer to acquire an IP address from a DHCP server. The file ifcfg-eth0:1 gives the computer its external IP address by which it is known to the rest of the world. Of course, 184.108.40.206 isn't actually its real IP address. The file ifcfg-eth0:2 gives the computer its ordinary IP address by which it is usually known internally. The DHCLIENT_CLIENT_ID="xyz" must be set. Without it the client machine will send its network hardware address as an ID but this doesn't succeed because the same hardware address is, of course, in use by the other two configurations for the same network device and therefore isn't unique on the network. The client and DHCP server both report that the DHCP negotiation was successful. The computer can be pinged at all three IP addresses and also it can ping other local machines and computers in the wider world. DNS seems to work. I didn't try getting clever with network time protocol since the computer happens to be a time server for the local network and I didn't dare do anything that might mess that up.