kubernetes网络(二)之bird实现节点间BGP互联的实验
摘要
上一篇文章中我们学习了calico的原理,kubernetes中的node节点,利用 calico 的 bird 程序相互学习路由,为了加深对 bird 程序的认识,本文我们将使用bird进行实验,实验中实现了BGP FULL MESH模式让宿主相互学习到对方的容器网段,从而达到容器网段能相互通信的目的。
bird 实验
bird简介
-
BIRD 实际上是 BIRD Internet Routing Daemon 的缩写,是一款可运行在 Linux 和其他类 Unix 系统上的路由软件,它实现了多种路由协议,比如 BGP、OSPF、RIP 等。
-
BIRD 会在内存中维护许多路由表,路由表根据不同的协议,通过与各种“其他事物”交换路由信息,来更新路由规则。这里说的“其他事物”可能是其他的路由表,也可能是外部的路由器,还可以是内核的某些 API。
-
基本概念
路由表
路由表(Routing tables)是 BIRD 的核心,一个路由表是内存中一组路由规则的集合,BIRD 根据网络类型的不同会有多种路由表。默认情况下,BIRD 有master默认的路由表。除此外,你也可以创建其他的路由表。
协议与通道
协议(Protocols)将路由表和“其他事物”连接起来。“其他事物”可以是一个 Socket 对象,连接了外部的路由器,例如 BGP 路由协议;也可以是修改 FIB 的内核 API,例如kernel协议;也可以是空,比如静态路由static协议。一个协议可以实例化为多个对象,例如创建多个 BGP 协议的实例,以表示多个 BGP 邻居。协议也会提供一些路由属性,根据协议的不同路由属性也不同,比如使用 BGP 协议时,会有bgp_path属性。
本文的目标不是介绍bird的基础概念,重点在于bgp的实操,如果需要详细了解相关概念可以查阅文档:https://soha.moe/post/bird-bgp-kickstart.html
目标
- 学习bird程序的安装方法
- 学习bird.conf配置文件的语法
- 学习使用bird实现三台宿主bgp full mesh 模式
- 三台宿主的各个容器网段能相互通信
实验环境
| 系统版本 | bird版本 | 宿主IP | 容器网段 |
|---|---|---|---|
| ubuntu16.04 | BIRD 1.5.0 | 10.226.11.27 | 192.168.227.0/24 |
| ubuntu16.04 | BIRD 1.5.0 | 10.226.11.22 | 192.168.222.0/24 |
| ubuntu16.04 | BIRD 1.5.0 | 10.226.11.21 | 192.168.221.0/24 |
实验拓扑
三台宿主在同一网段内,每个宿主各自下挂一个容器网段,下面实现三台服务器两两相互建立bgp peer,相互学习路由,最终目的是实现各个容器网段能相互通信。
创建模拟的容器网段

