Getting a fixed IP

The first thing was to sign up to the LiveLAMP users mailing list. Once this was done I sent off an email requesting help as to how to set a fixed IP for our server.

The first reply came back twenty minutes later. This suggestion was to get the school’s network administrator to allocate a fixed IP to the mac address of the servers network card. A few hours later I received detailed information on how I should go about doing this, the files I would need to get modified on the schools’ DHCP server. He said there was another alternative but that the file that could be modified on the LiveLAMP server was not currently used.

I asked our network admin and he said he didn’t want to change the DHCP server so I sent back an email saying that this wasn’t going to help. I then got back a helpful offer that if told what the DHCP server was running, he could give me detailed instructions on how to do it.

We forwarded our server details and received instructions regarding the changes needed for our DHCP server. Unfortunately this didn’t work and our admin wasn’t keen on messing with it anymore. I sent back an email to the list asking that we need to set a nominated out of DHCP range IP on the LiveLAMP server.

I got an email with “-- WARNING -- UGLY HACK!!! –” in it. There was a script with instructions about how to achieve this on the LiveLAMP server.

We followed these instructions and our server has had the same IP ever since.

Specific Instuctions

These are the specific instructions to set the static IP provided by Peter Lieverdink.

Here is a very ugly hack to make any existing LiveLAMP install use a user-defined static IP.

Essentially it boots as per normal, then releases its DHCP lease and assigns a user-specified IP instead.

Copy the content in between the WARNING lines below and save it to a file called /etc/rc3.d/S01-static-ip. chmod this file to 755 and edit the three parameters to suit your local network. Then run it. Voila!

Next time you start LiveLAMP, it will auto-run.
  1. /etc/rc3.d/S01-static-ip
case "$1" in
echo "Switching from dynamic to static IP address..."
echo -ne "\tReleasing DHCP IP "
/sbin/pump -r && echo OK
echo -ne "\tSetting static IP ($ADDRESS) "
/sbin/ifconfig eth0 $ADDRESS netmask $NETMASK \
broadcast $BROADCAST arp up && echo OK