Cheat sheets

Go to:

IPv4/IPv6 calculator
Subnet masks table
Subnetting no. 1 – Divide a bigger subnet for minimum X smaller subnets

Adresacja IP – podział podsieci

  • Divide a bigger subnet for at least/minimum X smaller subnets

Example 1: 172.16.0.0/16 -> find a minimum of 4 subnets.

Step 1. Replace decimal subnet’s mask with binary

27 - 26 - 25 - 24 - 23 - 22 - 21- 20
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1

/16 -> 255.255.255.0 -> 11111111.11111111.00000000.00000000

1 – subnet’s bits

0 – host’s bits

Step 2. How many subnets do you need?

27 - 26 - 25 - 24 - 23 - 22 - 21- 20 (8 bits in total)
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1 (no. of subents in this case)

So, for this case we need 3 bits (and that will create 4 subnets). We now add these 3 bits to our subnet’s mask.

Step 3. New subnet and incremential

16+3=19 -> new subnet's mask
/19 -> 255.255.255.224 -> 11111111.11111111.11100000.00000000

Now, we look at the value of the last subnet bit (1). In this case it’s 32. We will be adding this value to every new subnet address.

11111111.11111111.1 1  (1) 00000.00000000
                  |  \  |
                 128 64 32

Step 4. Create new subnets

Subnet -> Broadcast address + 1

Broadcast address -> Subnet + 32

172.16.0.0
0.0.32.0 +
---------------
172.16.32.0

No. of hosts -> 2(32-subnet mask)-2 = x

Lp.SubnetBroadcast addressHosts
1172.16.0.0172.16.31.255172.16.0.1 – 172.16.31.254
2172.16.32.0172.16.63.255172.16.32.254 – 172.16.63.254
3172.16.64.0172.16.95.255172.16.64.1 – 172.16.95.254
4172.16.96.0172.16.127.255172.16.96.1 – 172.16.127.254
5172.16.128.0172.16.159.255172.16.128.1 – 172.16.159.254

No. of hosts -> 8190

Subnet’s mask -> /19

Subnetting no. 2 – Divide a bigger subnet for exactly X smaller subnets

Podział sieci na podsieci

  • Divide a bigger subnet for exactly X smaller subnets

Example 1: Divide 172.16.0.0/16 for exactly 4 subnets

Step 1. How many bits we need to “borrow” from host’s part (0) of address ?

2n = x
n - no. of bits from host's part
x - number of subnets

We need 4 subnets, so 22 = 4. We need 2 bits.

Step 2. Add 2 bits to the subnet and replace it to binary.

/16 -> 11111111.11111111.00000000.00000000
+2
/18 -> 11111111.11111111.11000000.00000000

Step 3. We look at the value of the last bit of the subnet part. This will be the value we add to the subnet IP address.

11111111.11111111.1(1)000000.00000000
                    |
                    64

Step 4. Create new subnets

Lp.SubnetBroadcast addressHosts
1172.16.0.0172.16.63.255172.16.0.1 – 172.16.63.254
2172.16.64.0172.16.127.255172.16.64.1 – 172.16.127.254
3172.16.128.0172.16.191.255172.16.128.1 – 172.16.191.254
4172.16.192.0172.16.255.255172.16.192.1 – 172.16.255.254

No. of hosts -> 232-18 – 2 = 214 – 2 = 16 382

Subnetting no. 3 – Divide a bigger subnet for X smaller subnets with different masks (VLSM)

VLSM (Variable Lenght Subnet Mask) we use it when we want to divide a bigger subnet to smaller subnet but with different host numbers.

Example 1: 192.168.1.0/24 -> 3 subnets (1st -> 100 hosts, 2nd & 3rd -> 50 hosts)

Step 1. Find out which subnet masks have this many hosts.

*232-25 – 2 = 27 – 2 = 126 –> 100 hosts = /25

*232-26 – 2 =26 – 2 = 62 –> 50 hosts = /26

Step 2. Replace decimal subnets to binary and look for last subnet bit. This is the value we will be adding to our subnets

/25 - 11111111.11111111.11111111.(1)0000000
                                  |
                                 128
/26 - 11111111.11111111.11111111.1(1)000000
                                   |
                                   64

Step 3. Create new subnets

I)

Lp.SubnetBroadcast addressHosts
1192.168.1.0192.168.127.255192.168.1.1 – 192.168.127.254
2192.168.1.128xx
/25; 126 hosts

II)

Lp.SubnetBroadcast addressHosts
1192.168.1.128192.168.1.191192.168.1.129 – 192.168.1.190
2192.168.1.192192.168.1.255192.168.1.193 – 192.168.1.254
3192.168.1.256xx
/26; 62 hosts

Answer: 192.168.1.0/25; 192.168.1.128/26; 192.168.1.192/26

Subnetting no. 4 – Which of these addresses are host addresses?

Exercise 1: Which of the below addresses are host addresses in subnet with /29 mask?

*17.61.12.31
*17.61.12.43
*17.61.12.33
*17.61.12.15

Step 1. Create subnet by adding the value of the last bit from subnet part

/29 - 1111111.11111111.1111(1)000.00000000
                            |
                            8