我们知道容器是通过linux 的 namespace 机制实现的一个隔离空间, 这里我们同样借助 namespace 机制 实现一个隔离空间,并为隔离出的命名空间配置网络,模拟一个宿主"挂了"一个容器网段。
- 宿主10.226.11.22上创建模拟容器网段
# 创建命名空间 netns1
ip netns add netns1
# 创建 veth peer
ip link add veth1 type veth peer name veth2
# 将 veth1 放入 netns1
ip link set veth1 netns netns1
# 查看 veth
ip link show | grep veth
# 为 netns1 中的
ip netns exec netns1 ifconfig veth1 192.168.222.102/24 up
# 为 netns1 指定默认网关,网关是宿主1的网络协议栈
ip netns exec netns1 route add -net 0.0.0.0/0 gw 192.168.222.101
# 为宿主中的 veth2 配置IP地址,这样就实现了宿主与netns1 通过 veth2 与 veth1 的互联
ifconfig veth2 192.168.222.101/24 up
- 宿主10.226.11.21上创建模拟容器网段
ip netns add netns1
ip link add veth1 type veth peer name veth2
ip link set veth1 netns netns1
ip link show | grep veth
ip netns exec netns1 ifconfig veth1 192.168.221.102/24 up
ip netns exec netns1 route add -net 0.0.0.0/0 gw 192.168.221.101
ifconfig veth2 192.168.221.101/24 up
- 宿主10.226.11.27上创建模拟容器网段
ip netns add netns1
ip link add veth1 type veth peer name veth2
ip link set veth1 netns netns1
ip link show | grep veth
ip netns exec netns1 ifconfig veth1 192.168.227.102/24 up
ip netns exec netns1 route add -net 0.0.0.0/0 gw 192.168.227.101
ifconfig veth2 192.168.227.101/24 up
bird的安装
- bird程序的安装
apt-get update
apt-get install bird
/etc/init.d/bird start
- 检查是否安装成功
/etc/init.d/bird status
birdc show status
输出如下显示表示安装正常
root@10_226_11_21:/etc/bird# birdc show status
BIRD 1.5.0 ready.
BIRD 1.5.0
Router ID is 10.226.11.21
Current server time is 2024-09-23 15:03:28
Last reboot on 2024-09-22 20:22:36
Last reconfiguration on 2024-09-23 13:01:00
Daemon is up and running
bgp full-mesh模式的实现
宿主10.226.11.27上的/etc/bird/bird.conf配置
# This is a minimal configuration file, which allows the bird daemon to start
# but will not cause anything else to happen.
#
# Please refer to the documentation in the bird-doc package or BIRD User's
# Guide on http://bird.network.cz/ for more information on configuring BIRD and
# adding routing protocols.#log syslog all;
log "/var/log/bird.log" all;
# Change this into your BIRD router ID. It's a world-wide unique identification
# of your router, usually one of router's IPv4 addresses.
router id 10.226.11.27;filter export_filter_v4 {if net ~ [ 192.168.227.0/24 ] then accept; # 如果为默认路由则拒绝reject;#accept; # 接收所有其他路由
}
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD's
# routing tables with the OS kernel.
protocol kernel {debug { states };scan time 10;learn;persist;import none; # kernel to bird mapexport all; # Actually insert routes into the kernel routing table
}# The Device protocol is not a real routing protocol. It doesn't generate any
# routes and it only serves as a module for getting information about network
# interfaces from the kernel.
protocol direct {interface "veth2";
}
protocol device {
}# 与10.226.11.21建立bgp peer的配置
protocol bgp peer_10_226_11_21 {debug { states };local as 64512;neighbor 10.226.11.21 as 64512;source address 10.226.11.27;#multihop;password "passwd";direct;export filter export_filter_v4; # 使用过滤表 export_filter_v4 控制哪些路由可以发布给bgp peerimport all; # 从 direct, device, static, kernel 等所有protocol的路由都导入bird 的 bgp 路由
}# 与10.226.11.22建立bgp peer的配置
protocol bgp peer_10_226_11_22 {debug { states };# 配置 BGP 的 graceful restart# 如果对端因为网络抖动或暂时崩溃而暂时下线,会导致所有传入路由瞬间消失# 为了避免这种情况下数据转发中断,才有 graceful restart# 建议打开graceful restart on;# 指定自己的 ASN 为 65550local as 64512;# 指定对端的 ASN 为 64512,IP 为 10.226.11.22# 如果 ASN 和 local as 相同,那么 BIRD 会自动认为这是一个 iBGP,否则是 eBGP# i 表示 internal(内部),e 表示 external(外部)neighbor 10.226.11.22 as 64512;# source: 定义本地地址作为BGP会话的源地址。Default:邻居所连接接口的本端地址。source address 10.226.11.27;#multihop;# password: 如果和对端约定了密码,在这里配置约定好的密码,否则不用写password "passwd";# direct: eBGP 默认启用可以不写# direct: iBGP 如果是直接连接的可以写这个来避免 multihop 被指定# 指定邻居为直连。邻居的IP地址必须在直接可达的IP范围内(即与路由器的接口有关联),# 否则BGP会话不会启动,而是等待这样的接口出现。另一种选择是多跳选项。默认值:使能eBGP。direct;#export all; # 将所有 bird 路由表中的路由都通过bgp发布给peer#export: 控制哪些路由可以发布给bgp peerexport filter {# net 匹配的则被filter放行if net ~ [ 192.168.227.0/24 ] then accept;# 其他的路由全部被filter挡住,从而不会被发布给bgp peerreject;};import all;
}
由于配置文件较长,我们展开详细讲解。
Bird.conf配置详细说明
关于bird.conf配置文件的详细说明可以参考文档 https://soha.moe/post/bird-bgp-kickstart.html
log "/var/log/bird.log" all;
log的配置,表示bird日志单独记录的文件/var/log/bird.log; 如果你希望log记录到系统默认日志,可以使用
#log syslog all;
router id 10.226.11.27;
定义bgp节点的 router-id , bgp 协议中要求每个节点必须定义一个router-id,而且是全局唯一不能重复。
Protocol 表示
对 kernel 路由表的控制
protocol kernel {# 开启debug模式,日志输出更详细debug { states };# 参与安全重启恢复。如果启用了该选项,并且激活了优雅重启恢复,那么内核协议将推迟路由表的同步,直到恢复结束。注意,内核路由导入到BIRD不受影响。graceful restart on;# 每 10 秒扫描一次kernel路由表。这个路由表就是用户在宿主上执行ip route show 看到的表scan time 10;# 允许学习由其他路由守护进程或系统管理员添加到内核路由表中的路由。这只能在支持路由作者识别的系统上实现。# 缺省情况下,不引入由kernel(标记为“proto kernel”)创建的路由。使用learn all选项来导入这些路由。learn;# 告诉BIRD在退出时将所有路由留在路由表中(而不是清理它们)persist;# import 控制哪些路由被导入到 birdimport none; # kernel to bird map# export 控制哪些路由从 bird 插入到 kernel 路由表export all; # Actually insert routes into the kernel routing table
}
对直连路由的控制
protocol direct {# interface 指定哪个接口的路由将被导入到bird路由表interface "veth2";
}
控制对bgp peer 10.226.11.22 的路由发布
protocol bgp peer_10_226_11_22 {debug { states };# 配置 BGP 的 graceful restart# 如果对端因为网络抖动或暂时崩溃而暂时下线,会导致所有传入路由瞬间消失# 为了避免这种情况下数据转发中断,才有 graceful restart# 建议打开graceful restart on;# 指定自己的 ASN 为 65550local as 64512;# 指定对端的 ASN 为 64512,IP 为 10.226.11.22# 如果 ASN 和 local as 相同,那么 BIRD 会自动认为这是一个 iBGP,否则是 eBGP# i 表示 internal(内部),e 表示 external(外部)neighbor 10.226.11.22 as 64512;# source: 定义本地地址作为BGP会话的源地址。Default:邻居所连接接口的本端地址。source address 10.226.11.27;#multihop;# password: 如果和对端约定了密码,在这里配置约定好的密码,否则不用写password "passwd";# direct: eBGP 默认启用可以不写# direct: iBGP 如果是直接连接的可以写这个来避免 multihop 被指定# 指定邻居为直连。邻居的IP地址必须在直接可达的IP范围内(即与路由器的接口有关联),# 否则BGP会话不会启动,而是等待这样的接口出现。另一种选择是多跳选项。默认值:使能eBGP。direct;#export all; # 将所有 bird 路由表中的路由都通过bgp发布给peer#export: 控制哪些路由可以发布给bgp peerexport filter {# net 匹配的则被filter放行if net ~ [ 192.168.227.0/24 ] then accept;# 其他的路由全部被filter挡住,从而不会被发布给bgp peerreject;};# import 控制对方bgp peer 发个我的路由,哪些会被我接收import all;
}
控制对bgp peer 10.226.11.21 的路由发布
protocol bgp peer_10_226_11_21 {debug { states };local as 64512;neighbor 10.226.11.21 as 64512;source address 10.226.11.27;#multihop;password "passwd";direct;export filter export_filter_v4; # 使用过滤表 export_filter_v4 控制哪些路由可以发布给bgp peerimport all; # 从 direct, device, static, kernel 等所有protocol的路由都导入bird 的 bgp 路由
}
示意图

