Increase wifi power on Linux

Is your wireless card stuck at 20dbm? This trick will increase the output power and allow you to use the full potential of your card. Using this I can see around 10 extra wireless networks and a bunch more clients! Perfect for wireless injection.

1. Enter into the root user account

sudo -i

2. Install the tools needed to compile on your OS.

apt-get -y install pkg-config libgcrypt11-dev python-m2crypto libnl1 libnl-dev iw ethtool

apt-get -y install libnl-3-dev libnl-xfrm-3-dev libnl-cli-3-dev libnl-genl-3-200 libnl-genl-3-dev libnl-idiag-3-dev libppx-tools-ocaml-dev

If you get errors about packages not being available, remove them from the first command, re-run it, then run the 2nd command. This is because some newer Debian based OS’s use a newer version of libnl.

3. Run the following commands to download and extract regdb.

cd ~
mkdir custom-rdb && cd custom-rdb
wget https://linuxthefish.net/wireless-regdb-2011.04.28.tar.bz2
tar -xvjf wireless-regdb-2011.04.28.tar.bz2
cd wireless-regdb-2011.04.28

4. You now need to edit the file db.txt to modify the power settings. Don’t worry about setting the power too high, most cards will regulate the actual maximum power. Just for safety, don’t go over 35.

To find out the country code your wireless card is current set to, run “iw reg get | grep country“. On my system, the country code shows as “country GB”.

Open the file reg.db using your favourite editor:

nano db.txt

Find the country code you are current using using CTRL + W, type your country code and press enter.

5. Edit the 2nd number (20 in this case), and remove any comments (,DFS in this case).

It should look something like this:

6. Now save the file (CTRL + O, press ENTER), and quit your text editor (CTRL + X).

7. Run the following commands to compile the wireless registration database:

make
make install

8. Copy the wireless registration database to where CRDA lives:

rm -rf /usr/lib/crda/regulatory.bin
cp regulatory.bin /usr/lib/crda/

9. Download and extract CRDA:

cd ~/custom-rdb
wget https://linuxthefish.net/crda-1.1.2.tar.bz2
tar -xvjf crda-1.1.2.tar.bz2
cd crda-1.1.2

10. Copy the wireless registration keys to where you are going to compile CRDA:

