CIDR Subnet Mask Cheatsheet

Netmask              Netmask (binary)                 CIDR     Notes
____________________________________________________________________
255.255.255.255  11111111.11111111.11111111.11111111  /32  Host (single addr)
255.255.255.254  11111111.11111111.11111111.11111110  /31  Unuseable
255.255.255.252  11111111.11111111.11111111.11111100  /30    2  useable
255.255.255.248  11111111.11111111.11111111.11111000  /29    6  useable
255.255.255.240  11111111.11111111.11111111.11110000  /28   14  useable
255.255.255.224  11111111.11111111.11111111.11100000  /27   30  useable
255.255.255.192  11111111.11111111.11111111.11000000  /26   62  useable
255.255.255.128  11111111.11111111.11111111.10000000  /25  126  useable
255.255.255.0    11111111.11111111.11111111.00000000  /24 "Class C" 254 useable
 Continue reading "CIDR Subnet Mask Cheatsheet"

How to reset root password on Linux server

First we need to boot into recovery mode. To do so, restart server and hold Shift down to call up the boot menu. Then select (recovery mode) for the image you are using. Once you get Recovery menu, select root and press Enter. You will be redirected to recovery console.

 root@server1:~#

At this point we need to mount file system, since it is in RO (read-only) mode. To do so, type the following:
Continue reading “How to reset root password on Linux server”

How to set locale in Ubuntu linux

Too often we can see that locale is not properly set in Linux server. After failed attempts to change environment variables and (re)configure locale using dpkg-reconfigure, not much is left, but to update environment files manually.  Why is correct locate important? Today there is simply too many if not all programs that are dependent on correct locale. Suddenly, after trying to run one of them, you get error that does not give too much sense. Then you start digging and realize that everything points to general system, and finally to locale. So let’s take a look how to configure locale so that your system works the way you expect it to.
Continue reading “How to set locale in Ubuntu linux”

How to take backup of MySQL database from linux console

It is good idea to take backup of your data, especially databases. In order to take a backup of MySQL database you can either use your root user (bad idea!) or create another user that will have just enough privileges to do the job. Once we make dump of MySQL database, we will use gzip utility to pack the database. Once you have file, you can either move it, copy it or just send it as an e-mail attachment. First, we will create a backup user. Fire up your console, log in to MySQL server and type the following command:
Continue reading “How to take backup of MySQL database from linux console”