宿主10.226.11.22上的/etc/bird/bird.conf配置
# This is a minimal configuration file, which allows the bird daemon to start
# but will not cause anything else to happen.
#
# Please refer to the documentation in the bird-doc package or BIRD User's
# Guide on http://bird.network.cz/ for more information on configuring BIRD and
# adding routing protocols.#log syslog all;
log "/var/log/bird.log" all;
# Change this into your BIRD router ID. It's a world-wide unique identification
# of your router, usually one of router's IPv4 addresses.
router id 10.226.11.22;filter export_filter_v4 {if net ~ [ 192.168.222.0/24 ] then accept; # 如果为默认路由则拒绝reject;#accept; # 接收所有其他路由
};
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD's
# routing tables with the OS kernel.
protocol kernel {debug { states };scan time 10;learn;persist;import none; # kernel to bird mapexport all; # Actually insert routes into the kernel routing table
}# The Device protocol is not a real routing protocol. It doesn't generate any
# routes and it only serves as a module for getting information about network
# interfaces from the kernel.
protocol direct {interface "veth2";
}
protocol device {
}protocol bgp peer_10_226_11_21 {debug { states };local as 64512;neighbor 10.226.11.21 as 64512;source address 10.226.11.22;#multihop; # multihop 用于source address 不是直连的情况,比如使用loopback地址互联direct;password "passwd";export all;import all;
}protocol bgp peer_10_226_11_27 {debug { states };local as 64512;neighbor 10.226.11.27 as 64512;source address 10.226.11.22;direct;password "passwd";export all;import all;
}
宿主10.226.11.21上的/etc/bird/bird.conf配置
# This is a minimal configuration file, which allows the bird daemon to start
# but will not cause anything else to happen.
#
# Please refer to the documentation in the bird-doc package or BIRD User's
# Guide on http://bird.network.cz/ for more information on configuring BIRD and
# adding routing protocols.
log "/var/log/bird.log" all;
# Change this into your BIRD router ID. It's a world-wide unique identification
# of your router, usually one of router's IPv4 addresses.
router id 10.226.11.21;filter filter_export_v4 {if net ~ [ 192.168.21.0/24 ] then accept;if net ~ [ 192.168.221.0/24 ] then accept;reject;
}
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD's
# routing tables with the OS kernel.
protocol kernel {learn;persist;scan time 10;import none;export all; # Actually insert routes into the kernel routing table
}# The Device protocol is not a real routing protocol. It doesn't generate any
# routes and it only serves as a module for getting information about network
# interfaces from the kernel.
protocol device {
}protocol direct {interface "veth2";
}protocol bgp peer_10_226_11_22 {debug { states };local as 64512;neighbor 10.226.11.22 as 64512;source address 10.226.11.21;#multihop;direct;password "passwd";export all;import all;
}protocol bgp peer_10_226_11_27 {debug { states };local as 64512;neighbor 10.226.11.27 as 64512;source address 10.226.11.21;direct;password "passwd";export all;import all;
}
查看状态
登录宿主10.226.11.27查看其相关网络的状态
- 查看 bgp peer 邻居状态
Established表示与bgp peer邻接关系已经建立,而且已经相互完成了路由学习
root@10_226_11_27:/work/code# birdc show protocol
BIRD 1.5.0 ready.
name proto table state since info
kernel1 Kernel master up 16:06:17
direct1 Direct master up 16:06:17
device1 Device master up 16:06:17
peer_10_226_11_21 BGP master up 16:06:21 Established
peer_10_226_11_22 BGP master up 16:06:22 Established
- bird 路由表
root@10_226_11_27:/work/code# birdc show route
BIRD 1.5.0 ready.
# 从 protocol direct 导入的路由
192.168.227.0/24 dev veth2 [direct1 16:06:17] * (240)
# 从 bgp peer_10_226_11_21 学习的路由
192.168.221.0/24 via 10.226.11.21 on eth0 [peer_10_226_11_21 16:06:21] * (100) [i]
# 从 bgp peer_10_226_11_22 学习的路由
192.168.222.0/24 via 10.226.11.22 on eth0 [peer_10_226_11_22 16:18:14] * (100) [i]
- bird路由表的详细信息
root@10_226_11_27:/work/code# birdc show route all
BIRD 1.5.0 ready.
192.168.227.0/24 dev veth2 [direct1 16:06:17] * (240)Type: device unicast univ
192.168.221.0/24 via 10.226.11.21 on eth0 [peer_10_226_11_21 16:06:21] * (100) [i]Type: BGP unicast univBGP.origin: IGPBGP.as_path:BGP.next_hop: 10.226.11.21BGP.local_pref: 100
192.168.222.0/24 via 10.226.11.22 on eth0 [peer_10_226_11_22 16:18:14] * (100) [i]Type: BGP unicast univBGP.origin: IGPBGP.as_path:BGP.next_hop: 10.226.11.22BGP.local_pref: 100
- kernel 路由表
root@10_226_11_27:/work/code# ip route show
default via 10.226.8.1 dev eth0
# 宿主 eth0接口 的直连路由
10.226.8.0/22 dev eth0 proto kernel scope link src 10.226.11.27
# 从bird 学习来的路由
192.168.221.0/24 via 10.226.11.21 dev eth0 proto bird
192.168.222.0/24 via 10.226.11.22 dev eth0 proto bird
# 宿主 veth2接口 直接的路由(模拟的容器网段)
192.168.227.0/24 dev veth2 proto kernel scope link src 192.168.227.101
网络测试验证
- 从容器192.168.227.101 ping 容器192.168.222.101
root@10_226_11_27:/work/code# ip netns exec netns1 ping 192.168.222.101 -c 2
PING 192.168.222.101 (192.168.222.101) 56(84) bytes of data.
64 bytes from 192.168.222.101: icmp_seq=1 ttl=63 time=0.925 ms
64 bytes from 192.168.222.101: icmp_seq=2 ttl=63 time=0.252 ms--- 192.168.222.101 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.252/0.588/0.925/0.337 ms
- 从容器192.168.227.101 ping 容器192.168.221.101
root@10_226_11_27:/work/code# ip netns exec netns1 ping 192.168.221.101 -c 2
PING 192.168.221.101 (192.168.221.101) 56(84) bytes of data.
64 bytes from 192.168.221.101: icmp_seq=1 ttl=63 time=0.221 ms
64 bytes from 192.168.221.101: icmp_seq=2 ttl=63 time=0.251 ms--- 192.168.221.101 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1011ms
rtt min/avg/max/mdev = 0.221/0.236/0.251/0.015 ms
- 宿主10.226.11.27 ping 192.168.221.101
root@10_226_11_27:/work/code# ping 192.168.221.101 -c 2
PING 192.168.221.101 (192.168.221.101) 56(84) bytes of data.
64 bytes from 192.168.221.101: icmp_seq=1 ttl=64 time=0.886 ms
64 bytes from 192.168.221.101: icmp_seq=2 ttl=64 time=0.268 ms--- 192.168.221.101 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1015ms
rtt min/avg/max/mdev = 0.268/0.577/0.886/0.309 msroot@10_226_11_27:/work/code# traceroute -d 192.168.221.101
traceroute to 192.168.221.101 (192.168.221.101), 30 hops max, 60 byte packets1 192.168.221.101 (192.168.221.101) 0.261 ms 0.231 ms 0.225 ms
- 容器192.168.227.102的路由
root@10_226_11_27:/work/code# ip netns exec netns1 ip route
default via 192.168.227.101 dev veth1
192.168.227.0/24 dev veth1 proto kernel scope link src 192.168.227.102root@10_226_11_27:/work/code# ip netns exec netns1 ip route get 192.168.221.101
192.168.221.101 via 192.168.227.101 dev veth1 src 192.168.227.102cache
实验结论
- 实现了三台宿主的bird的bgp full mesh 模式
- 三台宿主通过bgp相互完成了路由学习
- 通过实验我们对calico中的bird程序有了更深入的认知
参考文档
bird官网
BGP_example_1
Intro-to-BGP-with-BIRD
bird-bgp-kickstart
https://wiki.skywolf.cloud/quickstart/player.html
相关文章:
kubernetes网络(二)之bird实现节点间BGP互联的实验
摘要 上一篇文章中我们学习了calico的原理,kubernetes中的node节点,利用 calico 的 bird 程序相互学习路由,为了加深对 bird 程序的认识,本文我们将使用bird进行实验,实验中实现了BGP FULL MESH模式让宿主相互学习到对…...
动态语言? 静态语言? ------区别何在?java,js,c,c++,python分给是静态or动态语言?
JavaScript 被称为动态语言,而 Java 被称为静态语言 这主要与它们在类型系统、编译执行方式以及运行时行为等方面的不同特性有关。详细差异如下: JavaScript (动态语言) 动态类型: 在JavaScript中,变量的类型是在运行时确定的。这…...
计算机网络17——IM聊天系统——客户端核心处理类框架搭建
目的 拆开客户端和服务端,使用Qt实现客户端,VS实现服务端 Qt创建项目 Qt文件类型 .pro文件:配置文件,决定了哪些文件参与编译,怎样参与编译 .h .cpp .ui:画图文件 Qt编码方式 Qt使用utf-8作为编码方…...
C/C++面试题
关键字 1."#","##"的用法 #是字符串转换符,##是字符串连接符;发生在预处理阶段; 2.volatile的含义 防止编译器优化,告诉编译器每次都去真实地址中读取,而不是从寄存器或者缓存中&a…...
[3]Opengl ES着色器
术语: VertexShader:顶点着色器,用来描述图形图像位置的顶点坐标; FragmentShader:片元着色器,用来给顶点指定的区域进行着色; Vertex:顶点 Texture:纹理…...
Spring Boot 中实现任务后台处理的几种常见方式
博客主页: 南来_北往 系列专栏:Spring Boot实战 前言 在现代应用程序中,后台处理对于处理发送电子邮件、处理文件、生成报告等任务至关重要。 Spring Boot 提供了多种机制来高效地实现后台任务。本文探讨了在 Spring Boot 中处理后台处理的各…...
部署--UmiJS
默认方案 umi2 默认对新手友好,所以默认不做按需加载处理,umi build 后输出 index.html、umi.js 和 umi.css 三个文件。 不输出 html 文件 某些场景 html 文件交给后端输出,前端构建并不需要输出 html 文件,可配置环境变量 HTM…...
python自学笔记
python部分总结 主要记录的是python与之前学的语言的不同之处 函数总结 首字母大写: name.title() 删除右边空格(暂时):name.rstrip() 删除左边空格(暂时):name.lstrip() 删除前缀(暂时):name.removeprefi…...
Ubuntu磁盘不足扩容
1.问题 Ubuntu磁盘不足扩容 2.解决方法 安装一下 sudo apt-get install gpartedsudo gparted...
【ROS2】spin、spinOnce、spin_some、spin_until_future_complete
1、简述 spinOnce仅处理一个回调函数(ROS1); spin_some类似于ROS1的spinOnce,但处理多个任务,然后返回(ROS2); spin会持续处理回调函数直到无任务,然后阻塞(ROS1、ROS2); 注意: 只有消息推送(publisher)功能的程序,不需要使用spin_some(),因为它不执行任何回…...
化繁为简:中介者模式如何管理复杂对象交互
化繁为简:中介者模式如何管理复杂对象交互 中介者模式 是一种行为型设计模式,定义了一个中介者对象,来封装一组对象之间的交互。中介者模式通过将对象之间的交互行为从多个对象中抽离出来,集中封装在一个中介者对象中,…...
控制STM32蜂鸣器示例代码(江科大)
以下代码来源于本人学习江科大的课程,这是一个简单的STM32微控制器程序,用于控制连接到GPIOB第12号引脚的蜂鸣器。程序通过GPIOB的第12号引脚输出PWM波形来控制蜂鸣器的频率,从而产生声音。 #include "stm32f10x.h" …...
Java基础知识扫盲
目录 Arrays.sort的底层实现 BigDecimal(double)和BigDecimal(String)有什么区别 Char可以存储一个汉字吗 Java中的Timer定时调度任务是咋实现的 Java中的序列化机制是咋实现的 Java中的注解是干嘛的 Arrays.sort的底层实现 Arrays.sort是Java中提供的对数组进行排序的…...
ZLMediaKit Windows编译以及使用
1.运行ZLMediaKit 2.通过ffmpeg把视频源推流给ZLMediaKit 执行以下命令,将本地视频通过RTSP协议推流给ZLMediaKit。 ffmpeg -re -stream_loop -1 -i "D:\workplace\armgb\public\1.fileh264" -vcodec h264 -f rtsp rtsp://127.0.0.1/live/test 若想将本…...
基于YOLOv5s的无人机航拍输电线瓷瓶检测(附数据集与操作步骤)
本文主要内容:详细介绍了无人机航拍输电线瓷瓶检测的整个过程,从创建数据集到训练模型再到预测结果全部可视化操作与分析。 文末有数据集获取方式,请先看检测效果 现状 输电线路绝缘瓷瓶的检测主要依赖人工巡检。巡检人员需携带专业设备,攀…...
【Python百日进阶-Web开发-FastAPI】Day805 - FastAPI的请求体
文章目录 一、导入 Pydantic 的 BaseModel二、创建数据模型三、声明为参数四、结果五、自动化文档六、编辑器支持七、使用模型八、请求体 + 路径参数九、请求体 + 路径参数 + 查询参数十、不使用 Pydantichttps://fastapi.tiangolo.com/zh/tutorial/body/ 当你需要将数据从客户…...
【Kubernetes】常见面试题汇总(二十八)
目录 79.您如何看待公司从单一服务转向微服务并部署其服务容器? 80.什么是 Headless Service? 特别说明: 题目 1-68 属于【Kubernetes】的常规概念题。 题目 69-113 属于【Kubernetes】的生产应用题。 79.您如何看待公司从单一服务转…...
单ISP与双ISP的区别是什么
单ISP(单一互联网服务提供商)与双ISP(双重互联网服务提供商)主要在以下几个方面有区别: 服务冗余: 单ISP:只有一个互联网服务提供商提供的网络连接。如果该ISP发生故障,整个网络连接…...
【linux】gcc makefile
🔥个人主页:Quitecoder 🔥专栏:linux笔记仓 目录 01.gcc如何完成02.gcc选项03.函数库与动静态链接静态链接动态链接库文件特点和用途动态链接版本和兼容性 04.makefile自动推导 01.gcc如何完成 预处理(进行宏替换) 预处理功能主要…...
12.Java基础概念-面向对象-static
欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 Facts speak louder than words! 一、static关键字的含义…...
基于算法竞赛的c++编程(28)结构体的进阶应用
结构体的嵌套与复杂数据组织 在C中,结构体可以嵌套使用,形成更复杂的数据结构。例如,可以通过嵌套结构体描述多层级数据关系: struct Address {string city;string street;int zipCode; };struct Employee {string name;int id;…...
盘古信息PCB行业解决方案:以全域场景重构,激活智造新未来
一、破局:PCB行业的时代之问 在数字经济蓬勃发展的浪潮中,PCB(印制电路板)作为 “电子产品之母”,其重要性愈发凸显。随着 5G、人工智能等新兴技术的加速渗透,PCB行业面临着前所未有的挑战与机遇。产品迭代…...
从零实现富文本编辑器#5-编辑器选区模型的状态结构表达
先前我们总结了浏览器选区模型的交互策略,并且实现了基本的选区操作,还调研了自绘选区的实现。那么相对的,我们还需要设计编辑器的选区表达,也可以称为模型选区。编辑器中应用变更时的操作范围,就是以模型选区为基准来…...
pam_env.so模块配置解析
在PAM(Pluggable Authentication Modules)配置中, /etc/pam.d/su 文件相关配置含义如下: 配置解析 auth required pam_env.so1. 字段分解 字段值说明模块类型auth认证类模块,负责验证用户身份&am…...
汽车生产虚拟实训中的技能提升与生产优化
在制造业蓬勃发展的大背景下,虚拟教学实训宛如一颗璀璨的新星,正发挥着不可或缺且日益凸显的关键作用,源源不断地为企业的稳健前行与创新发展注入磅礴强大的动力。就以汽车制造企业这一极具代表性的行业主体为例,汽车生产线上各类…...
页面渲染流程与性能优化
页面渲染流程与性能优化详解(完整版) 一、现代浏览器渲染流程(详细说明) 1. 构建DOM树 浏览器接收到HTML文档后,会逐步解析并构建DOM(Document Object Model)树。具体过程如下: (…...
sqlserver 根据指定字符 解析拼接字符串
DECLARE LotNo NVARCHAR(50)A,B,C DECLARE xml XML ( SELECT <x> REPLACE(LotNo, ,, </x><x>) </x> ) DECLARE ErrorCode NVARCHAR(50) -- 提取 XML 中的值 SELECT value x.value(., VARCHAR(MAX))…...
工业自动化时代的精准装配革新:迁移科技3D视觉系统如何重塑机器人定位装配
AI3D视觉的工业赋能者 迁移科技成立于2017年,作为行业领先的3D工业相机及视觉系统供应商,累计完成数亿元融资。其核心技术覆盖硬件设计、算法优化及软件集成,通过稳定、易用、高回报的AI3D视觉系统,为汽车、新能源、金属制造等行…...
什么是Ansible Jinja2
理解 Ansible Jinja2 模板 Ansible 是一款功能强大的开源自动化工具,可让您无缝地管理和配置系统。Ansible 的一大亮点是它使用 Jinja2 模板,允许您根据变量数据动态生成文件、配置设置和脚本。本文将向您介绍 Ansible 中的 Jinja2 模板,并通…...
现有的 Redis 分布式锁库(如 Redisson)提供了哪些便利?
现有的 Redis 分布式锁库(如 Redisson)相比于开发者自己基于 Redis 命令(如 SETNX, EXPIRE, DEL)手动实现分布式锁,提供了巨大的便利性和健壮性。主要体现在以下几个方面: 原子性保证 (Atomicity)ÿ…...
