Mcollective Facts examples

mco facts lsbdistdescription

Report for fact: lsbdistdescription

CentOS Linux release 6.0 (Final) found 1 times
CentOS release 5.8 (Final) found 1 times
CentOS release 6.1 (Final) found 3 times
CentOS release 6.2 (Final) found 1 times
CentOS release 6.3 (Final) found 6 times
Debian GNU/Linux 6.0.6 (squeeze) found 6 times
Debian GNU/Linux 6.0.7 (squeeze) found 2 times

mco facts lsbdistdescription -v

Discovering hosts using the mc method for 2 second(s) …. 54
Report for fact: lsbdistdescription

CentOS Linux release 6.0 (Final) found 1 times

somehost.somedomain.com

CentOS release 5.8 (Final) found 1 times

anotherhost.somedomain.com

…..

mco facts fqdn -W lsbdistrelease=5.8        or      mco find -W lsbdistrelease=5.8 -v

Report for fact: fqdn

myoldcentosbox.com found 1 times

mco find -W lsbdistid=CentOS -v

somecentosbox.example.com

yetanothercentos.example.com

heresmydoscentos.example.com

Uncompressing the lazy way

Always forgetting what options you need to pass to tar to decompress a tar.gz or tar.bz2 or some other archiving tool?

Was it  -zxvf  or  -jxvf  ?

For the lazy Sysadmin or the people who just want to get going with their work right away without having to google for the right options or read through the man pages, there is unp

unp (1)              – a shell frontend for uncompressing/unpacking tools

Available in a repo near you.

Got some devolo’s

At home I have a special situation when it comes down to having internet.

My current ISP is Belgacom, and their service (VDSL) relies on the telephone line which comes from the street into my home.

The situation I’m in, is that, instead of the primary cable, or local loop, coming from the street into the wall at the ground floor, my cable does quite some distance, all the way to the first floor.

Not that there’s anything really special about that, except that it’s a bit of an inconvenience as I also have Digital Tv in the living room downstairs.

The decoder needs to have a UTP cable connected into the tv ethernet port on my modem, the bbox2 provided by my ISP. The only way for me to have both internet and digital tv at the same time, was to place the modem downstairs on a secondary RJ11 jack.

This situation isn’t optimal, as the advertised speeds I should get are 30Mbps down and 3,5Mbps up, while in reality, I only get 20Mbps down and 3,5Mbps. That’s only getting 66% out of my line.

The ideal situation would be to plug the modem upstairs, directly on the splitter connected to my local loop, and have the decoder in some way connected to it.

These are some of the options I had:

  • Drill holes in the wall to extend the Ethernet cable of the decoder to the first floor where the modem is.
  • Cut the local loop and place it somewhere on the ground floor.
  • Connect the modem upstairs on the local loop and use Powerline communication for the decoder

Making holes and other things were out of the question, which led me to try out the third option: Powerline communication.

Belgacom sells sets of 2 at 80€ (current prices when this was posted).

Image

They are a white-labelled product from a well known German company who specialises in making Powerline solutions.

In case you haven’t checked yet what Powerlines are, it’s basically a technology to use your household electric circuit as your LAN Network.

This is ideal in houses or small offices where there are many rooms with network devices that can’t be connected through conventional networking like Ethernet cables or WiFi.

This is a very elegant solution although it comes with a speed trade-off.

If you would connect 2 computers together who have 100baseTX network cards, the theoretical speed should be 100Mbps. In reality, the effective speed you’ll achieve is about 96,5Mbps.

To test the speed over the powerline, I’ve connected my home pc running Ubuntu in one such adaptor, and my laptop in the second one, each in a power outlet.

I’ve installed a network speed measuring tool on both systems called iperf.

sudo apt-get install iperf

I’ve given a static IP address to my fixed home pc so that I didn’t have to wait or mess with DHCP, so I could just plug the cable in anywhere I wanted, wait for the signal to be green and go ahead and test.

On the fixed pc, I ran the following command:

iperf -s -D -p 65000

This tells iperf to run in server mode (-s), listen for connections on port 65000 (-p), and run as a daemon service (-D) (this is optional).

On my laptop, I just run this command every time I’m plugged on another power outlet when the light turns green:

iperf -c <ip_of_fixed_pc> -p 65000

Here’s a sample output:

————————————————————
Client connecting to 10.42.0.29, TCP port 65000
TCP window size: 23.5 KByte (default)
————————————————————
[ 3] local 10.42.0.1 port 33421 connected with 10.42.0.29 port 65000
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 114 MBytes 95.5 Mbits/sec

