H3C BGP 基本配置实验

news2024/10/22 21:17:55

H3C BGP 基本配置实验

实验拓扑

image

实验需求

  1. 按照图示配置 IP 地址,R1 和 R5 上使用环回口模拟业务网段,R2,R3,R4 的环回口用于配置 Router-id 和建立 IBGP 邻居
  2. AS 200 运行 OSPF 实现内部网络互通
  3. R1,R2,R4,R5 运行 BGP,R1 和 R2 建立 EBGP 邻居,R4 和 R5 建立 EBGP 邻居,R2 和 R4 建立 IBGP 邻居。要求 EBGP 邻居使用直连接口建立邻居,IBGP 邻居使用环回口建立邻居
  4. R1 和 R5 把业务网段宣告进 BGP
  5. 在 R2 和 R4 上把 BGP 引入到 IGP 解决 BGP 路由黑洞问题
  6. 业务网段可以互通

实验步骤

设备IP地址配置

R1 IP地址配置
[R1]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.1.1.1/24       --           --
Loop0               up       up(s)    192.168.1.1/24     --           --
R2 IP地址配置
[R2]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.1.1.2/24       --           --
GE0/1               up       up       100.2.2.2/24       --           --
Loop0               up       up(s)    2.2.2.2/32         --           --
R3 IP地址配置
[R3]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.2.2.3/24       --           --
GE0/1               up       up       100.3.3.3/24       --           --
Loop0               up       up(s)    3.3.3.3/32         --           --
R4 IP地址配置
[R4]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.3.3.4/24       --           --
GE0/1               up       up       100.4.4.4/24       --           --
Loop0               up       up(s)    4.4.4.4/32         --           --
R5 IP地址配置
[R5]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.4.4.5/24       --           --
Loop0               up       up(s)    192.168.2.1/24     --           --

AS 200运行OSPF

R2 配置OSPF
#
ospf 1 router-id 2.2.2.2
 area 0.0.0.0
  network 2.2.2.2 0.0.0.0
  network 100.2.2.2 0.0.0.0
R3 配置OSPF
#
ospf 1 router-id 3.3.3.3
 area 0.0.0.0
  network 3.3.3.3 0.0.0.0
  network 100.2.2.3 0.0.0.0
  network 100.3.3.3 0.0.0.0
R4 配置OSPF
#
ospf 1 router-id 4.4.4.4
 area 0.0.0.0
  network 4.4.4.4 0.0.0.0
  network 100.3.3.4 0.0.0.0

BGP邻居建立

R1 和 R2 建立 EBGP 邻居
R1配置BGP与R2建立EBGP邻居
[R1]bgp 100  
[R1-bgp-default]peer 100.1.1.2 as-number 200
[R1-bgp-default]address-family ipv4 unicast 
[R1-bgp-default-ipv4]peer 100.1.1.2 enable
R2配置BGP与R1建立EBGP邻居
[R1]bgp 200  
[R1-bgp-default]peer 100.1.1.1 as-number 100
[R1-bgp-default]address-family ipv4 unicast 
[R1-bgp-default-ipv4]peer 100.1.1.1 enable
R2 和 R4 建立 IBGP 邻居

IBGP 邻居要求使用环回口建立,根据 BGP 邻居建立条件,需要修改 IBGP 邻居更新源为对应环回口

R2配置BGP与R4建立IBGP邻居
[R1]bgp 200  
[R1-bgp-default]peer 4.4.4.4 as-number 200
[R1-bgp-default]peer 4.4.4.4 connect-interface LoopBack0
[R1-bgp-default]address-family ipv4 unicast
[R1-bgp-default-ipv4]peer 4.4.4.4 enable
R4配置BGP与R2建立IBGP邻居
[R1]bgp 200  
[R1-bgp-default]peer 2.2.2.2 as-number 200
[R1-bgp-default]peer 2.2.2.2 connect-interface LoopBack0
[R1-bgp-default]address-family ipv4 unicast
[R1-bgp-default-ipv4]peer 2.2.2.2 enable
R4 和 R5 建立 EBGP 邻居
R4配置BGP与R5建立EBGP邻居
[R1]bgp 200  
[R1-bgp-default]peer 100.4.4.5 as-number 300
[R1-bgp-default]address-family ipv4 unicast 
[R1-bgp-default-ipv4]peer 100.4.4.5 enable
R5配置BGP与R4建立EBGP邻居
[R1]bgp 300  
[R1-bgp-default]peer 100.4.4.4 as-number 200
[R1-bgp-default]address-family ipv4 unicast 
[R1-bgp-default-ipv4]peer 100.4.4.4 enable

