linux网络管理(链路聚合、桥接网络、故障排查、常用工具)
文章目录
- 网络进阶管理
- 链路聚合
- 桥接网络
- 链路聚合配置
- Centos7/RHEL7配置bond聚合链路
- Centos7/RHEL7配置bond0
- Centos7/RHEL7配置bond1
- Centos6/RHEL6配置bond聚合链路
- Centos7/RHEL7配置team聚合链路
- 动态修改team模式
- 桥接网络配置
- 网络检测工具与故障排查
- ping
- host与nslookup
- traceroute
- netstat
- ss
- 网络故障排查
网络进阶管理
链路聚合
网卡的链路聚合就是将多块网卡连接起来,当一块网卡损坏,网络依旧可以正常运行,可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度。
网卡的链路聚合方式:
- bond:最多可以添加两块网卡
- team:最多可以添加八块网卡
bond的常用的2种模式:
- bond0(balance-rr)
- bond0用于负载轮询(2个网单独都是100MB,聚合为1个网络传输带宽为200MB)
- bond1(active-backup)
- bond1用于高可用,其中一条线若断线,其他线路将会自动备援
--> eth0 ----\app --发送数据到--> bond0 <---> switch --> eth1 ----/
桥接网络
桥接网络也即网桥,可基于MAC地址在网络间转发流量。网桥识别哪些主机连接到每个网络,构建MAC地址表,然后根据该表做出包转发决策。
软件网桥的最常见应用是在虚拟化应用程序中,用于在一个或多个虚拟NIC中共享一个硬件NIC。
链路聚合配置
Centos7/RHEL7配置bond聚合链路
Centos7/RHEL7配置bond0
准备两块网卡做链路聚合,其中ens33用来做远程连接的,实际上只有两块网卡
查看网络状态:
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
ens38 ethernet 已断开 --
ens39 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 --
//创建bond0, 模式为balance-rr
[root@localhost ~]# nmcli connection add type bond mode balance-rr con-name bond0 ifname bond0 ipv4.method manual ipv4.addresses 192.168.100.68/24 ipv4.gateway 192.168.100.254 ipv4.dns 192.168.100.254
连接“bond0”(ae91ade2-b034-4e7a-84c0-b1992e96fc3b) 已成功添加。 //bond0已经添加
注释:nmcli con add // 添加nmcli连接type bond //类型为bondmode balance-rr //模式为balance-rr(负载均衡)con-name bond0 // 连接的名字为bond0ifname bond0 //进来的网卡的名字bond0ipv4.method manual //ipv4的方法为手动ipv4.addresses 192.168.100.68/24 //ip地址为ipv4.gateway 192.168.100.254 //网关为ipv4.dns 192.168.100.254 //dns为[root@localhost ~]# nmcli dev //查看状态bond0已连接
设备 类型 状态 连接
bond0 bond 连接的 bond0
ens38 ethernet 已断开 --
ens39 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 --
//添加物理网卡连接至bond0
[root@localhost ~]# nmcli connection add type bond-slave con-name bond-slave0 ifname ens38 master bond0
连接“bond-slave0”(dc02bacd-e9da-4f32-bf9d-1fc7994d88f9) 已成功添加。
[root@localhost ~]# nmcli connection add type bond-slave con-name bond-slave0 ifname ens39 master bond0
连接“bond-slave0”(da5a39cf-0c22-458f-b299-98f7fcd94950) 已成功添加。注释:
nmcli connection add //添加nmcli连接
type bond-slave //类型为bond-slave
con-name bond-slave0 //连接的名字为bond-slave0
ifname ens38 //网卡的名字为ens38
master bond0 //添加到bond0里面去查看状态
[root@localhost network-scripts]# nmcli de
设备 类型 状态 连接
bond0 bond 连接的 bond0
ens38 ethernet 连接的 bond-slave0
ens39 ethernet 连接的 bond-slave1
ens33 ethernet 未托管 --
lo loopback 未托管 --
//启用连接
[root@localhost network-scripts]# nmcli con up bond0
成功激活(主服务器等待从服务器)连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/10)[root@localhost network-scripts]# nmcli con up bond-slave0
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/13)[root@localhost network-scripts]# nmcli con up bond-slave1
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/14)
[root@localhost network-scripts]#
//验证
查看bond的配置信息
[root@localhost network-scripts]# 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): 0Slave Interface: ens38 //ens38为开启状态
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:6a
Slave queue ID: 0Slave Interface: ens39 //ens39也是开启状态
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0//将ens38 down掉(断开)
[root@localhost ~]# nmcli device discon ens38
成功断开设备 'ens38'。//网络状态中ens38已断开
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond0 bond 连接的 bond0
ens39 ethernet 连接的 bond-slave1
ens38 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 -- //再次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): 0Slave Interface: ens39 //ens38已经没了,只有ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0
[root@localhost ~]# //把ens38启动
[root@localhost ~]# nmcli dev con ens38
成功用 'ens38' 激活了设备 'b6b4a54b-1a63-426d-a59a-c03a06231b68'。//查看网络状态ens38已连接
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond0 bond 连接的 bond0
ens38 ethernet 连接的 bond-slave0
ens39 ethernet 连接的 bond-slave1 //查看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): 0Slave Interface: ens39 //ens39还在
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0Slave Interface: ens38 //ens38已经起来了
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:6a
Slave queue ID: 0
Centos7/RHEL7配置bond1
//添加bond1模式为active-backup(高可用)
[root@localhost ~]# nmcli con add type bond mode active-backup con-name bond1 ifname bond1 ipv4.method manual ipv4.addresses 192.168.100.96/24 ipv4.gateway 192.168.100.254 ipv4.dns 192.168.100.254
连接“bond1”(fbf28be4-3db2-460c-9699-c7fce1f982e2) 已成功添加。
查看网络状态
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond1 bond 连接的 bond1 //bond1已连接
ens38 ethernet 已断开 --
ens39 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 --
//添加物理网卡连接至bond1
[root@localhost ~]# nmcli con add type bond-slave con-name bond-a ifname ens38 master bond1 //添加ens38至bond1,连接的名字bond-a(配置文件的name) 网卡的名字ens38(配置文件的device)
连接“bond-a”(c528b036-8c9f-4459-8ab7-5604306a18e5) 已成功添加。[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond1 bond 连接的 bond1
ens38 ethernet 连接的 bond-a
ens39 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 -- [root@localhost network-scripts]# nmcli con add type bond-slave con-name ens39 ifname ens39 master bond1 //添加ens39至bond1,类型为bond-slave,链接名字ens39,网卡名字ens39
连接“ens39”(f721d815-1a04-483d-a38d-4deaee156611) 已成功添加。
[root@localhost network-scripts]# nmcli dev
设备 类型 状态 连接
bond1 bond 连接的 bond1
ens38 ethernet 连接的 bond-a
ens39 ethernet 连接的 ens39
ens33 ethernet 未托管 --
lo loopback 未托管 --
//激活链接:
[root@localhost ~]# nmcli con up bond1
成功激活(主服务器等待从服务器)连接(D-Bus 激活路径:/org/freedesktop/NetworkManager/ActiveConnection/4)[root@localhost ~]# nmcli con up bond-a
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/7)[root@localhost ~]# nmcli con up ens39
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/8)
//验证:
查看bond的配置信息 cat /proc/net/bonding/bond1
[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: ens38 //当前活动的是ens38
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0Slave Interface: ens38
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:6a
Slave queue ID: 0Slave Interface: ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0
//down掉ens38
[root@localhost ~]# nmcli dev discon ens38
成功断开设备 'ens38'。[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond1 bond 连接的 bond1
ens39 ethernet 连接的 ens39
ens38 ethernet 已断开 --
ens33 ethernet 未托管 --
lo loopback 未托管 --
//再次查看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: ens39 //当前活跃的是ens39这块网卡
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0Slave Interface: ens39 //而ens38这块网卡断掉后信息就没了
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0
//再次启用ens38这块网卡的链接
[root@localhost ~]# nmcli con up bond-a
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/9)
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
bond1 bond 连接的 bond1
ens38 ethernet 连接的 bond-a
ens39 ethernet 连接的 ens39
ens33 ethernet 未托管 --
lo loopback 未托管 --
//再次查看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: ens39 //ens39是活跃的
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0Slave Interface: ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:74
Slave queue ID: 0Slave Interface: ens38 //ens38回来了
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:0f:a6:6a
Slave queue ID: 0
Centos6/RHEL6配置bond聚合链路
适用于RedHat6
以及CentOS6
系统 | 网卡 | bond地址 | bond模式 | bond功能 |
---|---|---|---|---|
Centos6.5 | eth0: 172.16.12.128 eth1: 172.16.12.129 | 172.16.12.250 | 模式0 | 负载均衡 |
//1.创建绑定网卡配置文件
[root@wyh ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
IPADDR=172.16.12.250
NETMASK=255.255.255.0
GATEWAY=172.16.12.2
DNS1=172.16.12.2
BONDING_OPTS="mode=0 miimon=50" //如果使用模式1将mode修改为1即可//2.修改eth0和eth1网卡配置文件
[root@wyh ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@wyh ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
MASTER=bond0
SLAVE=yes//3.添加驱动支持bond0
[root@wyh ~]# vim /etc/modprobe.d/bonding.conf
alias bond0 bonding
Centos7/RHEL7配置team聚合链路
centos/rhce7
使用teaming
实现聚合链路,能够提供网卡绑定之后的网络吞吐性能,并且提供网卡的故障切换处理能力。
Team
是基于一个小型内核驱动实现聚合链路,在用户层提供teamd
命令实现链路管理。
teamd
可以实现以下模式的聚合链路
broadcast 广播容错
roundrobin 负载轮询
activebackup 主备(必考)
loadbalance 负载均衡
lacp 需要交换机支持lacp协议
//创建team0:
[root@localhost ~]# nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' ipv4.addresses 192.168.100.250/24 ipv4.gateway 192.168.100.254 ipv4.dns 114.114.114.114 ipv4.method manual
连接“team0”(cae0a7dc-c9db-473b-bf5d-b6a9de8ade1b) 已成功添加。//将物理网卡加入team0中:
[root@localhost ~]# nmcli con add type team-slave con-name ens38 ifname ens38 master team0
连接“ens38”(5e38d849-9783-445e-9498-35ba76c947fa) 已成功添加。
[root@localhost ~]# nmcli con add type team-slave con-name ens39 ifname ens39 master team0
连接“ens39”(3e5af9e6-a9b3-41ea-afeb-2c8180fecf90) 已成功添加。
[root@localhost ~]# nmcli dev
设备 类型 状态 连接
ens38 ethernet 连接的 ens38
ens39 ethernet 连接的 ens39
team0 team 连接的 team0
ens33 ethernet 未托管 --
lo loopback 未托管 -- //将其中一块网卡断掉后测试:
[root@localhost ~]# nmcli dev discon ens39
成功断开设备 'ens39'。
[root@localhost ~]# teamdctl team0 state
setup:runner: activebackup //高可用模式
ports:ens38 link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0
runner:active port: ens38 //正在使用的是ens38//把ens39网卡起来,然后查看team0的配置信息
[root@localhost ~]# nmcli dev con ens39
成功用 'ens39' 激活了设备 '3e5af9e6-a9b3-41ea-afeb-2c8180fecf90'。
[root@localhost ~]# teamdctl team0 state
setup:runner: activebackup //使用的是高可用模式
ports:ens38link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0ens39 //起来了ens39link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0
runner:active port: ens38 //目前用的还是ens38
动态修改team模式
// 导出配置进行修改 (man teamd.conf)
[root@wangqing ~]# teamdctl team0 config dump > /tmp/team.conf
[root@wangqing ~]# vim /tmp/team.conf
{"device": "team0","hwaddr": "1A:E1:49:D1:02:AF","mcast_rejoin": {"count": 1},"notify_peers": {"count": 1},"ports": {"ens38": {"link_watch": {"name": "ethtool"}},"ens39": {"link_watch": {"name": "ethtool"}}},"runner": {"name": "loadbalance", //此处将avtivebackup改为loadbalance"tx_hash": ["eth","ipv4","ipv6"]}
}//以最新修改的配置选项修改team0属性
[root@wyh ~]# nmcli con mod team0 team.config /tmp/team.conf//修改之后需要重启team0
[root@wyh ~]# nmcli connection down team0;nmcli connection up team0
[root@wyh ~]# nmcli connection up ens38
[root@wyh ~]# nmcli connection up ens39[root@localhost ~]# teamdctl team0 stat
setup:runner: loadbalance //现在使用的是loadbalance负载均衡模式
ports:ens38link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0ens39link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0
桥接网络配置
创建桥接网络br1
[root@wyh ~]# nmcli connection add type bridge con-name br1 ifname br1 ipv4.addresses 192.168.56.222/24 ipv4.method manual桥接至eth1
[root@wyh ~]# nmcli connection add type bridge-slave con-name br1-prot1 ifname eth1 master br1//[root@wyh~]# ping -I br1 192.168.56.1
//[root@wyh ~]# brctl show
网络检测工具与故障排查
ping
ping
命令的目的在于测试另一台主机是否可达, 如果ping不到某台主机,就说明对方主机已经出现了问题, 但是不排除由于链路中的防火墙、ping被丢弃等原因造成ping不通的情况
//ping命令常用选项:-c 指定ping的次数-i 指定ping包的发送间隔-w 如果ping没有回应, 则在指定超时时间后退出
host与nslookup
host/nslookup
命令用于查询DNS记录
[root@localhost ~]# host www.baidu.com
www.baidu.com is an alias for www.a.shifen.com.
www.a.shifen.com has address 119.75.216.20
www.a.shifen.com has address 119.75.213.61[root@localhost ~]# nslookup www.baidu.com
Server: 172.16.12.2
Address: 172.16.12.2#53Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 119.75.213.61
Name: www.a.shifen.com
Address: 119.75.216.20
traceroute
traceroute
命令用于路由跟踪, 检测网络故障出现在ISP运营商或是对端服务无法响应
[root@wyh ~]# traceroute www.baidu.com
traceroute to www.baidu.com (119.75.213.61), 30 hops max, 60 byte packets1 gateway (192.168.1.1) 1.838 ms 1.749 ms 1.654 ms2 49.222.80.1 (49.222.80.1) 2.506 ms 7.196 ms 7.133 ms3 * * *4 * * *5 * * *
netstat
netstat
用于查看网络状态
//显示路由表
[root@wyh~]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default gateway 0.0.0.0 UG 0 0 0 ens33
172.16.12.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33//以数字方式显示路由表
[root@wyh ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 172.16.12.2 0.0.0.0 UG 0 0 0 ens33
172.16.12.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33//显示建立的tcp连接
[root@wyh ~]# netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 seancheng:ssh 172.16.12.1:56187 ESTABLISHED
tcp 0 0 seancheng:ssh 172.16.12.1:53808 ESTABLISHED//显示udp连接
[root@wyh ~]# netstat -u
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
[root@wyh ~]# //显示监听状态的连接
[root@wyh ~]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN//显示监听指定的套接字的进程的进程号及进程名
[root@wyh ~]# netstat -p
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 seancheng:ssh 172.16.12.1:56187 ESTABLISHED 2094/sshd: root@pts
tcp 0 0 seancheng:ssh 172.16.12.1:53808 ESTABLISHED 1077/sshd: root@pts//显示所有状态的连接
[root@wyh ~]# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp 0 0 seancheng:ssh 172.16.12.1:56187 ESTABLISHED
tcp 0 0 seancheng:ssh 172.16.12.1:53808 ESTABLISHED
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
udp 0 0 0.0.0.0:23511 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp6 0 0 [::]:35299 [::]:* //常用选项-antlp[root@wyh ~]# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 889/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1007/master
tcp 0 0 172.16.12.128:22 172.16.12.1:56187 ESTABLISHED 2094/sshd: root@pts
tcp 0 0 172.16.12.128:22 172.16.12.1:53808 ESTABLISHED 1077/sshd: root@pts
tcp6 0 0 :::22 :::* LISTEN 889/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1007/master
ss
ss
是一种网络状态查看工具,取代netstat
//语法:ss [options] [ FILTER ]
//常用的options:-t:tcp协议相关-u:udp协议相关-w:裸套接字相关-x:unix套接字相关-l:listen状态的连接-a:所有-n:数字格式-p:相关的程序及pid-e:扩展的信息-m:内存用量-o:显示计时器信息//常见的FILTER:FILTER := [ state TCP-STATE ] [ EXPRESSION ]如:ss -tan state ESTABLISHED//常见的state://tcp finite state machine:有限状态机LISTEN:监听ESTABLISHED:已建立的连接//EXPRESSION:dport =sport =示例:'( dport = :ssh or sport = :ssh)',此处的ssh也即服务名可以使用其对应的端口号代替,等号两边必须有空格//常用组合:
[root@wyh ~]# ss -tan
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
ESTAB 0 0 172.16.12.128:22 172.16.12.1:56187
ESTAB 0 0 172.16.12.128:22 172.16.12.1:53808
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::* [root@wyh ~]# ss -tanl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::* [root@wyh~]# ss -antlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:* users:(("sshd",pid=889,fd=3))
LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1007,fd=13))
LISTEN 0 128 :::22 :::* users:(("sshd",pid=889,fd=4))
LISTEN 0 100 ::1:25 :::* users:(("master",pid=1007,fd=14))[root@wyh ~]# ss -anu
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:23511 *:*
UNCONN 0 0 *:68 *:*
UNCONN 0 0 :::35299 :::* //常见端口
http 80/tcp
https 443/tcp
ssh 22/tcp
ftp 20,21/tcp
mysql 3306/tcp
rsync 873/rsync
redis 6379/tcp
网络故障排查
- 网络故障分为硬件/软件故障
- 网卡损坏
- 链路故障
- 网卡驱动不兼容
- 网络排查思路
- ping本地回环口, 确定本机TCP/IP协议栈是否正常
- ping本机IP地址, 确定本地设备以及驱动是否正常
- ping同网段主机, 确定二层网络是否正常工作
- ping网关地址, 确定本地与网络是否正常
- ping公网地址, 确定本地路由是否正常
- ping公网域名, 确定DNS客户端是否正常
- 服务故障排查思路
- 使用telnet检测端口是否开放
- 检查服务端防火墙以及SElinux
- 检查相应的权限是否配置正常
- 检查日志是否有异常
- 检查完毕后持续测试
建议:
所有的排查思路都从OSI七层模型由下往上逐一进行排查(学会看日志)
linux网络管理(链路聚合、桥接网络、故障排查、常用工具)相关推荐
- 简单局域网网络故障排查和处置
简单局域网网络故障排查和处置 一.了解基本网络构成 1. IP传输通信图 2.有线网络 (一)物理层面 (1)网线 (2)网线的制作 (3)网卡接口 (4)光纤 (5)光纤接口 (6)收发器 (7)集 ...
- Linux系统配置链路聚合
Linux系统配置链路聚合 配置链路聚合 1.添加聚合,指定类型为team 配置链路聚合 链路聚合:指将多个物理端口汇聚在一起,形成一个逻辑端口,以实现出/入流量吞吐量在各成员端口的负荷分担,交换机根 ...
- K8S集群中Pod与Pod之间网络故障排查思路
K8S集群中Pod与Pod之间网络故障排查思路 文章目录 K8S集群中Pod与Pod之间网络故障排查思路 1.Pod与Pod之间通信故障 2.Pod与Pod之间网络通信故障排查思路 1.Pod与Pod ...
- 交换机链路聚合在网络中的作用
交换机链路聚合在网络中的作用 分类: 系统运维 链路聚合有成端口聚合,断口捆绑,英文名port trunking.功能是将交换机的多个低带宽端口捆绑成一条高带宽链路,可以实现链路负载平衡.避免链路出 ...
- Kail Linux渗透测试教程之网络扫描和嗅探工具Nmap
Kail Linux渗透测试教程之网络扫描和嗅探工具Nmap 网络扫描和嗅探工具--Nmap Nmap也就网络映射器(Network Mapper),是一个免费开放的网络扫描和嗅探工具.该工具可以扫描 ...
- 网站故障排查常用命令
为什么80%的码农都做不了架构师?>>> 整理总结了一些常用分析网站的命令方便大家快速定位故障所在排除故障,最小化的减少故障给业务带来的影响. 1.查看TCP连接状态 nets ...
- 高级网络配置(包括链路聚合和网络桥接)
1.网卡的链路聚合 网卡的链路聚合就是将多块网卡连接起来,当一块网卡损坏,网络依旧可以正常运行 可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度 网卡的链路聚合一般常用的有" ...
- Linux网络故障排查命令(ifconfig、ping、telnet、netstat、lsof、nc、curl、tcpdump)
目录 ifconfig -s,显示网卡信息的精简列表 -a.up.down 将IP地址绑定到某个网卡,以及解绑操作 ping telnet netstat lsof nc 模拟一个服务器程序和客户端程 ...
- linux网络95值工具,Linux下网络故障排查工具之ping|traceroute和tcptraceroute|mtr工具
服务器运维人员在日常运维服务器的过程中经常会遇到服务器网络故障,有服务器硬件造成的,也有服务商网络问题造成的,也有区域网络问题造成的,这个时候就需要用到ping,traceroute,mtr这三个命令 ...
- 【Linux网卡链路聚合】
目录 前言 网卡链路聚合方法 一.添加网卡 二.配置链路聚合网卡 模拟测试 前言 如今,手机早已经是双卡双待,甚至是多卡多带了.对于Linux这种大多用做服务器的系统来说,必须要满足在生产环境中提供7 ...
最新文章
- bash . dot using
- [基础]Linux文件说明
- 先驱者? 革新者? 再谈《超级马力欧64》的设计魅力
- UI Blue crystall class sap_bluecrystal is added here to html node
- filter operation implementation in Gateway framework
- [Bash]kill指定的进程名
- mysql8.0 安装_MySQL8.0安装步骤
- Python io – BytesIO,StringIO
- Flink流式计算在节省资源方面的简单分析
- GDI+中发生一般性错误的解决办法(转)
- IT桌面运维常识系列 -(Windows部署服务 - 01)
- 【场景化解决方案】金蝶凭证信息与OA审批集成
- linux文件权限说明(drwxr-xr-x)
- fdisk分区以及格式化磁盘简要步骤
- 使用conda管理python环境
- 深度清理C盘之非常有用
- 人工智能学习——神经网络(matlab+python实现)
- 达索系统推出汽车项目智能看板行业解决方案体验
- 循环语句介绍(笔记学习)
- 类似 毕克BYK346 有机硅基材润湿剂 上海荟研 水性木器漆,水性工业漆 油墨体系 光固化体系
热门文章
- [874]python图片转字符串
- java毕业生设计中小型酒店客房预订系统计算机源码+系统+mysql+调试部署+lw
- [浙大网新易盛] 程序员你12点前睡觉了吗?
- 我北某何惧,一下送30本,亲笔签名+书签
- Linux如何挂载USB、硬盘、光驱、软驱
- 8个数,分成四组,每两个为一组,有多少种分法?
- 自考总结 数据库系统原理
- 基于JAVAMVC的时鲜蔬菜配送系统计算机毕业设计源码+系统+lw文档+部署
- 软件测试职业发展规划图
- 借助ChatGPT爆火,股价暴涨又暴跌后,C3.ai仍面临巨大风险