Hosting Your Own Website (Part 3) Configuring The Server

Share This:

Now that we have successfully installed our server. I usually like to double check to see if my network has been correctly configured. It usually is. So just call me crazy or paranoid. It’s okay I’ve been called worse before. So to check the network address we will type the following.


ifconfig

The above command should display the following.

eth0 Link encap:Ethernet HWaddr A1:12:14:3D:17:64
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:17ff:fe3c:732/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:207461 errors:0 dropped:426 overruns:0 frame:0
TX packets:75959 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23444927 (22.3 MiB) TX bytes:17017756 (16.2 MiB)
Interrupt:20


lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:469 errors:0 dropped:0 overruns:0 frame:0
TX packets:469 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36644 (35.7 KiB) TX bytes:36644 (35.7 KiB)

Up above we see that our servers IP address on the network is 192.168.1.101. We see that our Netmask is 255.255.255.0. We also see that it is using eth0. This can either be ethx or pxpx These where the settings we had setup previously. Now we want to see if they will change. We can do this by typing the following.





cat /etc/sysconfig/network-scripts/ifcfg-eth0

If you configuration was set using p1p1 instead of eth0 then you will simply replace ifcfg-eth0 with the proper setting in the above command. The above command should show the following output.


HWADDR="A1:12:14:3D:17:64"
DOMAIN="server1.something"
IPV6INIT="no"
UUID="5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03"
IPADDR0="192.168.1.101"
DNS1="192.168.1.1"
PREFIX0="24"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
NM_CONTROLLED="yes"
BOOTPROTO="dhcp"
GATEWAY0="192.168.1.1"
DNS2="192.168.1.2"
DEVICE="eth0"
TYPE="Ethernet"
ONBOOT="yes"
NAME="My Home Network"

The number one thing in the above output that we will be concerned with is the line that says BOOTPROTO. If it is equal to anything other then static. We should change it. To change it we will use our prefered text editor. In this example I will use nano. So we will type the following.





nano /etc/sysconfig/network-scripts/ifcfg-eth0

Now we can change the BOOTPROTO to static. So it will look like the following.


BOOTPROTO="static"

Now that we made the changes we will save them by pressing CTRL + X. It will ask if we are sure we want to make the changes. And we are. So we make them. Now that we have made changes we need to restart the network on the server. To do this we will type the following.


/etc/init.d/network restart

The above command should restart the network. But I always like to make sure. I usually make sure by sending a ping with 4 packets to Google. If the Ping turns out okay then I know we are good. To send the ping we type the following.


ping -c 4 google.com

You should get the following output from the above command.


PING google.com (72.14.204.138) 56(84) bytes of data.
64 bytes from iad04s01-in-f138.1e100.net (72.14.204.138): icmp_req=1 ttl=53 time=21.9 ms
64 bytes from iad04s01-in-f138.1e100.net (72.14.204.138): icmp_req=2 ttl=53 time=21.9 ms
64 bytes from iad04s01-in-f138.1e100.net (72.14.204.138): icmp_req=3 ttl=53 time=22.0 ms
64 bytes from iad04s01-in-f138.1e100.net (72.14.204.138): icmp_req=4 ttl=53 time=41.8 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 21.913/26.931/41.810/8.590 ms

This assures us that our network is active again after we made the changes. Next we will install the software that we will need for our LAMP Stack.