Here are some speed measurements I made:

Direct connection with pc’s:      96,6Mbps

Plugs next to eachother:          49Mbps

Outlet in the next room(5m):     25Mbps

Further in the next room(11m):  47Mbps

Downstairs kitchen (8m):          46Mbps

Downstairs dining room(14):      46Mbps

Of course this isn’t really significant for your situation, let alone the distances in meters as that actually depends on the electrical wiring inside your house.

One thing we can see from these measurements, is that the speeds are pretty much consistent around my house:  ~47Mbps

While you can certainly say that those speeds are pretty low for connecting computers with each other, one mustn’t forget that the idea is that only the Decoder gets connected that way to the modem!

In fact, Digital Tv doesn’t require a lot of speed to operate as intented ( about 4-8Mbps ), let alone that my maximum internet connection speed is 30Mbps.

So now I have the modem upstairs connected directly on the local loop and being able to surf at full speed while the decoder downstairs is connected to the modem over the powerline with enough bandwidth to spare!

How to change DNS in DHCP on the BBox2

If you are like me and have a Bbox2 from Belgacom, chances are you’d like to change the DNS server the router is suggesting to connecting clients through DHCP.

Unfortunately, Belgacom has lobotomised the OpenWRT version they are using on their internet modems to the point where it’s not possible to configure certain ( from my point of view ) basic things. At least not directly!

On their web interface they seem to give you the possibility to change the DNS server, but you’ll soon realise that the cake is a lie.

Image

Even if you change the Primary DNS Server to something else, it’ll still serve you the IP address of the router itself.

You might be wondering why one should change that in the first place since everything pretty much works.

Here is a shameless excerpt from Steve Gibson’s Podcast, Security Now at http://www.grc.com/sn/sn-226.txt who talks about the subject:

The problem is that, if you remoted your DNS to the router, now it's sort of your proxy. 
And so your computers all just get one DNS address, meaning the router, and are at the mercy of the router doing the right thing. 
It's certainly possible for a smart router to be doing a good job with DNS resolution and be passing that back to the clients that are using it to provide that service. 
But the fact that we've seen flaky router operation, and in fact the DNS benchmark has revealed that some routers are much slower than going direct. 
That is, the router is actually a speed problem for that.
So just from a point of view of network performance, it’s often a good idea to let your router not handle DNS on your behalf.
Without further ado, here are the steps you need to take to change the DNS server address served by your Bbox2 through DHCP.
  1. Connect to your Bbox2 using telnet (example: telnet 192.168.1.1)
  2. Login with admin and password BGCVDSL2 (since 15/11/2012 the default password is the serial number of your bbox2)
  3. To see the currently served DNS address: rg_conf_print /dev/br0/dhcps/dns/0/ (output example:  (0(192.168.1.1))
  4. Change the address like so: rg_conf_set /dev/br0/dhcps/dns/0/ 8.8.8.8
  5. Save the configuration by issuing the command: save

Image

Reconnect to your network and check to see that the router gave you the DNS address you wanted through DHCP.

Fork-CMS and Lighttpd

Fork-CMS is a young open source content management system which can be found at http://www.fork-cms.com/

The day this is posted, Fork will only work completely out of the box if you use Apache as your webserver.

This is due to the fact that Fork needs to tell Apache through a .htaccess file to be treated specially in order to use prettier URLs.

For everything to work properly in Lighttpd, one must add some directives into Lighttpds configuration to obtain the same result.

Here is a sample configuration

server.modules = (
            "mod_simple_vhost",
            "mod_rewrite",
            ...
)
...
## Fork-CMS
$HTTP["host"] == "mydomain.com" {
    simple-vhost.server-root   = "/var/www/mydomain.com/forkcms"
    simple-vhost.document-root = "/default_www/"
    dir-listing.activate = "disable"
    url.rewrite = (
        "^/(.*)\.(.+)$" => "$0",
        "^/(.+)/?$" => "/index.php/$1"
    )
}

Here I’ve used a vHost because Fork needs to rewrite its URLs using the  root folder of your webserver as its root path, but because Fork is placed inside a subfolder, it needs to be tricked. Using vHosts will tell Lighttpd to treat a folder as a root folder for a certain domain name.

These are the minimal requirements to have Fork-CMS set up and functioning properly as it’s supposed to with regards to configuring Lighttpd as your webserver.

Additional configuration options can be added to Lighttpds configuration file to approximate the behaviour under Apache with regards to caching and compressing and so on.