业务网段宣告进 BGP

在R1上将业务网段宣告进 BGP
[R1-bgp-default-ipv4]network 192.168.1.0 255.255.255.0
在R5上将业务网段宣告进 BGP
[R5-bgp-default-ipv4]network 192.168.2.0 255.255.255.0
修改 IBGP 邻居下一跳为本机

由于 R2 和 R4 既有 EBGP 邻居,又有 IBGP 邻居,为了使从 EBGP 邻居学习的路由传递至 IBGP 邻居时下一跳可达,需要修改 IBGP 邻居下一跳为本机

R2修改 IBGP 邻居下一跳为本机
[R2-bgp-default-ipv4]peer 4.4.4.4 next-hop-local
R4修改 IBGP 邻居下一跳为本机
[R2-bgp-default-ipv4]peer 2.2.2.2 next-hop-local

解决 BGP 路由黑洞问题

​由于 R3 没有运行 BGP ,无法学习到业务网段路由,然而业务网段之间通讯的数据包会经过 R3 转发,所以造成 R3 上存在 BGP 路由黑洞

这里通过把 BGP 引入到 OSPF,使 R3 可以通过 OSPF 学习到业务网段的路由,来解决 BGP 路由黑洞问题

R2 BGP 引入到 OSPF
#
ospf 1 router-id 2.2.2.2
 import-route bgp
R4 BGP 引入到 OSPF
#
ospf 1 router-id 4.4.4.4
 import-route bgp

实验验证

业务网段是否可通

由于 BGP 只传递了业务网段路由,所以必须使用带源 PING,才能测试是否连通

[R1]ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out

--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[R1]%Mar  7 19:51:13:638 2024 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

[R1]ping -a 192.168.1.1 192.168.2.1
Ping 192.168.2.1 (192.168.2.1) from 192.168.1.1: 56 data bytes, press CTRL+C to break
56 bytes from 192.168.2.1: icmp_seq=0 ttl=252 time=2.505 ms
56 bytes from 192.168.2.1: icmp_seq=1 ttl=252 time=2.529 ms
56 bytes from 192.168.2.1: icmp_seq=2 ttl=252 time=2.519 ms
56 bytes from 192.168.2.1: icmp_seq=3 ttl=252 time=2.592 ms
56 bytes from 192.168.2.1: icmp_seq=4 ttl=252 time=1.770 ms

--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.770/2.383/2.592/0.308 ms
[R1]%Mar  7 19:51:24:599 2024 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.770/2.383/2.592/0.308 ms.

拓展验证

BGP 引入到 OSPF前后对比情况
引入前
删除引入配置
[R2]ospf
[R2-ospf-1]undo import-route bgp 

[R4]ospf
[R4-ospf-1]undo import-route bgp
查询路由表
[R2]display ip routing-table 

Destinations : 19	Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0
3.3.3.3/32         O_INTRA 10  1           100.2.2.3       GE0/1
4.4.4.4/32         O_INTRA 10  2           100.2.2.3       GE0/1
100.1.1.0/24       Direct  0   0           100.1.1.2       GE0/0
100.1.1.2/32       Direct  0   0           127.0.0.1       InLoop0
100.1.1.255/32     Direct  0   0           100.1.1.2       GE0/0
100.2.2.0/24       Direct  0   0           100.2.2.2       GE0/1
100.2.2.2/32       Direct  0   0           127.0.0.1       InLoop0
100.2.2.255/32     Direct  0   0           100.2.2.2       GE0/1
100.3.3.0/24       O_INTRA 10  2           100.2.2.3       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     BGP     255 0           100.1.1.1       GE0/0
192.168.2.0/24     BGP     255 0           4.4.4.4         GE0/1
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[R3]display ip routing-table 

Destinations : 16	Routes : 16

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         O_INTRA 10  1           100.2.2.2       GE0/0
3.3.3.3/32         Direct  0   0           127.0.0.1       InLoop0
4.4.4.4/32         O_INTRA 10  1           100.3.3.4       GE0/1
100.2.2.0/24       Direct  0   0           100.2.2.3       GE0/0
100.2.2.3/32       Direct  0   0           127.0.0.1       InLoop0
100.2.2.255/32     Direct  0   0           100.2.2.3       GE0/0
100.3.3.0/24       Direct  0   0           100.3.3.3       GE0/1
100.3.3.3/32       Direct  0   0           127.0.0.1       InLoop0
100.3.3.255/32     Direct  0   0           100.3.3.3       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[R4]display ip routing-table 

