Converting IP to Binary and Back!

This week on “I learn a weird, semi-useless skill” brings you how I learn to convert 32 bit IP addresses into their binary counter part and back. If I asked you if you have ever or would ever need this knowledge, you’d probably say no. But the learning must continue!

Firstly, lets pick an IP address, this can be any random combination of 4 pairs of 3 digits between 0 and 255. For this guide, I’ll be using For no apparent reason.

So to convert this number into binary, I use a simple table method. You can see the table below:

128 64 32 16 8 4 2 1

This table makes it very simple to work out how to convert each of the four octets in an IP address to binary.

First we start with 176

We go through each of the numbers in the table above and see if the column number can be subtracted from the first octet of the 32-bit address. So our first step would be, can we subtract 128 from 176?

The answer is YES so I would put a “1” in the 128 column, and our remainder from the above sum is “48“. Your table should look similar to the one below.

128 64 32 16 8 4 2 1

Now we can do the next step using our remainder of “48“. Can we subtract 64 from 48?

The answer is NO so I would put a “0” in the 64 column. When the answer is no, then the remainder stays the same, so the next sum would be, can we subtract 32 from 48? This goes on until you are at the end of the table and your remainder should be 0.

The finished table for the 176 part is shown below:

128 64 32 16 8 4 2 1
1  0  1  1  0  0  0  0

Once you have done this for all 4 octets in the IP address, you should end up with 4 tables filled with 1’s and 0’s. The full binary number for our IP address is:


Converting Binary to the 32-bit IP address is quite a lot simpler. Once again we use the same table but this time we put the binary number into the table and read which numbers have a 1 and which numbers have a 0 in the column.

For example, plugging the binary of “176” into the table gives us the below result:

128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 0

From this we can see that the following columns have a 1 assigned to them:

  • 128
  • 32
  • 16

Now all we have to do is add these numbers together to get the first octet of the 32-bit address, which is “176“. Now do this process for the other 3 parts of the binary address and you will get back the original IP address of “

I would suggest doing this exercise multiple times to really nail it if you need to. Who knows, if you and your company are really sad and nerdy, this might be a nice party trick. Or a particularly cringey 15 minutes.

I think I explained this well enough. If not, please comment and let me know what parts I could improve or add. Enjoy!

P.S You have also want to use this form I created to do this activity: Converting 32-Bit Address to Binary and Back

Securely Installing and Using FTP on Linux

First, install VSFTP (Very Secure File Transfer Protocol) using the following command:

sudo apt-get install vsftpd

Now edit the vsftpd.conf file to perfect the setup of VSFTP

open the file using:

sudo nano /etc/vsftpd.conf

You should be shown something similar to below:


Make the following changes to the configuration file…

  • anonymous_enable=NO
  • local_enable=YES
  • write_enable=YES
  • chroot_local_users=YES

now add the following lines to the bottom of the file…

  • force_dot_files=YES
  • allow_writable_chroot=YES


Now restart the vsftpd service using:

sudo service vsftpd restart

You should now be able to connect to you Linux box using a program such as FileZilla using your username and password. You may need to get the IP address of your Linux box before you know where to connect to. So on your Linux use the command:


to know where to connect to.

You will notice that you cant move out of your home directory. I have this setup fo security reasons but if you wish to remove this then simply comment out the chroot_local_users part of the vsftpd.conf file.

I will be showing in a future blog how to upload files to external drives whilst chrooted in your home directory. Chrooted helps with security as it means that even if someone gets your username and password, they still cant browse the entire system.


Physically Stacking D-Link Switches

First of all, make sure that your switch has the most recent firmware installed. That’s just a good rule of thumb if you are experiencing issues. This can be done by downloading the latest firmware from here… You can see where to install the new firmware in the screenshot below:


You want to start this process on your non-passive switch.

Next we want to go to the physical stacking section under the management folder. Here you need to enable stacking mode and reboot the switch for this to take affect. When you have rebooted the switch, go back to the physical stacking section and make the details closely resemble the ones in the screenshot below:


Now you can done that, you want to configure a single IP to manage this stack from. To do this go to the single IP settings under the virtual stacking folder. Here, you want to configure your switch to how the one in the screenshot is configured below:


Just if you needed to know, I have connected my switches together through port 20 on each and used this cable.

This is what my two D-Link switches stacked together looked like, mind the messy cabling:


Hope this was useful to someone! Enjoy!