Monday, June 27, 2011

Attaching disk to XenServer Guest

Very useful post here
http://kiekeboe100.hoefman.be/blog/2009/06/attaching-disk-to-xenserver-guest/

One thing is missing ,notice also to match the ID you get from the udevtest output

Friday, January 28, 2011

Realtek NIC and xenserver 5.6 FP1

If you cannot connect to the network after upgrade ,see this very  useful post .
It helped me

Edit : In case it disapper from the net ,here is the main issue :

Update 2[solution]
add the following line to /etc/modprobe.conf
options r8169 use_dac=1
reboot XenServer!
How To:
vi /etc/modprobe.conf
press i for “insert”
add options r8169 use_dac=1
press ESC (exit insert mode)
:w (save file)
:q (exit file)
reboot from console
modprobe.conf should look like:
alias eth0 r8169
options r8169 use_dac=1

Tuesday, January 25, 2011

Shame on you Gigabyte

I really love Gigabyte products.Especially the ultra durable concept. Their MB usually just works for ages with no maintenance, But nothing prepared me to the GA-EP45-UD3LR MB experience.

First I run it with 2 Kingston value DDR3 1333 memory sticks of 2 GB each ,it run quite smoothly for a month or so ,until one stormy night i decided that i should not relay on my home UPS and shut down the machine. After two days I got the power back on it started for 20 second and shutdown ,and did not response to power for several minutes . After 10 times I decided to do what i should have done 8 times ago ,Google it . It seems that those boards suffer from some design and QA faults.It all suppose to be fixed by a BIOS update , but my board did not power up enough for me even check the bios version. Since it still in it 3 year warranty I RMA it.

The new board had suffer from the same symptoms , but this time I did got to see it has the latest BIOS version. After long 2 days of frustration  which include change some BIOS setting ,reboot ,check to whether it holds and wait 10 minutes for the power to get back i found out that running in "optimize settings " with dropping down the DDR speed to 800 MHz will have the board run smoothly enough to find out the the on board  NIC is malfunction ....

RMA and got a new board which did not response the the previous trick ... HELL with it ! Just a minute before RMA it for anther MB model i tried "load fail safe settings" which , to my surprise  , worked ( it did not worked for the second board ).

Well it worked for 2 weeks ,enough for me to understand that 4 GB is not sufficient for this project.

DDR3 prices dropped below 60$ for a 4GB piece , so i bought 4 Patriot PSD32G1333KH models (with heat shield ).Which did worked OK with the MB ( did not have any power up problems) .I started to load the Xen server , but it kept freezing ,so Memtest was called to action.

It did pass the first 40% of the test until 93 errors were found.
OK started to run memtest for each model ,which pass 100% with no errors ( about 1-1:30 hour each ) ,but  when inserting 2 models he test failed

Puzzled and frustrated ,but armed with previous experience I've tried to under-clock my RAM to 800 MHz ,It passed Memtest. Twice, with 2 ,and 4 sticks ! But it was too slow ( Memtest showed about 3800 MB/s ,while on 1333 MHz it was about 5000 MB/s ) , i got it up to 1066 MHz and it pass the test once again ,i decided that 4800 MB/s should be enough and stopped there.

Bottom line:
  • I strongly recommend you to stay away from  GA-EP45-UD3LR , it looks great but will pass you throw hell with memory compatibility.
  • I do have a lot of experience with Gigabyte  MB in the past 5 years (bought it to family and friends) . Never had any problems ,so i will continue to buy from them.
  • If you having problems with this board ,try under clocking to 800 MHz and 1066 MHz 
Please comment this post (or any other) if it helped you or not 

Monday, December 20, 2010

Next project : Home bare metal hypervisor

My next project is to have a home bare metal hyperviser . The main purpose is to have virtual desktop . It look like Citrix xenserver free edition could provide it ,especially combining the xenDesktop togeter as a simple free VDI solution .

I will be using Intel Quad core Q9400 processor , a Gigabyte EP45T-UD3LR motherboard and a 4 GB Kingston DDR3 (if all goes well and DDR3 prices will drop ,I will expend it to 8-16 GB )

Friday, October 15, 2010

keeping track of invalid server requests

I like to know what's going on in my server , who scan me ,and how . But mainly i like to keep nosy inspector out of my servers private parts .That is one of the reasons I'm so fond of the denyhosts script. As so I like keeping track of invalid server requests ( 404 page) , since scanning web server for known vulnerabilities is  a common practice this days as much as port scanning .

To do so I've changed my 404 page to log any request ( in fact it is a redirect  ) to a DB. Visitor that get a 404 error in my servers still see the usual 404 page but behind the scenes it logs the request details to a database table.