Destinations : 19	Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         O_INTRA 10  2           100.3.3.3       GE0/0
3.3.3.3/32         O_INTRA 10  1           100.3.3.3       GE0/0
4.4.4.4/32         Direct  0   0           127.0.0.1       InLoop0
100.2.2.0/24       O_INTRA 10  2           100.3.3.3       GE0/0
100.3.3.0/24       Direct  0   0           100.3.3.4       GE0/0
100.3.3.4/32       Direct  0   0           127.0.0.1       InLoop0
100.3.3.255/32     Direct  0   0           100.3.3.4       GE0/0
100.4.4.0/24       Direct  0   0           100.4.4.4       GE0/1
100.4.4.4/32       Direct  0   0           127.0.0.1       InLoop0
100.4.4.255/32     Direct  0   0           100.4.4.4       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     BGP     255 0           2.2.2.2         GE0/0
192.168.2.0/24     BGP     255 0           100.4.4.5       GE0/1
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

以上可以看到,在R3上没有去往业务网段的路由,所以目前是业务网段之间访问是不通的。

引入后
[R2]display ip routing-table 

Destinations : 19	Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0
3.3.3.3/32         O_INTRA 10  1           100.2.2.3       GE0/1
4.4.4.4/32         O_INTRA 10  2           100.2.2.3       GE0/1
100.1.1.0/24       Direct  0   0           100.1.1.2       GE0/0
100.1.1.2/32       Direct  0   0           127.0.0.1       InLoop0
100.1.1.255/32     Direct  0   0           100.1.1.2       GE0/0
100.2.2.0/24       Direct  0   0           100.2.2.2       GE0/1
100.2.2.2/32       Direct  0   0           127.0.0.1       InLoop0
100.2.2.255/32     Direct  0   0           100.2.2.2       GE0/1
100.3.3.0/24       O_INTRA 10  2           100.2.2.3       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     BGP     255 0           100.1.1.1       GE0/0
192.168.2.0/24     O_ASE2  150 1           100.2.2.3       GE0/1
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[R3]display ip routing-table 

Destinations : 18	Routes : 18

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         O_INTRA 10  1           100.2.2.2       GE0/0
3.3.3.3/32         Direct  0   0           127.0.0.1       InLoop0
4.4.4.4/32         O_INTRA 10  1           100.3.3.4       GE0/1
100.2.2.0/24       Direct  0   0           100.2.2.3       GE0/0
100.2.2.3/32       Direct  0   0           127.0.0.1       InLoop0
100.2.2.255/32     Direct  0   0           100.2.2.3       GE0/0
100.3.3.0/24       Direct  0   0           100.3.3.3       GE0/1
100.3.3.3/32       Direct  0   0           127.0.0.1       InLoop0
100.3.3.255/32     Direct  0   0           100.3.3.3       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     O_ASE2  150 1           100.2.2.2       GE0/0
192.168.2.0/24     O_ASE2  150 1           100.3.3.4       GE0/1
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
[R4]display ip routing-table 

Destinations : 19	Routes : 19

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
2.2.2.2/32         O_INTRA 10  2           100.3.3.3       GE0/0
3.3.3.3/32         O_INTRA 10  1           100.3.3.3       GE0/0
4.4.4.4/32         Direct  0   0           127.0.0.1       InLoop0
100.2.2.0/24       O_INTRA 10  2           100.3.3.3       GE0/0
100.3.3.0/24       Direct  0   0           100.3.3.4       GE0/0
100.3.3.4/32       Direct  0   0           127.0.0.1       InLoop0
100.3.3.255/32     Direct  0   0           100.3.3.4       GE0/0
100.4.4.0/24       Direct  0   0           100.4.4.4       GE0/1
100.4.4.4/32       Direct  0   0           127.0.0.1       InLoop0
100.4.4.255/32     Direct  0   0           100.4.4.4       GE0/1
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     O_ASE2  150 1           100.3.3.3       GE0/0
192.168.2.0/24     BGP     255 0           100.4.4.5       GE0/1
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLo

以上可以看到,通过把 BGP 引入到 OSPF,使 R3 可以通过 OSPF 学习到业务网段的路由,以此解决了 BGP 路由黑洞的问题

IBGP邻居设置下一跳为本机前后BGP路由表情况
设置前
删除配置
[R2-bgp-default-ipv4]undo peer 4.4.4.4 next-hop-local

[R4-bgp-default-ipv4]undo peer 2.2.2.2 next-hop-local 
查询BGP路由表
[R1]display bgp routing-table ipv4

 Total number of routes: 1

 BGP local router ID is 192.168.1.1 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >  192.168.1.0        192.168.1.1     0                     32768   i
