系统相关
首页 > 系统相关> > Linux_task6

Linux_task6

作者:互联网

Linux_task6

TCP三次握手/四次挥手

TCP:3/4

TCP/UDP区别

TCPUDP
Connection-orientedConnectionless
sequencenone
FTP File-Sharing E-mailVoice Streaming Video Streaming

IP地址分类

127.0.0.1为回环地址,因此127.0.0.0网段被保留;其特殊性在于,只要是和loopback网卡在同一网段的ip地址,都能ping通,并且loopback网卡上新加的ip地址并不会生成路由记录,回环网卡因物理上比较稳定,在生产环境中时有用到

IP配置方法

ifconfig IFACE IFADDR/MASK
ifconfig IFACE up/down
ifconfig IFACE:<Label> IP/MASK
#来源于古老的net-tools工具包,现在已很少使用
ip address [add][del][change] IFADDR/MASK dev IFACE [label IFACE:NUM][scope {host,link,global}]  [master] [type] 
nmcli connection reload
nmcli connection [up][down] IFACE
nmcli connection [add][modify][del] con-name xxx ifname xxx ipv4.method {auto,manual}\
> ipv4.{addresses,gateway} type {ethernet,bond,bridge,team}
# nmcli命令自动修改磁盘文件,永久保存
# nmcli的底层是NetworkManager守护进程

nmcli实现bonding

[root@linuxprobe ~]# nmcli connection add type bond con-name mybond ifname bond0 mode active-backup
Connection 'mybond' (8f0d9cce-ed6a-4d0e-a9a2-cba48490d1d2) successfully added.
[root@linuxprobe ~]# nmcli connection add type bond-slave master bond0 ifname ens37
Connection 'bond-slave-ens37' (c4f82c63-145d-4ec9-8432-f5ecbb7f3b3a) successfully added.
[root@linuxprobe ~]# nmcli connection add type bond-slave master bond0 ifname ens38
Connection 'bond-slave-ens38' (c5a3f017-3a99-428a-8b9d-4a00af4152da) successfully added.
[root@linuxprobe ~]# nmcli connection reload
[root@linuxprobe ~]# nmcli connection up bond-slave-ens37
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@linuxprobe ~]# nmcli connection up bond-slave-ens38
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@linuxprobe ~]# nmcli connection up mybond
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@linuxprobe /]# nmcli connection
NAME                UUID                                  TYPE      DEVICE
ens33               49da06d1-7851-3b3c-8025-39ac395471fc  ethernet  ens33
mybond              8f0d9cce-ed6a-4d0e-a9a2-cba48490d1d2  bond      bond0
bond-slave-ens37    c4f82c63-145d-4ec9-8432-f5ecbb7f3b3a  ethernet  ens37
bond-slave-ens38    c5a3f017-3a99-428a-8b9d-4a00af4152da  ethernet  ens38
Wired connection 1  4e5d315c-274b-32eb-88a3-ca5cd71c07ce  ethernet  --
Wired connection 2  da549472-f269-3db4-af9b-47e66e7a1810  ethernet  --

#此时查看网卡接口(ip addr)可以发现bond网卡的MAC地址统一
3: ens37: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 00:0c:29:13:dd:40 brd ff:ff:ff:ff:ff:ff
    altname enp2s5
4: ens38: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:13:dd:40 brd ff:ff:ff:ff:ff:ff permaddr 00:0c:29:13:dd:4a
    altname enp2s6
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:29:13:dd:40 brd ff:ff:ff:ff:ff:ff
    inet 192.168.142.134/24 brd 192.168.142.255 scope global dynamic noprefixroute bond0
       valid_lft 1024sec preferred_lft 1024sec
    inet6 fe80::9647:c69d:cc99:d556/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
       
#查看一下bond网卡的真实MAC地址,可以看到这个MAC地址是属于ens37的
[root@linuxprobe /]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.11.11-300.fc34.x86_64

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens37
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: ens37
MII Status: up
Speed: 10 Mbps
Duplex: half
Link Failure Count: 0
Permanent HW addr: 00:0c:29:13:dd:40
Slave queue ID: 0

Slave Interface: ens38
MII Status: up
Speed: 10 Mbps
Duplex: half
Link Failure Count: 0
Permanent HW addr: 00:0c:29:13:dd:4a
Slave queue ID: 0

标签:bond0,task6,nmcli,connection,ff,Linux,root,bond
来源: https://blog.csdn.net/lxn2001/article/details/118726295