≧◠ᴥ◠≦
Go to:
- IPv4 subnetting
- Windows
- Linux
- Proxmox/virtualization
- Software (other)
- Hardware (general)
- Miscellaneous
IPv4 subnetting
Go back
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. | Subnet | Broadcast address | Hosts |
---|---|---|---|
1 | 172.16.0.0 | 172.16.31.255 | 172.16.0.1 – 172.16.31.254 |
2 | 172.16.32.0 | 172.16.63.255 | 172.16.32.254 – 172.16.63.254 |
3 | 172.16.64.0 | 172.16.95.255 | 172.16.64.1 – 172.16.95.254 |
4 | 172.16.96.0 | 172.16.127.255 | 172.16.96.1 – 172.16.127.254 |
5 | 172.16.128.0 | 172.16.159.255 | 172.16.128.1 – 172.16.159.254 |
No. of hosts -> 8190
Subnet’s mask -> /19
- 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. | Subnet | Broadcast address | Hosts |
---|---|---|---|
1 | 172.16.0.0 | 172.16.63.255 | 172.16.0.1 – 172.16.63.254 |
2 | 172.16.64.0 | 172.16.127.255 | 172.16.64.1 – 172.16.127.254 |
3 | 172.16.128.0 | 172.16.191.255 | 172.16.128.1 – 172.16.191.254 |
4 | 172.16.192.0 | 172.16.255.255 | 172.16.192.1 – 172.16.255.254 |
No. of hosts -> 232-18 – 2 = 214 – 2 = 16 382
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. | Subnet | Broadcast address | Hosts |
---|---|---|---|
1 | 192.168.1.0 | 192.168.127.255 | 192.168.1.1 – 192.168.127.254 |
2 | 192.168.1.128 | x | x |
II)
Lp. | Subnet | Broadcast address | Hosts |
---|---|---|---|
1 | 192.168.1.128 | 192.168.1.191 | 192.168.1.129 – 192.168.1.190 |
2 | 192.168.1.192 | 192.168.1.255 | 192.168.1.193 – 192.168.1.254 |
3 | 192.168.1.256 | x | x |
Answer: 192.168.1.0/25; 192.168.1.128/26; 192.168.1.192/26
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. | Subnet | Broadcast address | Hosts |
---|---|---|---|
1 | 17.61.12.0 | 17.61.12.7 | 17.61.12.1 – 17.61.12.6 |
2 | 17.61.12.8 | 17.61.12.15 | 17.61.12.9 – 17.61.12.14 |
3 | 17.61.12.16 | 17.61.12.23 | 17.61.12.17 – 17.61.12.22 |
4 | 17.61.12.24 | 17.61.12.31 | 17.61.12.25 – 17.61.12.30 |
5 | 17.61.12.32 | 17.61.12.39 | 17.61.12.33 – 17.61.12.38 |
6 | 17.61.12.40 | 17.61.12.47 | 17.61.12.41 – 17.61.12.46 |
7 | 17.61.12.48 | 17.61.12.55 | 17.61.12.49 – 17.61.12.54 |
Answer:
*17.61.12.31
*17.61.12.43
*17.61.12.33
*17.61.12.15
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
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
Windows (general)
Go back
WSL (Windows Subsystem for Linux)
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
Linux (general)
Go back
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 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
LSI MegaCLI/other controller software
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
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
Proxmox/virtualization
Go back
BIOS/IPMI/ILO
Go back
Hard drives (general)
Go back
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
Patchcords (general)
Miscellaneous
Go back