02. IP address and static routing configuration

IP address

IP address classification

  • IPV4 (32-bit binary composition) — dotted decimal
  • IPV6 (128-bit binary composition) — hexadecimal

IPV4 address (32 bits)

IPV4 addresses are divided into: network bits and host bits

​ 192.168.1. 00000000 /24

​ Network bit host bitmask

  • If the network bits are the same, it means they are in the same broadcast domain; in a broadcast domain, the host bits are used to distinguish different devices.
  • Subnet mask ---- consists of consecutive 1 and consecutive 0, 1 represents the network bit, 0 represents the host bit

Classification of IPV4 addresses

A, B, C, D, E address range

  • A类: 00000000.x.x.x — 01111111.x.x.x 0.x.x.x – 127.x.x.x
  • B类: 10000000.x.x.x — 10111111.x.x.x 128.x.x.x – 191.x.x.x
  • C类: 11000000.x.x.x — 11011111.x.x.x 192.x.x.x – 223.x.x.x
  • D类: 11100000.x.x.x — 11101111.x.x.x 224.x.x.x – 239.x.x.x
  • E类: 11110111.x.x.x — 11111110.x.x.x 240.x.x.x – 254.x.x.x

Class A, B, C (unicast address) — can be used as both source IP and destination IP

Class D (multicast address) - can only be used as destination IP and not as source IP

Category E (Reserved Address) — Research

In the IP address space, some IP addresses are called private network IP addresses, and the rest are called public network IP addresses.

The characteristics of the private network IP address: can be reused, only need to ensure the uniqueness inside the private network (we generally call the network using the private network IP address communication as the private network, and the network using the public network IP address communication as the public network)

special IP address

  • 127.0.0.1 to 127.255.255.254----local loopback address

    ​ Function:

    ​ Used to detect whether the TCP/IP protocol stack can normally encapsulate and decapsulate data

    ​ Used to detect the quality of the network card

    ​ Does not exist by default in the device (Huawei exists), and exists by default on the PC after the system installation is complete (127.0.0.1)

  • 0.0.0.0/0 -- invalid address/default address (default address)

  • 255.255.255.255 — Restricted broadcast address (restricted by routers) — can only be used as a destination address

  • 169.254.xx/16 — Link-local address/automatic private address – when the PC cannot obtain an IP address automatically, the PC will automatically generate an address – 169.254.xx/16

  • 192.168.1.00000000/24 ​​— host address with all 0 bits (network address)

  • 192.168.1.11111111/24------ Address with all 1 host bits -- direct broadcast address -- can only be used as the target IP

VLSM — variable length subnet mask (subnetting)

  • By borrowing host bits as network bits, the original large broadcast domain is logically divided into several small broadcast domains
  • A longer subnet mask means longer network bits and fewer host bits

For example:

​ 192.168.1.0/24

Borrow 1 bit to divide 2 network segments

192.168.1.01111111/24+1

192.168.1.0/25

Network address 192.168.1.0/25

Broadcast address 192.168.1.127/25

Number of available addresses = 2^7-2=126

Available address range 192.168.1.1/25-192.168.1.126/25

192.168.1.128/25

Network address 192.168.1.128/25

Broadcast address 192.168.1.255/25

Number of available addresses 126

Available address range 192.168.1.129/25-192.168.1.254/25

4 network segments are divided by 2 bits

192.168.1.11000000/24+2

192.168.1.0/26

Network address 192.168.1.0/26

Broadcast address 192.168.1.63/26

Number of available addresses 62

Available address range 192.168.1.1/26-192.168.1.62/26

192.168.1.64/26

192.168.1.128/26

192.168.1.192/26

8 network segments are divided by 3 bits

192.168.1.11100000/24+3

192.168.1.0/27

192.168.1.32/27

Network address 192.168.1.32/27

Broadcast address 192.168.1.63/27

Number of available addresses 30

