Linux_网络进阶管理
一、链路聚合
1、什么是链路聚合?
网卡的链路聚合就是将多块网卡连接起来,当-块网卡损坏,网络依旧可以正常运行,可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度。
2、链路聚合方式:
- bond:最多可以添加两块网卡
- team:最多可以添加八块网卡
- bond的常用的2种模式:
- bond0(balance-rr)
- bond0用于负载轮询(2个网单独都是100MB, 聚合为1个网络传输带宽为200MB)
- bond1用于高可用,其中一条线若断线,其他线路将会自动备援
bond1(active-backup)
- bond0(balance-rr)
team可以实现以下模式的聚合链路:
- broadcast ——广播容错
- roundrobin ——负载轮询
- activebackup ——主备(必考)
- loadbalance ——负载均衡
- lacp ——需要交换机支持lacp协议
3、bond的七种模式
这七种模式分别是:
802.3ad balance-alb balance-tlb broadcast active-backup balance-rr balance-xor
- mode=0 round-robin轮询策略(Round-robin policy)
- mode=1 active-backup主备策略(Active-backup policy)
- mode=2 load balancing (xor)异或策略(XOR policy)
- mode=3 fault-tolerance (broadcast)广播策略(Broadcast policy)
- mode=4 lacp IEEE 802.3ad 动态链路聚合(IEEE 802.3ad Dynamic link aggregation)
- mode=5 transmit load balancing适配器传输负载均衡(Adaptive transmit load balancing)
- mode=6 adaptive load balancing适配器负载均衡(Adaptive load balancing)
二、链路聚合配置
1、查看所以网卡设备信息
[root@localhost ~]# nmcli de
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
eth1 ethernet disconnected --
eth2 ethernet disconnected --
lo loopback unmanaged --
//绑定物理网卡,事先必须断开物理网卡的连接
2、网卡链路聚合方式一:bond —— blance-rr模式
第一步:创建bond0
[root@localhost ~]# nmcli connection add type bond con-name bond0 ifname bond0 mode balance-rr ipv4.method manual ipv4.addresses 192.168.174.150/24 ipv4.gateway 192.168.174.2 ipv4.dns 8.8.8.8
Connection 'bond0' (b038c7fb-e1f8-4436-b6d6-8ab6f6177cd4) successfully added.
[root@localhost ~]# ip addr show bond0
5: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 6a:82:e0:bc:f4:e9 brd ff:ff:ff:ff:ff:ff
inet 192.168.174.150/24 brd 192.168.174.255 scope global noprefixroute bond0
valid_lft forever preferred_lft forever //查看bond0网络接口状态
[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
bond0 b038c7fb-e1f8-4436-b6d6-8ab6f6177cd4 bond bond0
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第二步:添加两块物理网卡连接到bond0
[root@localhost ~]# nmcli connection add type bond-slave con-name slave1 ifname eth1 master bond0
Connection 'slave1' (a188a30f-4aea-43ff-82b2-b9cd6ebf076a) successfully added.
[root@localhost ~]# nmcli connection add type bond-slave con-name slave2 ifname eth2 master bond0
Connection 'slave2' (38072c0c-ca0b-4cc8-b762-15d277b74f26) successfully added. //查看bond-slave查看网络接口状态
[root@localhost ~]# nmcli connection
NAME UUID TYPE DEVICE
bond0 b038c7fb-e1f8-4436-b6d6-8ab6f6177cd4 bond bond0
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
slave1 a188a30f-4aea-43ff-82b2-b9cd6ebf076a ethernet --
slave2 38072c0c-ca0b-4cc8-b762-15d277b74f26 ethernet --
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第四步:激活网卡设备
[root@localhost ~]# nmcli connection up slave1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@localhost ~]# nmcli connection up slave2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
第五步:查看bond的配置信息
[root@localhost ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0 Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:fa:c0:fa
Slave queue ID: 0 Slave Interface: eth2
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:fa:c0:04
Slave queue ID: 0
第六步:关闭eth0,检测bond0是否正常
[root@localhost ~]# nmcli device disconnect eth0
第七步:查看网卡信息
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:f0 brd ff:ff:ff:ff:ff:ff
inet 192.168.174.139/24 brd 192.168.174.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::a101:bf00:d10e:9788/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
inet 192.168.174.140/24 brd 192.168.174.255 scope global dynamic noprefixroute bond0
valid_lft 1542sec preferred_lft 1542sec
inet 192.168.174.150/24 brd 192.168.174.255 scope global secondary noprefixroute bond0
valid_lft forever preferred_lft forever
inet6 fe80::97b0:2962:6eab:49fc/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3、网卡链路聚合方式一:bond —— activebackup模式
第一步:创建bond1
[root@localhost ~]# nmcli connection add type bond con-name bond1 ifname bond1 mode active-backup ipv4.method manual ipv4.addresses 192.168.174.160/24 ipv4.gateway 192.168.174.2 ipv4.dns 8.8.8.8
Connection 'bond1' (79fb7f29-4da5-46eb-8915-0d14b20d7e16) successfully added.
[root@localhost ~]# ip addr show bond1
6: bond1: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 3e:5e:4f:a1:31:cd brd ff:ff:ff:ff:ff:ff
inet 192.168.174.160/24 brd 192.168.174.255 scope global noprefixroute bond1
valid_lft forever preferred_lft forever / /查看bond1网卡连接状态
[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
bond1 79fb7f29-4da5-46eb-8915-0d14b20d7e16 bond bond1
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第二步:添加物理网卡连接到bond1
[root@localhost ~]# nmcli connection add type bond-slave con-name slave1 ifname eth1 master bond1
Connection 'slave1' (fdb0b4af-604c-4a56-b3ba-0c72d7172807) successfully added.
[root@localhost ~]# nmcli connection add type bond-slave con-name slave2 ifname eth2 master bond1
Connection 'slave2' (80abf4ac-348a-4f8a-8df8-4f1dc45db4c1) successfully added.
第三步:查看bond的配置信息
[root@localhost ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0 Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:fa:c0:fa
Slave queue ID: 0 Slave Interface: eth2
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:fa:c0:04
Slave queue ID: 0
测试
//停掉eth1,查看配置文件状态
[root@localhost ~]# nmcli device disconnect eth1
成功断开设备 "eth1"。
[root@localhost ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0 Slave Interface: eth2
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:cd:6a:2f
Slave queue ID: 0 //停掉eth2,查看配置文件状态
[root@localhost ~]# nmcli device connect eth1
成功用 "eth154935406-3bcd-4d24-b58c-4e9f86c2999b" 激活了设备 ""。
[root@localhost ~]# nmcli device disconnect eth2
成功断开设备 "eth2"。
[root@localhost ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0 Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:cd:6a:25
Slave queue ID: 0
4、网卡链路聚合方式二:team —— roundrobin模式
第一步:查看网卡设备信息
[root@localhost ~]# nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
eth1 ethernet disconnected --
eth2 ethernet disconnected --
lo loopback unmanaged --
//创建之前,必须断开网卡的连接
第二步:创建team0
[root@localhost ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"roundrobin"}}' ipv4.method manual ipv4.addresses 192.168.174.150/24 ipv4.gateway 192.168.174.2 ipv4.dns 8.8.8.8
Connection 'team0' (b2a9d127-0ef4-479a-89c0-77137db2d825) successfully added. //查看team0网卡设备的状态
[root@localhost ~]# nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
team0 team connected team0
eth1 ethernet disconnected --
eth2 ethernet disconnected --
lo loopback unmanaged --
第三步:添加物理网卡连接到team0
[root@localhost ~]# nmcli connection add type team-slave con-name slave1 ifname eth1 master team0
Connection 'slave1' (e88752fb-bad8-4e30-8374-c087e34fc9b9) successfully added.
[root@localhost ~]# nmcli connection add type team-slave con-name slave2 ifname eth2 master team0
Connection 'slave2' (fe58bc8d-97e4-4390-8490-8d898fcb7c8b) successfully added.
第三步:查看网卡连接信息
[root@localhost ~]# nmcli connection
NAME UUID TYPE DEVICE
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
team0 b2a9d127-0ef4-479a-89c0-77137db2d825 team team0
slave1 7b2d11d2-a939-4cb4-a751-73cfe52f6872 ethernet --
slave2 05a4815e-5a22-40ca-a917-ee25a6286c6e ethernet --
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第四步:激活所以网卡连接
[root@localhost ~]# nmcli connection up slave1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)
[root@localhost ~]# nmcli connection up slave2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/14)
[root@localhost ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)
查看网卡IP信息
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:f0 brd ff:ff:ff:ff:ff:ff
inet 192.168.174.139/24 brd 192.168.174.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::a101:bf00:d10e:9788/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master team0 state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master team0 state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
10: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:fa:c0:fa brd ff:ff:ff:ff:ff:ff
inet 192.168.174.150/24 brd 192.168.174.255 scope global noprefixroute team0
valid_lft forever preferred_lft forever
inet6 fe80::7277:ccf3:77f3:262f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
第五步:检测team0状态
[root@localhost ~]# teamdctl team0 state
setup:
runner: roundrobin
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
5、网卡链路聚合方式二:team —— activebackup模式
第一步:创建team1
[root@localhost ~]# nmcli connection add type team con-name team1 ifname team1 config '{"runner":{"name":"activebackup"}}' ipv4.method manual ipv4.addresses 192.168.174.190/24 ipv4.gateway 192.168.174.2 ipv4.dns 8.8.8.8
Connection 'team1' (f315f9cb-8b13-4372-8163-ec41a30c44af) successfully added. //查看team1网卡状态
[root@localhost ~]# nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
team1 team connected team1
eth1 ethernet disconnected --
eth2 ethernet disconnected --
lo loopback unmanaged --
[root@localhost ~]# nmcli connection
NAME UUID TYPE DEVICE
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
team1 f315f9cb-8b13-4372-8163-ec41a30c44af team team1
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第二步:连接物理网卡到team1
[root@localhost ~]# nmcli connection add type team-slave con-name slave1 ifname eth1 master team1
Connection 'slave1' (063127d0-88d2-41bf-988c-9c79a31f9b32) successfully added.
[root@localhost ~]# nmcli connection add type team-slave con-name slave2 ifname eth2 master team1
Connection 'slave2' (ecc6d36f-5d92-44b7-979b-b835b8b7facc) successfully added.
查看网卡设备信息
[root@localhost ~]# nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
team1 team connected team1
eth1 ethernet connected slave1
eth2 ethernet connected slave2
lo loopback unmanaged -- [root@localhost ~]# nmcli connection
NAME UUID TYPE DEVICE
eth0 f7036e05-ee1b-4ceb-94cc-0845ace9f4c1 ethernet eth0
team1 f315f9cb-8b13-4372-8163-ec41a30c44af team team1
slave1 063127d0-88d2-41bf-988c-9c79a31f9b32 ethernet eth1
slave2 ecc6d36f-5d92-44b7-979b-b835b8b7facc ethernet eth2
Wired connection 1 a761ff76-b76c-307e-939b-cbe2ecc41bc7 ethernet --
Wired connection 2 f70e7fbb-52d0-3cb3-bc6c-7e937553ac06 ethernet --
第六步:查看team1状态
[root@localhost ~]# teamdctl team1 state
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: eth1
6、动态修改team模式
导出配置文件
[root@localhost ~]# teamdctl team1 config dump > /root/team.conf (dump:下载)
[root@localhost ~]# ls
anaconda-ks.cfg team.conf
修改team.conf里面的内容
[root@localhost ~]# vim team.conf
{
"device": "team1",
"mcast_rejoin": {
"count": 1
},
"notify_peers": {
"count": 1
},
"ports": {
"eth1": {
"link_watch": {
"name": "ethtool"
}
},
"eth2": {
"link_watch": {
"name": "ethtool"
}
}
},
"runner": {
"name": "roundrobin" //将acticebackup换成roundrobin
}
}
以最新修改的配置选项修改team1属性
[root@localhost ~]# nmcli connection modify team1 team.config /root/team.conf
重启team1网卡
[root@localhost ~]# nmcli connection down team1;nmcli connection up team1
Connection 'team1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/21)
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/24)
查看team1配置信息
[root@localhost ~]# teamdctl team1 state
setup:
runner: roundrobin //改完后就回发生改变
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
Linux_网络进阶管理的更多相关文章
- Linux_网络基础管理
一.网卡的命名 1.传统网卡命名 eth0.eth1.eth2.eth3......... wlan0.wlan1.waln2.wlan3......... 2.RHEL7命名机制 systemd对网 ...
- Liunx网络技术管理及进程管理
Linux网络技术管理及进程管理(week2_day4) OSI七层模型和TCP/IP四层模型 OSI七层模型:OSI(Open System Interconnection)开放系统互连参考模型 ...
- Linux网络属性管理
Linux网络属性管理 局域网:以太网,令牌环网 Ethernet: CSMA/CD 冲突域 广播域 MAC:Media Access Control 48bits: 24bits: 24bits: ...
- 基于UML网络教学管理平台模型的搭建
一.基本信息 标题:基于UML网络教学管理平台模型的搭建 时间:2013 出版源:网络安全技术与应用 领域分类:UML:网络教学管理平台:模型 二.研究背景 问题定义:网络教学管理平台模型的搭建 难点 ...
- Linux 网络属性管理
Linux网络基础管理-1:IPv4 地址分类: 点分十进制:0.0.0.0-255.255.255.255 A类: 0 0000000 - 0 1111111: 1-127 网络数:126, 1 ...
- linux入门系列11--Centos7网络服务管理
通过前面文章的学习已经掌握了Linux系统配置管理的知识,本文讲解Centos7网络配置知识. Linux要对外提供服务,需要保证网络通信正常,因此需要正确配置网络参数.本文将讲解如何使用Networ ...
- linux进阶之网络技术管理
本节内容 1. 网络七层模型 物理层 数据链路层 网络层 传输层 会话层 表示层 应用层 2. TCP/UDP (1)TCP面向连接,可靠传输,消耗系统资源比较多,传输速度较慢,但是数据传 ...
- Linux网络共享管理(ssh,nfs,samba)
OpenSSH服务器: ssh协议:提供安全的ssh环境用于远程管理,默认端口:22: 服务名称:sshd openssh-server包的安装文件: 使用ssh客户端程序: 连接目标主机: ssh ...
- Linux网络技术管理及进程管理(week2_day4)--技术流ken
OSI七层模型和TCP/IP四层模型 OSI七层模型:OSI(Open System Interconnection)开放系统互连参考模型是国际标准化组织(ISO)制定的一个用于计算机或通信系统间互联 ...
随机推荐
- 99%的Python用户都不知道的f-string隐秘技巧
f-string想必很多Python用户都基础性的使用过,作为Python3.6版本开始引入的特性,通过它我们可以更加方便地向字符串中嵌入自定义内容,但f-string真正蕴含的功能远比大多数用户知道 ...
- filesort排序原理
在执行计划中,可能经常看到有Extra列有filesort,这就是使用了文件排序,这当然是不好的,应该优化,但是,了解一下他排序的原理也许很有帮助,下面看一下filesort的过程: 1.根据表的索引 ...
- 动图:删除链表的倒数第 N 个结点
本文主要介绍一道面试中常考链表删除相关的题目,即 leetcode 19. 删除链表的倒数第 N 个结点.采用 双指针 + 动图 的方式进行剖析,供大家参考,希望对大家有所帮组. 19. 删除链表的倒 ...
- 数栈SQL优化案例:隐式转换
MySQL是当下最流行的关系型数据库之一,互联网高速发展的今天,MySQL数据库在电商.金融等诸多行业的生产系统中被广泛使用. 在实际的开发运维过程中,想必大家也常常会碰到慢SQL的困扰.一条性能不好 ...
- Linux实战技能,教你轻松应对85%的使用场景
在Linux实操的过程中,你在网上也能搜到一堆参考资料,但是看完之后还是会觉得似懂非懂,无法举一反三,从网上复制粘贴了事,则极有可能不起作用. 如果侥幸解决了特定的问题,也意识到自己需要系统学习一下 ...
- Leedcode算法专题训练(字符串)
4. 两个字符串包含的字符是否完全相同 242. Valid Anagram (Easy) Leetcode / 力扣 可以用 HashMap 来映射字符与出现次数,然后比较两个字符串出现的字符数量是 ...
- 【CTF】XCTF Misc 心仪的公司 & 就在其中 writeup
前言 这两题都是Misc中数据包的题目,一直觉得对数据包比较陌生,不知道怎么处理. 这里放两道题的wp,第一题strings命令秒杀觉得非常优秀,另外一题有涉及RSA加密与解密(本文不具体讨论RSA非 ...
- Day12_62_线程的生命周期
线程的生命周期 要实现多线程,必须在主线程中创建新的线程对象. 任何线程一般都具有五种状态,即创建,就绪,运行,阻塞,终止(消亡) 新建状态:在程序中创建了一个新的线程对象后,新的线程对象便处于新建状 ...
- 实现服务端和客户端的实时双向数据传输-WebSocket简单了解
WebSocket 前段时间项目中遇到了消息推送的问题,当时采用客户端轮询,每隔 5s 请求一次数据.由于轮询的效率低,非常浪费资源.后面准备把轮询调整为使用 WebSocket 来建立连接,实现推送 ...
- .NET 5学习笔记(12)——WinUI 3 Project Reunion 0.5
2021年3月的时候,Win UI 3终于来到了第一个稳定的支持版本,可用于创建发布到Micosoft Store的应用.据某软的说法,这个叫WinUI 3 Project Reunion 0.5的版 ...