UnixServerAdmin

Server Administration & Management

Neighbour table overflow

you may get this error in  dmesg

Neighbour table overflow.
printk: 402 messages suppressed.
Neighbour table overflow.
printk: 367 messages suppressed.
Neighbour table overflow.
printk: 394 messages suppressed.
Neighbour table overflow.

Kernel will thow this warning messages when the ARP cache overflows. You need to increase the size of  ARP cache to get rid of this error. Just increase the value of hard and soft limit in the following files:-

# echo 2048 > /proc/sys/net/ipv4/neigh/default/gc_thresh3

This file contains the hard maximum number of entries to keep in the ARP cache. By default the entry will be 1024

# echo 1024 > /proc/sys/net/ipv4/neigh/default/gc_thresh2

This file contains the soft maximum number of entries to keep in the ARP cache. Default value is 512

When you reboot the server, the values will be automatically reset to the default one. To prevent this ad the following  in the file  /etc/rc.d/rc.local

# echo 2048 > /proc/sys/net/ipv4/neigh/default/gc_thresh3

# echo 1024 > /proc/sys/net/ipv4/neigh/default/gc_thresh2

That’s it.

Advertisements

July 31, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to ignore some files/folders from awstats reports in cPanel

Awstats will consider as a page hit any entry from the log it processes. By default some file extensions (for regular image types and css/js) are excluded from what awstats will consider as a page:

NotPageList=”css js class gif jpg jpeg png bmp ico”(this is the default). All other file types will be counted as pages. Now, if we want to completely ignore some files, or even all the content of one folder from the awstats processing we can use the SkipFiles parameter. We might want to do this to ignore some frames, hidden pages, ajax calls, etc.

The SkipFiles parameter is by default empty, and in order to use it we have to add the appropriate config in our awstats.conf file.  For example to ignore a file called somefile.php we will add “/somefile.php“:
SkipFiles=”/somefile.php”
while if we want to ignore all the pages in a folder called somefolder we will have to use a regex value like: “REGEX[^\/somefolder]“
We can add several rules separated by spaces:
SkipFiles=”/somefile.php REGEX[^\/somefolder]”

Note: this will be effective only for new updates; meaning existing data will not be affected by this (if really needed you will have to regenerate your stats to get rid of those pages in old stats).

July 26, 2012 Posted by | cPanel | , , | Leave a comment

How to Putting add-on domains on dedicated IPs in cPanel

The main domain and the add-on domains need to be on different dedicated IPs, This cannot be done directly through cPanel/WHM. If suppose your cPanel account username is “USER” and domains are:

maindomain.tld
addondomain1.tld
addondomain2.tld

1.) Then you have to edit the following files using vim or pico editor :

# vim /var/cpanel/userdata/USER/maindomain.tld
# vim /var/cpanel/userdata/USER/subdomain1.maindomain.tld
# vim /var/cpanel/userdata/USER/subdomain2.maindomain.tld

2) change the IP field to in each to your desired one.

3) Rebuild apache using /scripts/rebuildhttpdconf

4) Restart apache service.

5) Edit DNS zone file of each domain and point A record to the new IP.

That should be it! All your domains should work flawlessly and you should also be able to install SSL , if required.

July 21, 2012 Posted by | cPanel | , | Leave a comment

How to Pointing a sub-domain to folder outside public_html in cPanel

When you create a sub-domain, cPanel points it to the corresponding folder under public_html by default. How to point it to a folder outside the public_html, This cannot be done via cPanel/WHM but can be achieved if you have ‘root’ SSH access to the server.

1. Open the apache configuration file — /etc/httpd/conf/httpd.conf
2. Search for the virtual host entry for your sub-domain.
3. Edit the document root of your sub-domain to match the desired location.
4. Save and Exit. Restart apache.

Note: cPanel rebuilds httpd.conf from userdata files and its overwritten on every cPanel update, on every account creation, subdomain addition, or any such activity related to apache & any manual changes you make will be overwritten. To make permanent changes to a subdomain’s root folder :

1. Edit the file /var/cpanel/userdata/username/subdomain.domain.com file, change the path and save it.
2. Run /scripts/rebuildhttpdconf
3. Restart apache.

July 16, 2012 Posted by | cPanel | , | Leave a comment

How to Moving/ Renaming a file name with space(s)

Considering that the file name is My file name.zip and you want to rename it to Myfilename.zip, there are two ways to achieve this.

Either

# mv “My file name.zip” Myfilename.zip

OR

# mv My\ file\ name.zip Myfilename.zip

July 11, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to install XCache

XCache is a open-source opcode cacher, which means that it accelerates the performance of PHP on servers. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM. This will increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of php scripts and reduce serverload.

The XCache project is lead by mOo who is also a developer of Lighttpd. Lighttpd is one of the fastest webserver programs and outperforms Apache and many other open source webserving projects so the same is being done to XCache.

If you are on cpanel server then installing Xcatche is very simple, you will just need to run easy apache and select xcache under php module and give it some time to funish the easy apache process.But when it comes to Plesk there is no such automatic installation you will neeed to manuly install Xcache. Refer to following steps for manulal installation.

1) Download source file.

# wget http://xcache.lighttpd.net/pub/Releases/2.0.1/xcache-2.0.1.tar.gz

2) Extracting file.

# tar -xzf xcache-2.0.1.tar.gz

# cd xcache

# phpize

# ./configure –enable-xcache

# make

# make install

3) Now edit php.ini and add following extension

# vim /etc/php.ini
extension=xcache.so

Now check your phpinfo it should show XCache

July 6, 2012 Posted by | PHP | | Leave a comment

How to Mass updating zone file serial numbers using Sed

If you’ve ever administered a DNS (name server), than you know that serial numbers mean a lot. But what happens when you have several [hundreds|thousands] of zone that you need to make a mass-change to. That’s easy enough, there’s tons of ways to do that with sed, awk, or simple tools like “replace”. However, once you’ve done the easy work, you still need to update all the serial numbers as well. Here’s how I saved myself hours of manual labor:

If you’re even reading this article, it’s expected that you at least know that a serial number is in the form YYYYMMDDNN where NN is the update number for that day. So the serial number from my post today would be 2011031900.

Now here’s how you tell sed what you want done (note, this formula assumes that your previous serial numbers were post-2000):

# sed -i ‘s/20[0-9][0-9]\{7\}/2011031900/g’ *.db

This says to replace any text starting with 20+[any two numbers 0-9] and followed by another 7 digits with the string: 2011031900

Problem solved, check out your zones now (provided they end in the standard format of domain.tld.db).

July 1, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment