Intrax, Inc.

...located in Fairfax, VA

How to set up IP Aliases

Written by Joel McClung on September 9th, 2009

I recently got new network switches. These switches, HP Procurve 1800-24 (model J9028B), require an IP address and are administered via a web interface. I do not want the switch web interface exposed to the internet; they should only be administered from internal hosts. Therefore, I gave the switches private, non-routeable IP addresses (RFC1918). For hosts that will administer the switches, it is necessary to set up an IP alias on the private network.

For my Linux hosts, running CentOS, create an IP alias file, /etc/sysconfig/network-scripts/ifcfg-eth0:0 that looks like this:
DEVICE=eth0:0
BOOTPROTO=static
BROADCAST=192.168.X.X
IPADDR=192.168.X.X
NETMASK=255.255.255.0
ONBOOT=yes

Run service network start, and off you go.

For OS X, Bring up System Preferences, and select Network. On the left side, you’ll see the network interface(s). At the bottom, hit the + key to create a new interface. Set Ethernet as the interface and give it a name (Private network, for example). Configure the IP address manually with the private IP address.

For Windows, I followed the instructions here

Print Apache Server Variables in PHP

Written by Joel McClung on February 27th, 2009

How did you print out the Apache server values in PHP? Grab the $_SERVER array and iterate through each value, like this:

<?php foreach($_SERVER as $key => $value) {
    echo $key . "=" . $value . "<br />\n";
};?>

Apache Web server variables

Written by Joel McClung on February 27th, 2009

Did you know that when you visit a web site, a certain amount of information is sent to the server? For example, for this session, the values the server has are below. If you visit this page from another computer, the results will be different.

The server can print this information or return it in the pages displayed. That’s how I’m able to print your IP address and hostname over on the right side of this site. The code I’m using is:

IP: <?php echo $_SERVER[REMOTE_ADDR];
echo "<br />";
echo $_SERVER[REMOTE_HOST];?>
(<a href="this_article">how</a>)

Server variables and their corresponding values:

HTTP_X_CC_ID=ccc03-02
HTTP_HOST=www.intrax.com
HTTP_USER_AGENT=CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
HTTP_ACCEPT=text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
HTTP_ACCEPT_ENCODING=gzip
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_CONNECTION=close
HTTP_CACHE_CONTROL=no-cache
HTTP_PRAGMA=no-cache
PATH=/sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE=
Apache/2.2.3 (CentOS) Server at www.intrax.com Port 80
SERVER_SOFTWARE=Apache/2.2.3 (CentOS) SERVER_NAME=www.intrax.com SERVER_ADDR=98.191.213.2 SERVER_PORT=80 REMOTE_ADDR=38.107.191.109 DOCUMENT_ROOT=/home/www/intrax/html SERVER_ADMIN=webmaster@intrax.com SCRIPT_FILENAME=/home/www/intrax/html/wordpress/index.php REMOTE_PORT=42723 GATEWAY_INTERFACE=CGI/1.1 SERVER_PROTOCOL=HTTP/1.1 REQUEST_METHOD=GET QUERY_STRING=asshat REQUEST_URI=/wordpress/?asshat SCRIPT_NAME=/wordpress/index.php PHP_SELF=/wordpress/index.php REQUEST_TIME=1280429575