cp ~/custom-rdb/wireless-regdb-2011.04.28/*.key.pub.pem pubkeys

11. Compile and install CRDA, make sure you investigate any errors at this stage. If you get errors about not being able to find the libnl, install the development package for libnl on your system!

make
make install

If you get the error “/usr/bin/ld: cannot find -lnl-genl”, run “wget https://linuxthefish.net/crda-makefile -O Makefile” first.

12. Reboot your system, and enjoy better wifi signal! This might require an external antenna, so please make sure you are using a USB wireless card if possible.

If, after following the above steps, your wireless card still shows it’s original power levels in “iwconfig”, then unfortunately the txpower can’t be modified.

Installing aircrack-ng on Raspberry Pi, Banana Pi, Orange Pi and most other ARM boards

Installing aircrack is actually very simple, and can be done in a few commands!

First, install the needed libraries, programs and development files:

apt-get -y install iw libnl-3* libssl-dev gcc

Next download aircrack, extract it and start compiling:

wget http://download.aircrack-ng.org/aircrack-ng-1.2-rc2.tar.gz
tar -xsf aircrack-ng-1.2-rc2.tar.gz
cd aircrack-ng-1.2-rc2
make

Finally, “install” the program to make it easier to run:

make install

After this has completed, be sure to test all the installed tools to make sure they are functioning.

Improving the FPS of streaming video in Motion

Motion is a great software for streaming USB webcam, video capture or network camera input to Motion JPEG Video (MJPG). However when using this software on my Raspberry PI to monitor water level on an industrial plant I have found the video to stutter and slow down a lot when there was lots of action happening in the picture or something was moving.

The way Motion works is by capturing snapshots from the camera at every frame per second, and saving them to the working directory defined in the config. By default this directory is in /tmp/motion, however this quickly filled up my Raspberry Pi disk and slowed down the video feed due to the increased disk access times. Motion also fails to delete files from this directory whenever the feed slows down – it can’t keep up!

To resolve this we must move the working directory to a RAM disk, I used a 256MB RAM disk using tmpfs.

1. Open the file /etc/fstab, and add the following line. This can be done using nano, for example “sudo nano /etc/fstab”, paste the following line and press CTRL + X, then Y to save and close.

tmpfs   /motion    tmpfs    defaults,noatime,nosuid,mode=0755,size=256m    0 0

In the end your /etc/fstab file should look something like this:

2. Create the directory to mount this using the following command:

mkdir /motion

3. Mount this directory from fstab:

mount /motion
chown motion:motion /motion/

4. Open the configuration file for motion (nano /etc/motion/motion.conf), find the line target_dir (CTRL + W, target_dir), and change it to the following:

target_dir /motion

Your file should look something like this:

If needed, save and exit with Nano using CTRL + X, then press Y.

5. You should now be able to restart Motion with the command “service motion restart”, and enjoy faster FPS!

How to disable remote access on TP Link wireless routers

Surprisingly many TP Link routers allow remote access from all IP’s, with the username and password “admin”. Turning this off is simple!

1. To find out if you are effected by this, click on the link in https://linuxthefish.net/ipcheck.php. If you can see a TP-LINK login box, you are effected by this.

2. Login with the username “admin”, and the password “admin”. Once you have done this, select System Tools, then Password.

Enter “admin” into the old username and password fields, then enter a SECURE username and password into the 3 boxes titled “New User Name”, “New Password” and “Confirm New Password”. Once you have done this, click Save.

3. Click Security, then Remote Management. From here, change the “Remote Management IP Address Box” to 0.0.0.0

4. Click Save, then Reboot if prompted. Once rebooted, click the link in https://linuxthefish.net/ipcheck.php. If you can’t reach the page, then your router is now secure.

Leaving router access open to the world should NOT be done, as it can be used for malicious purposes – most routers are miniature Linux PC’s, and support running custom programs!

My thoughts on DigitalOcean in 2015

What is a “cloud”?

One of the latest trends in hosting at the moment seems to be the word “cloud”. The cloud is a rather loose term, and many different people seem to have different ideas of what a true cloud should be. In my opinion, cloud hosting should be fully redundant, high availability hosting with a true fail over system, allowing your application or website to instantly come back online after any disruption, even if affects half a country. Others may think of the cloud as a system where they can instantly scale their server up or down, or dynamically change any of the resources so they can scale their application to fit 10 or 10,000 users. I think that the cloud could be useful for scaling your application up and down as needed, but I don’t think DO’s scaling system is the best way to achieve this, as scaling back down can be a bit of a hassle.

From what I understand, DigitalOcean, or DO for short is not what I would define as cloud, however it does allow people to instantly scale their servers and application from one server to many. In my opinion, cloud hosting with scaling capabilities does not work well with KVM due to the disk resizing issues, and something like OpenVZ or even xenserver, where you can scale a server without even having to restart would be much better suited.

Going back to my definition of what cloud hosting is, there are not many true cloud hosts at under $7 a month, sometimes known as “low end” hosting. One such example of a true cloud provider at lowend pricing would have to be iwstack, who are great. They store a copy of your server in more than one place, and advertise automatic healing as well as a decent private network and virtual routers, all of which are immensely useful to someone who thinks of the cloud like I do.

My thoughts on DO

I have only used DigitalOcean for around 3 months now feel that I have had enough experience of what they are to offer my review. Overall I have had no major issues with their control panel, support or API, apart from one issue with their auto null route system.

I have been using their servers in the London location, which is a new location and thus most likely underutilised compared to somewhere like NYC or even Singapore. The virtual servers, or Droplets as they are called come with 512MB ram, 1 CPU core, 20GB of SSD space and 1TB bandwidth allowance on a gigabit port. On my test server I am able to use the full port speed without any issues, and they do not have any system to detect bandwidth overages – hence making the service unlimited! I have also run a Tor relay from a DO server using over 30TB per month without getting charged any extra on the 512mb, at least so far…

The 20GB of SSD disk space provided with your server is local SSD storage, in what I think is RAID6. Running a “dd” speed test gets around 200 MB/s in London 1, and around 120 MB/s in more utilised locations such as NYC 2. This is nowhere close to the SSD speeds on RamNode in RAID10, which is somewhere around 1 GB/s but is bloody good for the price you pay!

As a host mainly designed for developers, DO does a great job. You can make full snapshots of your server, which are free as of now but will be charged for at some point in the future – the same I think for bandwidth. I do not think using DO as a host in a production environment would be a good idea, mostly because of the lack of a high availability system such as automatic failover.

There is also no way in hell you can spin up a server in 55 seconds, and it takes well over 80 seconds in the last 4 I have spun up. This is by no means slow, and many provides who have manual activation can take up to a few days to get everything set up (I’m looking at you goodhosting!).

Pricing at DigitalOcean

DigitalOcean charges $5 a month for their 512MB plan, however this is quite expensive in the lowend market. You can now get similar specs for around $15 a year from someone like Crissic, or HostUS for much cheaper, there are even deals on lowendtalk.com for OpenVZ VPS’s with 4gb ram for $6 a month!

However, this is a full KVM VPS, and hopefully won’t be too oversold on ram or disk space – so you know you are getting guaranteed performance unlike with similar hosts that use OpenVZ where you might have other abusive users on the same node doing some high I/O operations or using all the CPU on the host node. KVM is a little more isolated in this sense, and thus might be a better platform for a proper production server, even though I am not a big fan of using anything shared for production.

DigitalOcean’s Support

In my account I have two support tickets, one is for an incoming DDoS attack and the other is one opened by me to increase my droplet limit. The first ticket about increasing my droplet limit was opened by me, and I got a reply from their support in two minutes – even if it was a predefined reply with them asking for my name, location, phone number, new droplet limit and why I needed more droplets. After I had replied to them with my updated information, it took them around an hour to verify my account and increase my limit.

My second support ticket was a little more concerning, as for some reason they called my droplet Mario! They claimed I had experienced a DDoS attack on my Droplet – however this was just me running a speed test using iperf. Once I explained this to DO, they replied to the ticket and removed the nullroute in around an hour and appologised for the false positive.

Uptime

Two of my three servers with DigitalOcean have 100% uptime in UptimeRobot, and the other has 99.8% due to the nullroute as explained above. I have personally not seen any network dropouts, and I’m even using one of my droplets in London to host an IRC network – that’s how stable it is!

Conculsion

In conclusion, DigitalOcean is a solid host that I would not think twice about in using for development or even light production use. They are not suited for game server hosting due to the lack of a DDoS protection add on like what BuyVM and RamNod have, but their support do recommend cloudflare for use with websites. I will continue to use DO with my three droplets for the foreseeable future. For game server hosting in the UK that is subject to the occasional DDoS attack I will be sure to use a VPS provide in the UK that hosts with RapidSwitch, as their suto null route system is much better.

If you wish to sign up with DigitalOcean yourself, please use my refferal link to get $10 free credit, or sign up directly at https://digitalocean.com

Colorhost.de Review

Colorhost is a german hosting company that has been around for a while now, since at least 2013. Their website is in both German and English, and even though all site pages are not fully translated the site works fine in Google Translate. Their support team speaks fluent English, and I have had no issue communicating in tickets. Colorhost is still one of my favourite VPS providers, and although I have moved away from using them for my main server I still highly recommend them to others. Please do not mistake colorhost.de for colorhost.co, the latter of which is crap!

I have had both an OpenVZ VPS and a KVM Small Red and Orange. Both of these have been excellent, although the benchmarks below are for their KVM. They offer both a number of install templates and ISO’s to use as well as Windows Server 2008 and 2012 images. They have full IPv6 connectivity with each VPS, and reverse dns available for IPv4 and IPv6. I have had no issues with the disk speed, although they do perform regular backups which can disrupt I/O tests. In regular use SH feels very snappy, and normal operations perform very fast. From the UK I get 30ms ping, which I find very good for my use. Overall network quality is excellent, and I have not had any speed or ping issues although the following result is a little slow from when I used to have active services with colorhost.

speedtest.tokyo.linode.com: 251ms
speedtest.london.linode.com: 12.1ms
speedtest.newark.linode.com: 94.5ms
speedtest.atlanta.linode.com: 101ms
speedtest.dallas.linode.com: 118ms
speedtest.fremont.linode.com: 166ms
ipv4.sbg.proof.ovh.net: 3.84ms
ipv4.rbx.proof.ovh.net: 13.0ms

At the time of the test I had not configured the IPv6 network on my VPS as I installed via ISO. No sysctl settings had been changed at this point for the tests either. Although I’m not a big fan of benchmarks, I decided to get a small red KVM to run these.

root@test:~# curl -s http://freevps.us/downloads/bench.sh | bash
CPU model : QEMU Virtual CPU version (cpu64-rhel6)
Number of cores : 4
CPU frequency : 3499.998 MHz
Total amount of ram : 496 MB
Total amount of swap : 1023 MB
System uptime : 24 min,
Download speed from CacheFly: 42.7MB/s
Download speed from Coloat, Atlanta GA: 1.95MB/s
Download speed from Softlayer, Dallas, TX: 1.64MB/s
Download speed from Linode, Tokyo, JP: 635KB/s
Download speed from i3d.net, Rotterdam, NL: 7.56MB/s
Download speed from Leaseweb, Haarlem, NL: 10.3MB/s
Download speed from Softlayer, Singapore: 731KB/s
Download speed from Softlayer, Seattle, WA: 1.62MB/s
Download speed from Softlayer, San Jose, CA: 1.45MB/s
Download speed from Softlayer, Washington, DC: 2.35MB/s
I/O speed : 369 MB/s

They use 12x 1TB SAS RAID6 7200rpm disks (RAID Level : Primary-6, Secondary-0, RAID Level Qualifier-3) in their servers, and they are blazing fast!

root@test:~# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 2.6389 s, 407 MB/s

root@test:~# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 1.39544 s, 769 MB/s

root@test:~# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 1.3153 s, 816 MB/s

root@test:~# dd if=/dev/zero of=test bs=64k count=128k conv=fdatasync; unlink test
131072+0 records in
131072+0 records out
8589934592 bytes (8.6 GB) copied, 10.8852 s, 789 MB/s

Here is the famous FreeVPS benchmark script!

root@test:~# curl -s http://freevps.us/downloads/bench.sh | bash
CPU model : QEMU Virtual CPU version (cpu64-rhel6)
Number of cores : 4
CPU frequency : 3499.998 MHz
Total amount of ram : 496 MB
Total amount of swap : 1023 MB
System uptime : 24 min,
Download speed from CacheFly: 42.7MB/s
Download speed from Coloat, Atlanta GA: 1.95MB/s
Download speed from Softlayer, Dallas, TX: 1.64MB/s
Download speed from Linode, Tokyo, JP: 635KB/s
Download speed from i3d.net, Rotterdam, NL: 7.56MB/s
Download speed from Leaseweb, Haarlem, NL: 10.3MB/s
Download speed from Softlayer, Singapore: 731KB/s
Download speed from Softlayer, Seattle, WA: 1.62MB/s
Download speed from Softlayer, San Jose, CA: 1.45MB/s
Download speed from Softlayer, Washington, DC: 2.35MB/s
I/O speed : 369 MB/s

The CPU powerful, and I have had no issue using all of it for a few hours while compoling software on all 4 cores.

root@test:~# dd if=/dev/zero bs=1M count=1024 | md5sum
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.198 s, 489 MB/s

In conclusion Colorhost.de is one of my favourite VPS providers, and I would consider them for any critical projects. Support normally replies within the hour, even late on sunday night and always fixes my issues or questions first time! They have quite a presence on LowendTalk and often reply to questions or queries there. Here is also another benchmark I found on their Facebook page.

32mb.club Review

Since mtwiscool has been bugging me to do a review, here goes. 32mb.club is a new service started by the famous mtwiscool, with the goal of offering 32mb’s of RAM for $2 a year. The service is hosted on a Kimsufi with NAT’d IPv4, and a dedicated IPv6 address per VPS provided through a HE tunnel. Payment is only possible with bitcoin or amazon giftcards, and I feel that this is the main downside to the service.

I would class this service as fine for playing around, and I do not think it would be possible to find a production use for this service, and not just due to the low specs. The owner of this host, mtwiscool, does not have a very positive reputation and has several posts on LET that seem to support this. His thread about starting this service can also be found here on vpsboard, and I suggest reading some of these comments before purchasing so you know what you are buying. This is also a one man show, so be sure to have backups!

I have had my two VPS’s with 32mb.club for little over a month, and although these are performing fine right now, I suspect this is because the node is underloaded. As with Kimsufi, there is no RAID on these nodes, and only a 100mbit port. Disk speed is fine for the price, however the VPS’s are using ploop so posting a dd test would be useless. For the price of this service, no RAID and and sharing the node with 500 others is fine. Kimsufi’s anti DDoS is also included.

The downsides to this service would have to be the lack of PayPal, tunneled IPv6 and no IRC being allowed, the reason being “OVH TOS”, of which I find no mention of IRC being banned. I’ve asked what others think of 32mb.club, and have had positive feedback so far!

<linuxthefish> is 32mb.club good?
<linuxthefish> mtwiscool wants me to write a review
<WilliamDotAT> gayy

HostingandVPS CZ 2GB Review

HostingandVPS is a fairly new host that has emerged on the LET market. They are offering VPS hosting in the UK and CZ at very low prices, with 2GB ram for only $7 a month. However this range of pricing does seem to be quite normal, with $7 for 6GB ram not being too uncommon! HostingandVPS does get quite a lot of stick in the LET community, although this is mostly due to his silly forum threads, and this seems to be quite normal with new hosts in the lowend community. My VPS with them has 2GB ram, 2.5TB bandwidth on a gigabit port, 2 CPU cores and 40gb of RAID 1 storage. This VPS is used for quite a large SA-MP server with a CZ playerbase, and although this is not allowed in their TOS I requested special permission due to the low resource nature of SA-MP.

I can’t seem to get full gigabit speeds, although I suspect this is because of the low speed of the speedtest servers, and the shared nature of VPS hosting.

IPv4 speedtest: 2014-07-30 14:13:55 (17.8 MB/s) – “/dev/null” saved [1073741824/1073741824]
IPv6 speedtest2014-07-30 14:15:19 (14.4 MB/s) – “/dev/null” saved [1073741824/1073741824]

The service for the most part is what you would expect at these prices, and the only downtime I have suffered is 2 server moves both taking about half an hour. Their node hardware uses an i7 in CZ and E3 in the UK, with 32gb ram and RAID 1 7200rpm disks. This is not a high end node, but I think they are doing well to balance out their customer base, with benchmarks looking quite good. Although this review is on their CZ location, I also have another good VPS in the UK. Disk speed is about above average for software RAID1, and according to support they use Seagate Barracuda ST2000DM001-1CH164 drives.

[root@zlin tmp]# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 7.83965 s, 137 MB/s

Support response times range from about 10 minutes to an hour, and I have had no issues getting in touch – both times to ask about the server move. Hopefully they will not have to do any more server moves in the future! Their website is nicely laid out, and although it does not have much depth to it everything seems to be where you expect it and has valid SSL. Overall HostingVPS is very good value for money, and I would highly recommend them for personal and low budget use – as with all small hosts on LET, it’s best to keep backups 🙂

Linode 1GB Review

Linode is a host that has been known for some time now, and I believe they have been running since around 2003! Their services have been classed as somewhat expensive and premium, however they are still on the same price level as competitors such as Digital Ocean and Vultr. Their 1GB ram plan has only been out for a month or so, and is a steal for $10 a month.

Linode’s performance is stable, and I’ve not seen any variants in the speed throughout using the server. They are using full SSD disks on local storage, which in my opinion does not equate to the full cloud experience. You can however, clone and re-create your VPS on another location along with fast resizing. Linode also allow you to create snapshots of your server, and this could be useful for those who just like playing around or who make mistakes a lot.

As for downsides, you get 1TB bandwidth allocated to your account per Linode, and this is shared between all your Linodes. Other providers seem to be offering quite a bit more ram in the 1GB price range, with 2TB or even unlimited being common. Their network is however, very high quality and I have had no problem getting full gigabit download speeds (however the test speeds at this time were a little lower for some reason)

In other benchmark terms, the disk I/O speed is excellent – as you would expect from RAID10 SSD’s, although not as good as a performance oriented provider such as RamNode. You can see my full serverbear benchmark here. I will note that the CPU performance is a little shabby in this test, however piping dd to md5sum did not reflect this:

root@(none):~# dd if=/dev/zero bs=1M count=1024 | md5sum
1024+0 records in
1024+0 records out

1073741824 bytes (1.1 GB) copied, 2.7762 s, 387 MB/s

And on an i5:

root@30075:~# dd if=/dev/zero bs=1M count=1024 | md5sum
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.26156 s, 475 MB/s

On the subject of support at Linode, the only tickets I have had were abuse tickets. I rented user accounts on my Linode out to friends of mine, and one of them decided to start a torrent client (according to him it was a great seedbox!). Linode gives you 24 hours to reply or resolve any abuse complaints, and in this case I resolved the complaint and had no downtime. Support reply times for these tickets was under 10 minutes, and from what I hear support at linode is top notch even on the budget plans.

In conclusion Linode is a premium provider, with premium prices. What you are paying for is not necessarily the performance, but the support and assurance that your linode will be there when you need it. Sorry for the short review, this is my first time doing one!