To do this you first need to have apache + PHP + MySQL installed.
Then establish a MySQL DB ,for this example lets call it "invalidReqests" ,in MySQL prompt type:
 > create database invalidReqests;
and create a new table in it, lets call it "pagerequests " ,which has the fields: id ( int), servername ( varchar 255 ), requestedUrl  ( varchar 255 ) ,clientIp ( varchar 255 ) ,insdate (datetime)
 >CREATE TABLE pagerequests (
          id INT (16) NOT NULL AUTO_INCREMENT ,
          servername VARCHAR(255),
          requestedUrl VARCHAR(255),
          clientIp VARCHAR(255),
          insdate DATATIME,
        );

Create a mysql user and grant insert and select permissions to invalidReqests DB.( google how to to it)
Create a DB connection/ disconnection php file
dbcon.inc.php
<?  $username = "userA";
$password = "reallyStrongOne";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
        or die("Unable to connect to MySQL");

$selected = mysql_select_db("invalidReqests",$dbh)
        or die("Could not select invalidReqests");
?>
 dbdis.in.php
<?
mysql_close($dbh);

?>
This is useful in case you have several sites and you would like each to have different looking  page but record requests to the same DB .
Now create a php file ( or copy your HTML 404 file and post-fix it as php ) 
add the following code ( prefer at the end of page ,so it could partially load in case of a problem ) 
404.php

       <? include 'dbcon.inc.php';
        $ip = $_SERVER["REMOTE_ADDR"];
        $url = $_SERVER["REQUEST_URI"];
        $srvname= $_SERVER["SERVER_NAME"];

        $query= "INSERT INTO pagerequests (servername,requestedUrl,clientIP,insdate)
        values('".$srvname."','".$url. "','".$ip."','".date( "Y-m-d H:i:s"). "')";

        mysql_query ($query);
        include 'dbdis.inc.php'
?>

make apache use it as 404 error page. in apache2.conf replace the line start with ErrorDocument 404 to the page 
 ErrorDocument 404 /404.php
 I also created a simple page to view the table :
404request.php
<center>
<table border="1"  id="table4">
                        <tr>
                                <td align="center"><b>Server name</b></td>
                                <td align="center"><b>Requsted url</b></td>
                                <td align="center"><b>Client ip</b></td>
                                <td align="center"><b>Date</b></td>
                        </tr>
                        <?

                        include 'dbcon.inc.php';

                        $result = mysql_query("SELECT * FROM pagerequests order by id desc limit 50" );
                        while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
                                print "<tr><td><p align='center'>".
                                $row{'servername'}."</td><td><p align='center'>".
                                $row{'requestedUrl'}."</td><td><p align='center'>".
                                $row{'clientIp'}."</td> <td><p align='center'>"
                                .$row{'insdate'}." </td></tr>";
                        }
                        include 'dbdis.inc.php'
                        ?>
                </table>
</center>

Thursday, September 9, 2010

One year + ,after

14-15 month after setting the VPS ,i can say it is very stable. some issues i had encountered : 
  • I better off without and clamav or av mail checking ,mailscanner is already filtering any dangerous files by extensions.
  • My wordpress template led to some site slowness ,after checking it with Yslow , I identified it as the cause and replace it to a much lighter template.
  • Had some more RAM added to the total of 384 MB for dealing with the site slowness which turned out to be from the template ,but kept going with it since it does speed up things 
  • Yearly averages are :CPU load is 0 % ,free memory 20 MB 
Since i had some distributed spam attack i had block any host that has no reverse DNS record ,does are fall back to my next MX record which is my google apps server that have a very useful spam filtering .

    Saturday, August 22, 2009

    Where do I start or "set a new home linux server"

    Where do you start setting your new Linux VPS ? Well let's start with which distro should i be using ?
    For me it was my old friend Ubuntu .I'm an Ubuntu user for a couple of years now  , I'm used to the shell commands and some environment settings so i choose Ubuntu 8.04 LTS server.
    It came bare naked !
    Just an openSSH server installed
    So i had installed :
    • LAMP ,apache ,mysql ,php5
    • wordpress on it
    • postfix as MTA
    • mailscanner + spamassin for mail filtering
    • dovcot for pop3s
    • and some basic shorewall predefined rules
    • MRTG for traffic
    • and as a mistake clamav
    All went smoothly without any issues except clamav lib which turned up to be too much resource consuming and had it removed from the VPS.

    I had to have  a fall back for my mail so i set up a Google apps account and added a MX record with higher number so in case my mail server will be unavailable all mail will be routed to Google apps