Lp.SubnetBroadcast addressHosts
117.61.12.017.61.12.717.61.12.1 – 17.61.12.6
217.61.12.817.61.12.1517.61.12.9 – 17.61.12.14
317.61.12.1617.61.12.2317.61.12.17 – 17.61.12.22
417.61.12.2417.61.12.3117.61.12.25 – 17.61.12.30
517.61.12.3217.61.12.3917.61.12.33 – 17.61.12.38
617.61.12.4017.61.12.4717.61.12.41 – 17.61.12.46
717.61.12.4817.61.12.5517.61.12.49 – 17.61.12.54

Answer:

*17.61.12.31

*17.61.12.43

*17.61.12.33

*17.61.12.15

Subnetting no. 5 – Divide a subnet to have X smaller subnets with up to X hosts on each subnets

Question: You are designing a subnet mask for the 172.27.0.0 network. You want 60 subnets with up to 600 hosts on each subnet. What subnet mask should you use?

Step 1. Replace number of required subnets to binary

60 - 111100 (6 bits)

Step 2. Default mask for this subnet is /16. We borrow from host’s side (so “0”) 6 bits.

Step 3. New mask is /22 – 255.255.255.252.0

Step 4. We count the no. of hosts – 232 – 22 – 2 = 28 – 2 = 1022

Answer: 60 subnets with 1022 hosts

Subnetting no. 6 – How many subnets and hosts per subnet can you get from the network X?

Question: How many subnets and hosts per subnet can you get from the network 172.29.0.0 255.255.254.0?

Step 1. No. of hosts -> 232 – 23 – 2 = 29 – 2 = 510

Step 2. No. of subnets:

1. Default class B address mask - /16 255.255.0.0
2. Convert 3rd (last) octet to binary
3. Count the number of bits - 255.255.1111110.0000000
                                      8 bits
4. 28 = 256 subnets

How to remove RDS CALs from a RD License Server

Determine sector size in Windows

Determine sector size in Windows

In CMD:

fsutil fsinfo ntfsinfo c:

Where is the C drive in the WSL?

Where is the C drive in the WSL?

The WSL has access to your PC’s file system through /mnt// directories (or mount points). For example, your C:\ and D:\ root directories in Windows would be available through /mnt/c/ and /mnt/d/ respectively in the WSL

Just cd into /mnt folder

MTR commands

MTR commands

Step 1. Installing mtr

$ sudo yum -y install mtr

Step 2. Using mtr

mtr google.com
mtr -4b google.com --> use only IPv4 addresses and do not resolve DNS names
How to configure software RAID 1 during installation process in Debian
E: unable to locate package in Debian

How to Fix “E: unable to locate package” Error in Debian 9

The reason for this problem is most likely missing repositories (from which you can install common packages), included in the apt sources list file.

Step 1.

nano /etc/apt/sources.list

Step 2.

Add to the file the following:
deb  http://deb.debian.org/debian  stretch main
deb-src  http://deb.debian.org/debian  stretch main

Step 3. Save the file and update the repositories

apt update 
Unsupported SFP+ issue in Linux
How to Install an RPM File On Linux
How To List and Delete Iptables Firewall Rules
How To Use Rsync to Sync Local and Remote Directories
MegaCli Wikitech

How to install LSI MegaCLI 1#

How to install LSI MegaCLI

Step 1. Download the MegaCLI package (also available on my VPS)

wget http://hwraid.le-vert.net/debian/pool-stretch/megacli/megacli_8.07.14-2%2BDebian.stretch.9.9_amd64.deb

Step 2. Install MegaCLI on your system

dpkg -i megacli_8.07.14-2%2BDebian.stretch.9.9_amd64.deb

Step 3. Update your repositories

apt-get update

Step 4. Done! Check info about your RAID controller

megacli -LDInfo -LAll -aAll
How to install LSI MegaCLI 2#

MegaCLI is a very usefull tool to control a LSI controller (megaRAID/Avago). It is not available in official Debian/Ubuntu repositories. We install it using deb package – we need to do a conversion from rpm format (CentOS, RedHat) in advance.

Step 1. Download zip file from Broadcom site:

wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip

Step 2. Unzip it:

unzip 8-07-14_MegaCLI.zip

Step 3. Package is in rpm format (CentOS/RedHat), so we need to convert it into deb format – for Debian/Ubuntu. For that we install alien app:

apt-get install -y alien

Step 4. Convert into deb format:

alien MegaCli-8.07.14-1.noarch.rpm

Step 5. Install MegaCli:

dpkg -i megacli_8.07.14-2_all.deb

By default, MegaCli is installed in /opt/MegaRAID/MegaCli/MegaCli64.
We can create symbolic link to e.g. /usr/bin.

ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/MegaCli

Run the command MegaCli -h. If you encounter errors e.g. missing libncurses.so.5 library you need to install libncurses5.

apt-get install libncurses5

How to upgrade the firmware on an LSI MegaRAID SAS controller under Linux

LSI MegaRaid SAS Software User Guide
Checking disks behind RAID controllers

Virtualize Windows 10 with Proxmox VE

Dependency failed for QEMU Guest Agent

How to install Smartctl Utility On CentOS

Analyzing hard disks using smartctl

Analyzing hard disks using smartctl

Install Smartmontools

apt-get install smartmontools

List all smart info for a specified disk

smartctl -a /dev/sdX

Start short/long test

smartctl -t short | long /dev/sdX

Check the results of the tests

smartctl -l selftest /dev/sdX

Testing disk using smartctl
Can I run smart command on multiple disks at the same time?

Fiber optics connectors

How to work with fiber optics
Mining PSU buying guide