[R2]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 2.2.2.2 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >e 192.168.1.0        100.1.1.1       0                     0       100i
   i 192.168.2.0        100.4.4.5       0          100        0       300i
[R4]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 4.4.4.4 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

   i 192.168.1.0        100.1.1.1       0          100        0       100i
* >e 192.168.2.0        100.4.4.5       0                     0       300i
[R5]display bgp routing-table ipv4

 Total number of routes: 1

 BGP local router ID is 192.168.2.1 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >  192.168.2.0        192.168.2.1     0                     32768   i

以上可以看到,R2把从EBGP邻居得到的路由信息发给它的IBGP邻居时,并不改变该路由信息的下一跳属性,且由于 R2 和 R4 既有 EBGP 邻居,又有 IBGP 邻居,所以为了使从 EBGP 邻居学习的路由传递至 IBGP 邻居时下一跳可达,需要修改 IBGP 邻居下一跳为本机

设置后
[R1]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 192.168.1.1 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >  192.168.1.0        192.168.1.1     0                     32768   i
* >e 192.168.2.0        100.1.1.2                             0       200 300i
[R2]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 2.2.2.2 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >e 192.168.1.0        100.1.1.1       0                     0       100i
* >i 192.168.2.0        4.4.4.4         0          100        0       300i
[R4]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 4.4.4.4 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >i 192.168.1.0        2.2.2.2         0          100        0       100i
* >e 192.168.2.0        100.4.4.5       0                     0       300i
[R5]display bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 192.168.2.1 
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >e 192.168.1.0        100.4.4.4                             0       200 100i
* >  192.168.2.0        192.168.2.1     0                     32768   i

实验附件

H3C BGP基本配置实验.7z

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1498543.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python 中实现 CDF 累积分布图的两种方法

什么是累积分布 累积分布函数,又叫分布函数,是概率密度函数的积分,能完整描述一个实随机变量X的概率分布。一般以大写“CDF”(Cumulative Distribution Function)标记。 《百度百科》 累积分布函数,又叫分…

LeetCode 刷题 [C++] 第300题.最长递增子序列

