Get the IP address in one article

IP Addressing Series Articles (Part 1)


Table of contents

First, what is an IP address?

Second, the representation of the IP address

Question: Can computers recognize binary? decimal? hexadecimal?

Third, how to convert binary to decimal?

3.1, Quickly perform IP address conversion

Four, IP address composition

4.1, network part

Example:

4.2, the host part

4.3, subnet mask

Five, IP addressing

Six, IP address classification

7. Special reserved IP address

Example: 10.1.1.1/24

Example: 10.1.1.0/23

Example: 10.1.1.0/31

7,1.IP address formula

8. Public IP address

9. Private network IP address

9.1, private network IP address segment:

10. Special IP address

 10,1. Loopback address

10.2, link-local address

Eleven, IPv4 vs IPv6

Summarize


foreword

With the continuous development of Huawei, the technology of data communication is becoming more and more important. Many people have started learning data communication. This article introduces the IP address, which is the ninth stop we pass through the Datacom Kingdom (we Huawei's ENSP software is used).


First, what is an IP address?

An IP address is used only at the network layer to identify a node (or interface on a network device). The network identifies unique nodes for easy packet forwarding.
IP addresses are used for addressing IP packets in the network layer.
An IP address is like an address in reality, it can identify a node in the network through which data finds its destination. Similar to our ID number.

Second, the representation of the IP address

The way our ipv4 address is represented

IPv4 format: dotted decimal, such as 192.168.1.1 This format has a total of 32bits equal to 4 bytes

bit: Occupy a position, unit.
Byte Byte, 1Byte=8bit
Binary: 0 or 1
The minimum IP address is all 0: 0.0.0.0
The maximum IP address is all 1: 11111111.11111111. 11111111.1111111 is converted into decimal 255.255.255.255
IPv4 address range: 0.0.0.0~255.255.255.255 .

Question: Can computers recognize binary? decimal? hexadecimal?

Answer: The computer recognizes binary, but it is very inconvenient for humans to read and write. Need to convert binary to decimal.

Third, how to convert binary to decimal?

1
1
1
1
1
1
1
1
128
64
32
16
8
4
2
2^(n-1)=1

Formula: 2^(n-1) where n stands for (the number from the right to the left)

1st digit from right to left: 2^(1-1)=1

2nd digit from right to left: 2^(2-1)=2

3rd digit from right to left: 2^(3-1)=4

4th digit from right to left: 2^(4-1)=8

5th digit from right to left: 2^(5-1)=16

6th digit from right to left: 2^(6-1)=32

7th digit from right to left: 2^(7-1)=64

8th digit from right to left: 2^(8-1)=128

The largest IP address is 255.255.255.255

192.168.1.1/24 becomes the binary representation:

1100 0000.1010 1000.0000 0001.0000 0001/24

3.1, Quickly perform IP address conversion

binary
1
1
1
1
1
1
1
1
decimal
128
64
32
16
8
4
2
1

An existing IP address is as follows, please quickly replace it with decimal notation:

1110 1001.1010 1101.1001.0001.1110.1001/24

The calculation process of the first byte is as follows:

1110 1001.

128+64+32+0+8+0+0+1=233

Other bytes are calculated similarly:

The calculation process of the second byte 1010 1101:

Assuming that the first four bits are all 1, it is equal to 128+64+32+16=(128+32)+(64+16)=160+80=240

Now the situation is 1010 less 64 and 16, 240-80=160

Assuming that the next four bits are all 1, it is equal to 8+4+2+1=(8+2)+(4+1)=10+5 =15

Now the situation is 1101 less 2, 15-2=13

So 160+13=173

The third byte 1001.0001

128+16+1=145

Fourth byte 1110.1001

240-16=224 224+9=233

The result is: 233.173.145.233/24 /24 255.255.255.0

Four, IP address composition

4.1, network part

Network part: Used to identify a network. There will be many nodes (hosts) in the network whose network numbers represent a range, so the network range cannot be configured on a specific interface.

Example:

10.1.12.1/24 This is a specific IP address that represents a single node. Similar to a specific classmate in a classroom.

10.1.12.1/24 is a specific node, so which network does it belong to? 10.1.12.0/24

And 10.1.12.0/24 is a network segment, which is a network range. Let's demonstrate how to configure the network segment in ensp.

Device Configuration:
[AR1-GigabitEthernet0/0/0]ip address 10.1.12.0 24
Error: The specified IP address is invalid.
If the network segment is configured, the router will report an error

4.2, the host part

Host part: used to distinguish different hosts within a network.

What is the essential meaning of the concepts of network number and host bit?

The network number is the classroom, and the host is the possible students in the classroom.

4.3, subnet mask

Question: 10.1.12.1 How do I know the network number and host bits? mask!

Mask function: It is used to clearly tell you where the network number and host bits are separated!

Natural mask:

/8 Class A address 255.0.0.0

/16 Class B address 255.255.0.0

/24 Class C address 255.255.255.0

Mask features: from left to right, it is continuous 0 or 1,

explain:

Host address: 192.168.1.1/32, an IP configured on the loopback port, it cannot be matched with other places, and there will be problems when it is connected with the Internet, so it can only be used as the most edge node.

Five, IP addressing

When addressing the IP address, first determine whether it is the same network

First compare the network numbers of the two parties:

  1. The same network number means that we are in the same range, such as the same community or the same class;

  2. The network numbers are different, indicating that we are not in the same range, such as different communities or different classes;

Six, IP address classification

Class A, Class B, and Class C are the unicast addresses we are using, one-to-one

Class D is a multicast address, a pair of specific

Class E for research

explain:

The first bit of a class A address is fixed at 0,

The first two bits of the class B address are fixed at 10.

The first three bits of the class C address are fixed at 110

IP address range:

Type A: 8 bits, 0.0.0.0~127.255.255.255/8

Type B: 16 bits, 128.0.0.0~191.255.255.255/16

Type C: 24 bits, 192.0.0.0~191.223.255.255/24

7. Special reserved IP address

We usually call the network range defined by a network number a network segment.

Network number: range, cannot be directly configured on an interface; the host bits are all 0, and the network address is obtained

Broadcast Address: A special address used to send data to all hosts on the network. The host bits are all 1, and the broadcast address is obtained

Example: 10.1.1.1/24

10.1.1.1/24 specific available IP address

Network number: 10.1.1.0/24

Broadcast address: 10.1.1.255/24

Configure the network number and broadcast address on the device

[AR1-GigabitEthernet0/0/0]ip address 10.1.1.0 24

Error: The specified IP address is invalid. If an error is reported, it proves that it is not an available address

[AR1-GigabitEthernet0/0/0]ip address 10.1.1.255 24

Error: The specified IP address is invalid. If an error is reported, it proves that it is not an available address

 Example: 10.1.1.0/23

Subnet mask: 10.1.0000 0001.0000 0000/23

The red one is the network number, and the black one is the host bit.

The host bits are all 0, and the network number is obtained:

Network number: 10.1.0000 0000.0000 0000/23 10.1.0.0/23

[AR1-GigabitEthernet0/0/0]ip address 10.1.0.0 23

Error: The specified IP address is invalid. If an error is reported, it proves that it is not an available address

The host bits are all 1, and the broadcast address is obtained

Network number: 10.1.0000 0001.1111 1111/23 10.1.1.255/23

[AR1-GigabitEthernet0/0/0]ip address 10.1.1.255 23

Error: The specified IP address is invalid. If an error is reported, it proves that it is not an available address

  Example: 10.1.1.0/31

10.1.0000 0001.0000 0000/31

Network number: 10.1.0000 0001.0000 0000/31 10.1.1.0/31

Broadcast address: 10.1.0000 0001.0000 0001/23 10.1.1.1/31

No IP address available~

7,1.IP address formula

2^n-2 where n is the number of host bits.

10.1.1.0/30

10.1.1.0000 0000/30

Network number: 10.1.1.0/30

Broadcast address: 10.1.1.3/30

Available address range: 10.1.1.1/30 10.1.1.2/30

There are 2 bits in the host bit, so there are several possibilities

00 network number

01 Available IP address

10 available IP addresses

11 broadcast address

2^n-2

192.168.1.0/24 Is there any available IP address?

2^8-2=256-2=254

8. Public IP address

IP addresses are uniformly assigned by IANA to ensure the uniqueness of any IP address on the Internet . The IP address here refers to the public network IP address.
It can be directly transmitted on the Internet without NAT conversion, but it is limited and not everyone can use it. There are too many terminals, and they need to be de-identified before they can be transmitted online.

9. Private network IP address

In fact, some networks do not need to be connected to the Internet, such as the network in a closed laboratory of a university, as long as the IP addresses of network devices in the same network do not conflict. In the IP address space, some addresses are reserved in each of the three types of addresses A, B, and C, which are called private network IP addresses.

9.1, private network IP address segment:

Class A: 10.0.0.0~10.255.255.255

Class B: 172.16.0.0~172.31.255.255 #Not all private network IP addresses starting with 172, it depends on the range!

Class C: 192.168.0.0~192.168.255.255

10. Special IP address

In the IP address space, there are some special IP addresses, which have special meanings and functions, as follows.

 10,1. Loopback address

When we test whether there is any problem with the computer network card, we can check the built-in loopback port on the windows system.

Command: ping 127.0.0.1

We configure the loopback port on the router

Configuration command:

[AR1]interface LoopBack 1

[AR1-LoopBack1]ip address 1.1.1.1 32

[AR1]display ip interface brief

Execution graph

 Look at the picture to explain:

1.1.1.1/32, physical (physical) and protocol (protocol) are both up, very stable, generally used when various protocols are used to build neighbors.

10.2, link-local address

When our computer cannot obtain an ip address through DHCP, it will obtain 169.254.0.0/24, and this is also displayed when the network is disconnected.

Eleven, IPv4 vs IPv6

The IPv4 addresses managed by the global IP address assignment agency, IANA (Internet Assigned Numbers Authority) , were completely exhausted in 2011 . With the allocation of the last IPv4 public network address and the increasing number of users and devices accessing the public network, the problem of IPv4 address exhaustion is becoming more and more serious. This is the biggest source of power for IPv6 to replace IPv4 .
Compared
IPv4
Address length: 32 bits
Address classification: unicast address, broadcast address, multicast address
Features: Exhaustion of addresses, unreasonable header design and dependence on ARP, resulting in flooding of broadcasts...
IPv6
Address length: 128 bits
Address classification: unicast address, broadcast address, anycast address
Features: Unlimited addresses, simplified packet headers, automatic deployment of IPv6 addresses...

Summarize

Congratulations, you have learned the IP address through this chapter, Huawei Datacom still has many treasures waiting for you to explore, come on! Just to become a better version of myself.

Guess you like

Origin blog.csdn.net/weixin_73466540/article/details/131934302