Available address range 192.168.1.33/27-192.168.1.62/27

192.168.1.64/27

192.168.1.96/27

192.168.1.128/27

192.168.1.160/27

192.168.1.192/27

192.168.1.224/27

CLDR — Classless Inter-Domain Routing (Summary)

​ Take the same, go different - binary

For example:

192.168.0.0/24

192.168.1.0/24

192.168.2.0/24

192.168.3.0/24

After summary

192.168.0.0/22

configuration

Direct route—the condition generated by default

1. Interface double UP

2. The interface must be configured with an IP address to obtain routing information for unknown network segments

Static routes: routes manually added directly by the network administrator

Dynamic routing: All routers run the same routing protocol, communicate and communicate with each other, and finally calculate the routing information of unknown network segments.

Basic configuration of static routing

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-W3soYHLt-1685546656882) (C:\Users\Lin\AppData\Roaming\Typora\typora-user-images\ image-20230125234030840.png)]

方法一:
	[r1]ip route-static 192.168.3.0 24 192.168.2.2 需要递归查找出接口

方法二:
	[r1]ip route-static 192.168.3.0 24 GigabitEthernet 0/0/1 需要开启代理ARP
	[r2-GigabitEthernet0/0/0]arp-proxy enable--激活代理ARP
	代理ARP
		 ARP的一种,激活代理ARP的路由器将会查看收到ARP请求包中的请求IP地		址,基于请求IP地址查看本地的路由表。如果本地路由可达,则将冒充对方回		  复ARP应答,将自己的MAC地址回复。之后,数据来到自身后将帮忙转发。
		 
方法三:
	[r1]ip route-static 192.168.3.0 24 GigabitEthernet 0/0/1 192.168.2.2不需要递归查找
	
方法四:
	[r1]ip route-static 192.168.4.0 24 192.168.3.2写下两跳,需要递归查找,必须存在可递归的路由

Extended configuration of static routing

  • Load balancing—when the router accesses the same destination with multiple paths with similar costs, it can split the traffic and pass through multiple paths at the same time to achieve the purpose of superimposing bandwidth.

  • Manual summarization—When the router can access multiple consecutive subnets, if they pass the same next hop, these network segments can be summarized, and then only the static route to the summarized network segment can be edited. In order to achieve the purpose of reducing the number of routing table entries and improving forwarding efficiency.

  • Routing black hole—In summary, if a network segment that does not actually exist in the network is included, it may cause traffic to go without return, wasting link resources.

    ​ Reasonable network segment division and summarization can reduce the occurrence of routing black holes.

  • Default Route—A route with no destination specified. When looking up the table, if all the local routes are not matched, the default route will be matched

    ​ [r1]ip route-static 0.0.0.0 0 12.0.0.2

    ​ If the default route meets a black hole, it will be 100% out of the loop.

  • Null interface route—on the blackhole router, configure a route to the summary network segment pointing to the null interface.

    1. The matching principle of the router - the longest matching principle (exact matching principle)

    ​ 2, null 0—Virtual interface—The data packets matching the route whose outbound interface is an empty interface will be discarded directly

    ​ [r1]ip route-static 192.168.0.0 22 NULL 0

  • Floating static routing—By modifying the default priority of static routing, the backup effect of static routing can be realized

    ​ [r2]ip route-static 1.1.1.0 24 21.0.0.1 preference 61

The route to the summary network segment points to the empty interface.

1. The matching principle of the router - the longest matching principle (exact matching principle)

​ 2, null 0—Virtual interface—The data packets matching the route whose outbound interface is an empty interface will be discarded directly

​ [r1]ip route-static 192.168.0.0 22 NULL 0

  • Floating static routing—By modifying the default priority of static routing, the backup effect of static routing can be realized

    ​ [r2]ip route-static 1.1.1.0 24 21.0.0.1 preference 61

Guess you like

Origin blog.csdn.net/bo1029/article/details/130979064
Recommended