题目描述 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列 是由数组派生而来的序列,删除(或不删除)数组中的元素而不改变其余元素的顺序。例如,[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子序列。 题目…

【Linux】Linux原生异步IO(一):libaio-介绍

1、IO模型 1.1 简述 相信大家在搜索的时候,都会看到下面这张图,IO的使用场景:同步、异步、阻塞、非阻塞,可以组合成四种情况: 同步阻塞I/O: 用户进程进行I/O操作,一直阻塞到I/O操作完成为止。同步非阻塞I/O: 用户程序可以通过设置文件描述符的属性O_NONBLOCK,I/O操作可…

什么样的项目适合Web自动化测试

🔥 交流讨论:欢迎加入我们一起学习! 🔥 资源分享:耗时200小时精选的「软件测试」资料包 🔥 教程推荐:火遍全网的《软件测试》教程 📢欢迎点赞 👍 收藏 ⭐留言 &#x1…

共用体union

一、共用体的特性 共用体又叫做联合体,共用体的特性如下: 1.共用体的所有成员共用一段内存空间,且所有成员的起始位置是一致的 2.共用体的值由最后赋值的成员决定 3.共用体的内存大小 共用体的内存必须大于或等于其他成员变量中最大数据类型…

专题1 - 双指针 - leetcode 15. 三数之和 - 中等难度

leetcode 15. 三数之和 - 点击直达 leetcode 15. 三数之和 中等难度 双指针1. 题目详情1. 原题链接2. 基础框架 2. 解题思路1. 题目分析2. 算法原理3. 时间复杂度 3. 代码实现4. 知识与收获 leetcode 15. 三数之和 中等难度 双指针 1. 题目详情 给你一个整数数组 nums &#…

SQL 替换某一列中所有数据的特定字符

UPDATE product SET spec REPLACE(spec, ,, ) 把product表的spec字段内容中的逗号替换为

性能问题分析排查思路之机器(3)

本文是性能问题分析排查思路的展开内容之一,第2篇,主要分为日志1期,机器4期、环境2期共7篇系列文章,本期是第三篇,讲机器(硬件)的网络方面的排查方法和最佳实践。 主要内容如图所示&#xff1a…

Java请求时间耗时长分析

推断是java.lang.OutOfMemoryError: Metaspace,元空间不够,频繁垃圾收集 这个过程中程序卡住一直不响应,应该是触发FGC有关系。 YGC:451->453 FGC:198->289 FGCT:52.246->76.291 但是堆内存的空间…

简易网络聊天室:2024/3/7

思维导图 基于UDP的简易网络聊天室 服务器&#xff1a; #include <myhead.h>#define SER_PORT 8888struct msgTyp //存储消息的结构体 {char type; //消息类型char name[30]; //用户姓名char text[1024]; //消息正文 };//创建链表存储客户端信息 typedef stru…

【计算机考研】考408,还是不考408性价比高?

首先综合考虑&#xff0c;如果其他科目并不是很优秀&#xff0c;需要我们花一定的时间去复习&#xff0c;408的性价比就不高&#xff0c;各个科目的时间互相挤压&#xff0c;如果备考时间不充裕&#xff0c;考虑其他专业课也未尝不可。 复习408本来就是费力不讨好的事情 不同…

SAP MM学习笔记44 - 特殊调达流程 - Blanket购买发注(汇总采购)

上一章学习了 支付计划&#xff0c;本章继续学习 Blanket购买发注&#xff08;汇总采购&#xff09;。 SAP MM学习笔记43 - 特殊调达流程 - 支付计划-CSDN博客 1&#xff0c;Blanket购买发注 概要 其实就是订好一个大致数额&#xff0c;然后让随便买&#xff0c;只要不超这个…

网络调试助手使用MQTT协议与Mosquitto通信(3)

一、连接报文 一开始设备需要连接到mqtt服务器&#xff0c;连接时的数据包内需要携带对应的设备ID&#xff0c;以及用户名和密码。这使用默认的用户名和密码。设备ID每一个设备都需要设置为不同的&#xff0c;两个相同的ID只能允许一台设备在线&#xff0c;另一个相同的ID的设备…

2024年最新阿里云服务器地域选择方法,以及可用区说明

阿里云服务器地域和可用区怎么选择&#xff1f;地域是指云服务器所在物理数据中心的位置&#xff0c;地域选择就近选择&#xff0c;访客距离地域所在城市越近网络延迟越低&#xff0c;速度就越快&#xff1b;可用区是指同一个地域下&#xff0c;网络和电力相互独立的区域&#…

实操keepalived(高可用)+Nginx(四层代理+七层代理),实现高可用、负载均衡以及动静分离

一 vrrp技术 VRRP 相关术语 VRRP能够在不改变组网的情况下&#xff0c;将多台路由器虚拟成一个虚拟路由器&#xff0c;i通过配置虚拟路由器的IP地址为默认网关&#xff0c;实现网关的备份。 协议版本: VRRPv2 (常用) 和VRRPv3:0 VRRPv2仅适用于IPv4网络&#xff0c;VRRPv3适用…

好物周刊#46:在线工具箱

https://github.com/cunyu1943 村雨遥的好物周刊&#xff0c;记录每周看到的有价值的信息&#xff0c;主要针对计算机领域&#xff0c;每周五发布。 一、项目 1. twelvet 一款基于 Spring Cloud Alibaba 的权限管理系统&#xff0c;集成市面上流行库&#xff0c;可以作用为快…

数字孪生10个技术栈:数据采集的八种方式

大家好&#xff0c;我是贝格前端工场&#xff0c;上期讲了数字孪生10个技术栈&#xff08;总括&#xff09;:概念扫盲和总体介绍&#xff0c;获得了大家的热捧&#xff0c;本期继续分享技术栈&#xff0c;大家如有数字孪生或者数据可视化的需求&#xff0c;可以联络我们。 一、…

文件包含漏洞初识

一、基础知识介绍 在web后台开发的时候&#xff0c;我们会使用PHP&#xff0c;Java这种代码&#xff0c;而在使用的过程中&#xff0c;我们经常会使用包含函数&#xff08;也就是调用&#xff09;&#xff0c;而很多时候&#xff0c;前端用户在选择浏览时会调用包含的文件这无…

LangChain自定义工具Tool

LangChain部署 pip install langchain自定义工具 from langchain_openai import ChatOpenAI from langchain.memory import ConversationBufferMemory from langchain.agents.conversational_chat.base import ConversationalChatAgent from langchain.agents import AgentEx…

常见四种限流算法详解(附:javaDemo)

限流简介 现代互联网很多业务场景&#xff0c;比如秒杀、下单、查询商品详情&#xff0c;最大特点就是高并发&#xff0c;而往往我们的系统不能承受这么大的流量&#xff0c;继而产生了很多的应对措施&#xff1a;CDN、消息队列、多级缓存、异地多活。 但是无论如何优化&…