Monday, March 3, 2008

Sharing is caring.

I'm going to try and post interesting things I learn here and there. My goal is to learn something new every day. So here goes first post. I recently had a job interview and there were a few questions that stuck in my mind.

First on the list was this, "If you just added a new virtual host host to your apache config file, how would you make your new vhost live without downing the server?"... granted not the exact words but same basic problem. Now all be it simple I did not know the answer because I have never used this function before. Well the answer is quite simple once you verify that your settings are correct and that you did not modify any of the other already running vhosts you can simply use the "reload" option with apache.

Next up, this question I knew was possible I just did not know the exact method to do it. The question, "Is it possible to have multiple IP's on a single NIC, if so how would you do this?" Well I knew it was possible, but how to do it is another question. So since I hate not knowing I took the time to find the answer. The most common method of doing this would be called "aliasing". To do this from the command line you would use ifconfig in a fashion similar to this...

ifconfig eth0:0 192.168.1.99 netmask 255.255.255.0 up

Now to kind of explain what is happening there "eth0" is our hardware device we use ":" to create and alias of that device call "0". You could have named the device "eth0:1" etc.

Now I'll explain the better way of doing this so that your system will manage the connection instead of manually creating it every time. What we need to do is create "/etc/sysconfig/network-scripts/ifcfg-eth0:0" so that it will start up automatically when the system starts. Your config will look something similar to this...

DEVICE=eth0:0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0

Well that is all I have for you currently. Thank you for your time.

Have a nice day!

No comments: