1.创建逻辑卷
创建物理卷pvcreate /dev/sd{b1,c}创建卷组名vgcreate vg0 /dev/sd{b1,c} -s 4G创建逻辑卷lvcreate -n MysqL -L 8G vg0创建文件系统mkfs.xfs /dev/vg0/MysqL挂载mount /dev/vg0/MysqL /mnt/MysqL/扩展文件系统lvextend -l +1534 /dev/vg0/MysqL同步XFS文件系统xfs_growfs /mnt/MysqL/扩展逻辑卷VG0的大小vgextend vg0 /dev/sdd同步EXT系列的文件系统resize2fs /dev/vg0/binlog可以扩展的同时直接同步文件系统,一条命令完成。[[email protected] ~]#lvextend -r -l +500 /dev/vg0/MysqL缩减逻辑分区的大小,缩减只能缩减EXT系列的。先取消挂载。[[email protected] ~]#umount /mnt/biglog/检查文件的完整性e2fsck -f /dev/vg0/binlog缩减文件系统大小到10Gresize2fs /dev/vg0/binlog 10G缩减逻辑卷大小到10G,有风险,可能丢失数据[[email protected] ~]#lvreduce -L 10G /dev/vg0/binlog然后在挂载上,就可以完成缩减[[email protected] ~]#mount /dev/vg0/binlog /mnt/biglog/
2.迁移逻辑卷,先取消挂载
先禁用,[[email protected] ~]#vgchange -an vg0查看状态[[email protected] ~]#lvdisplay导出状态[[email protected] ~]#vgexport vg0就可以拔出硬盘了。插到新的机子上然后导入[[email protected] ~]#vgimport vg0启用,[[email protected] ~]#vgchange -ay vg0然后挂载就可以使用了。
3.移出逻辑卷的硬盘
增加物理卷[[email protected] ~]#pvcreate /dev/sdb4加到VG0里[[email protected] ~]#vgextend vg0 /dev/sdb4把sdc上的迁移到其他地方[[email protected] ~]#pvmove /dev/sdc把sdc移出VG0[[email protected] ~]#vgreduce vg0 /dev/sdc把上面的物理卷标识去掉,现在就是一块普通硬盘了[[email protected] ~]#pvremove /dev/sdc
4.删除逻辑卷
[[email protected] ~]#umount /mnt/MysqL/[[email protected] ~]#lvremove /dev/vg0/MysqL [[email protected] ~]#vgremove vg0[[email protected] ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb1 lvm2 --- 4.00g 4.00g /dev/sdb3 lvm2 --- 2.00g 2.00g /dev/sdb4 lvm2 --- 5.00g 5.00g /dev/sdd lvm2 --- 20.00g 20.00g[[email protected] ~]#pvremove /dev/sdd
5.创建逻辑卷快照和使用。xfs文件系统的。
-n 名字 -s 逻辑卷标志 -L 逻辑卷大小 -p r 只读属性 最后指定是谁的快照。只读不可以挂载,和原来的UUID一样。强行挂载要不是只读模式, -o nouuID 不检查UUID[[email protected] ~]#lvcreate -n MysqL_snapshot -s -L 1G -p r /dev/vg0/MysqL[[email protected] ~]#mount -o nouuID /dev/vg0/MysqL_snapshot2 /mnt/snap/还原快照。逻辑卷快照消失,只能使用一次。[[email protected] ~]#umount /mut/snap/[[email protected] ~]#umount /mnt/MysqL[[email protected] ~]#lvconvert --merge /dev/vg0/MysqL_sanpshot
ext系列不存在UUID重复的情况,快照也可以只读
6.创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小为16MB,而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
[[email protected] ~]#pvcreate /dev/sd{c,d1}[[email protected] ~]#pvdisplay "/dev/sdd1" is a new physical volume of "10.00 GiB" --- NEW Physical volume --- PV name /dev/sdd1 VG name PV Size 10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID NYoBim-Wdxw-Bhak-hOiN-1WpU-2oOJ-2uzmPT "/dev/sdc" is a new physical volume of "10.00 GiB" --- NEW Physical volume --- PV name /dev/sdc VG name PV Size 10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID dIJhEo-YoxY-PGwh-Y1NS-17w2-UWcB-D25ABX [[email protected] ~]#vgcreate testvg /dev/sd{c,d1} -s 16MB Volume group "testvg" successfully created
[[email protected] ~]#vgdisplay --- Volume group --- VG name testvg System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size <19.97 GiB PE Size 16.00 MiB Total PE 1278 Alloc PE / Size 0 / 0 Free PE / Size 1278 / <19.97 GiB VG UUID Gy8wH6-XIDI-D69o-pMiy-i8OX-P03i-HtjH72
[[email protected] ~]#lvcreate -n testlv -L 5G testvg WARNING: xfs signature detected on /dev/testvg/testlv at offset 0. Wipe it? [y/n]: y WiPing xfs signature on /dev/testvg/testlv. Logical volume "testlv" created.[[email protected] ~]#lvdisplay --- Logical volume --- LV Path /dev/testvg/testlv LV name testlv VG name testvg LV UUID wkn8n8-B2GI-Aqf4-gTWz-tg8E-4bF5-YkAF01 LV Write Access read/write LV Creation host,time centos7.5.localdomain,2019-08-11 22:00:57 +0800 LV Status available # open 0 LV Size 5.00 GiB Current LE 320 Segments 1 Allocation inherit Read ahead sectors @R_301_6843@ - currently set to 8192 Block device 253:0
[[email protected] ~]#mkfs.ext4 /dev/testvg/testlv mke2fs 1.42.9 (28-Dec-2013)filesystem label=OS type: linuxBlock size=4096 (log=2)Fragment size=4096 (log=2)StrIDe=0 blocks,Stripe wIDth=0 blocks327680 inodes,1310720 blocks65536 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=134217728040 block groups32768 blocks per group,32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks: 32768,98304,163840,229376,294912,819200,884736Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done
[[email protected] ~]#mount /dev/testvg/testlv /users
7.新建用户archlinux,要求其家目录为/users/archlinux,而后su切换至archlinux用户,复制/etc/pam.d目录至自己的家目录
[[email protected] ~]$cp -r /etc/pam.d/ ./[[email protected] ~]$lltotal 4drwxr-xr-x 2 archlinux archlinux 4096 Aug 11 22:09 pam.d[[email protected] ~]$pwd/users/archlinux
8.扩展testlv至7G,要求archlinux用户的文件不能丢失
[[email protected] ~]#lvextend -r -L +2G /dev/testvg/testlv Size of logical volume testvg/testlv changed from 5.00 GiB (320 extents) to 7.00 GiB (448 extents). Logical volume testvg/testlv successfully resized.resize2fs 1.42.9 (28-Dec-2013)filesystem at /dev/mapper/testvg-testlv is mounted on /users; on-line resizing requiredold_desc_blocks = 1,new_desc_blocks = 1The filesystem on /dev/mapper/testvg-testlv is Now 1835008 blocks long.[[email protected] ~]#lvdisplay --- Logical volume --- LV Path /dev/testvg/testlv LV name testlv VG name testvg LV UUID wkn8n8-B2GI-Aqf4-gTWz-tg8E-4bF5-YkAF01 LV Write Access read/write LV Creation host,2019-08-11 22:00:57 +0800 LV Status available # open 1 LV Size 7.00 GiB Current LE 448 Segments 1 Allocation inherit Read ahead sectors @R_301_6843@ - currently set to 8192 Block device 253:0
9.收缩testlv至3G,要求archlinux用户的文件不能丢失
[[email protected] ~]#umount /users[[email protected] ~]#resize2fs /dev/testvg/testlv 3Gresize2fs 1.42.9 (28-Dec-2013)Please run ‘e2fsck -f /dev/testvg/testlv‘ first.[[email protected] ~]#e2fsck -f /dev/testvg/testlve2fsck 1.42.9 (28-Dec-2013)Pass 1: Checking inodes,blocks,and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/dev/testvg/testlv: 70/458752 files (0.0% non-contiguous),67380/1835008 blocks[[email protected] ~]#resize2fs /dev/testvg/testlv 3Gresize2fs 1.42.9 (28-Dec-2013)Resizing the filesystem on /dev/testvg/testlv to 786432 (4k) blocks.The filesystem on /dev/testvg/testlv is Now 786432 blocks long.[[email protected] ~]#lvreduce -L 3G /dev/testvg/testlv WARNING: Reducing active logical volume to 3.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.)Do you really want to reduce testvg/testlv? [y/n]: y Size of logical volume testvg/testlv changed from 7.00 GiB (448 extents) to 3.00 GiB (192 extents). Logical volume testvg/testlv successfully resized.[[email protected] ~]#mount /dev/testvg/testlv /users
10.对testlv创建快照,并尝试基于快照备份数据,验证快照的功能
-p r 设置只读模式,忘记添加了[[email protected] ~]#lvcreate -L 1G -s -n snap1 /dev/testvg/testlv[[email protected] ~]#umount /users[@L_419_45@ ~]#lvdisplay --- Logical volume --- LV Path /dev/testvg/testlv LV name testlv VG name testvg LV UUID wkn8n8-B2GI-Aqf4-gTWz-tg8E-4bF5-YkAF01 LV Write Access read/write LV Creation host,2019-08-11 22:00:57 +0800 LV snapshot status source of snap1 [active] LV Status available # open 0 LV Size 3.00 GiB Current LE 192 Segments 1 Allocation inherit Read ahead sectors @R_301_6843@ - currently set to 8192 Block device 253:0 --- Logical volume --- LV Path /dev/testvg/snap1 LV name snap1 VG name testvg LV UUID KdGZPM-BqYW-GxDz-bOor-fmNE-Isdh-T7hsHo LV Write Access read/write LV Creation host,2019-08-11 22:23:36 +0800 LV snapshot status active destination for testlv LV Status available # open 0 LV Size 3.00 GiB Current LE 192 COW-table size 1.00 GiB COW-table LE 64 Allocated to snapshot 0.01% Snapshot chunk size 4.00 KiB Segments 1 Allocation inherit Read ahead sectors @R_301_6843@ - currently set to 8192 Block device 253:3[[email protected] ~]#lvconvert --merge /dev/testvg/snap1 Merging of volume testvg/snap1 started. testvg/testlv: Merged: 100.00%
11.Ethernet II以太网帧格式:
目标MAC 源MAC 类型 数据 FCS6字节 6字节 2字节 46-1500字节 4字节所以最小6+6+2+46+4 = 64,最大6+6+2+1500+4 = 1518。(注:ISL封装后可达1548字节,802.1Q封装后可达1522字节)
12.?正则表达式匹配邮件地址和?站?
egrep "[[:alnum:] ][email protected][[:alnum:]]+\.com"egrep "^([a-zA-Z0-9_-\.]([a-zA-Z0-9_-]{0,61}[a-zA-Z0-9_-])?\.)+[a-zA-Z]{1,6}$"
13.查看端口被那几个应用占用
[[email protected] ~]#ss -ntlp |grep 22ListEN 0 5 192.168.122.1:53 *:* users:(("dnsmasq",pID=7269,fd=6))ListEN 0 128 *:22 *:* users:(("sshd",pID=6780,fd=3))ListEN 0 128 :::22 :::* users:(("sshd",fd=4))[[email protected] ~]#lsof -i :22COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE namesshd 6780 root 3u IPv4 43799 0t0 TCP *:ssh (ListEN)sshd 6780 root 4u IPv6 43801 0t0 TCP *:ssh (ListEN)sshd 11386 root 3u IPv4 97622 0t0 TCP 192.168.38.103:ssh->192.168.38.1:61967 (ESTABliSHED)sshd 15611 root 3u IPv4 149223 0t0 TCP 192.168.38.103:ssh->192.168.38.1:64099 (ESTABliSHED)sshd 16049 root 3u IPv4 152899 0t0 TCP 192.168.38.103:ssh->192.168.38.1:64967 (ESTABliSHED)sshd 16283 root 3u IPv4 155757 0t0 TCP centos7.6.localdomain:ssh->172.18.1.77:65180 (ESTABliSHED)
14.用户改名
修改文件[[email protected] ~]#vim /etc/sysconfig/networkHOSTname=7.6centos.localdomain [[email protected] ~]#hostname 7.6centos.localdomain[[email protected] ~]#exit在这个地方添加新的名字,防止自己Ping不通自己[[email protected] ~]#vim /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 7.6centos.localdomain[[email protected] ~]#Ping 7.6centos.localdomain
15.配置eth1?卡地址为1.1.1.1/24
直接就改了[[email protected] ~]#ifconfig eth1 172.18.7.7/24 up
[[email protected] ~]#ifconfig eth1 1.1.1.1 netmask 255.255.255.0
16.激活eth1?卡,关闭网卡
[[email protected] ~]#ifconfig eth1 down[[email protected] ~]#ifconfig eth1 up
17.配置eth1的?卡别名为eth1:0,ip为10.0.0.100
[[email protected] ~]#ifconfig eth1:0 10.0.0.100/24 up[[email protected] ~]#ifconfig eth1:0eth1:0: flags=4163<UP,broADCAST,RUNNING,MulTICAST> mtu 1500 inet 10.0.0.100 netmask 255.255.255.0 broadcast 10.0.0.255 ether 00:0c:29:a3:3e:ce txqueuelen 1000 (Ethernet)[[email protected] ~]#ifconfig eth1:0 10.0.0.100/24 down
17.添加到1.1.1.1的主机路由,下?跳为172.18.0.1
[[email protected] ~]#route add -host 1.1.1.1 gw 172.18.0.1[[email protected] ~]#route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.18.0.1 0.0.0.0 UG 100 0 0 eth00.0.0.0 172.18.0.1 0.0.0.0 UG 101 0 0 eth11.1.1.1 172.18.0.1 255.255.255.255 UGH 0 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 100 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 101 0 0 eth1192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
18.删除主机路由1.1.1.1
[[email protected] ~]#route del -host 1.1.1.1[[email protected] ~]#route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.18.0.1 0.0.0.0 UG 100 0 0 eth00.0.0.0 172.18.0.1 0.0.0.0 UG 101 0 0 eth1172.18.0.0 0.0.0.0 255.255.0.0 U 100 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 101 0 0 eth1192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
19.添加到1.1.1.0/24的?络路由,下?跳为172.18.0.1
[[email protected] ~]#route add -net 1.1.1.0/24 gw 172.18.0.1 dev eth0[[email protected] ~]#route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.18.0.1 0.0.0.0 UG 100 0 0 eth00.0.0.0 172.18.0.1 0.0.0.0 UG 101 0 0 eth11.1.1.0 172.18.0.1 255.255.255.0 UG 0 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 100 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 101 0 0 eth1192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
20.添加到1.1.1.0/24的?络路由,下?跳为172.18.0.1
[[email protected] ~]#route add -net 1.1.1.0 netmask 255.255.255.0 gw 172.18.0.1 dev eth1
21.添加默认路由
[[email protected] ~]#route add -net 0.0.0.0 netmask 0.0.0.0 gw 172.18.0.1[[email protected] ~]#route add default gw 172.18.0.1
22.禁?ens38?卡
[[email protected] ~]#ip link set dev eth1 down
23.查看eth1?卡的状态
[[email protected] ~]#ip link show dev eth13: eth1: <broADCAST,MulTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAulT group default qlen 1000 link/ether 00:0c:29:a3:3e:ce brd ff:ff:ff:ff:ff:ff
24.启?eth1?卡
[[email protected] ~]#ip link set dev eth1 up[[email protected] ~]#ip link show[[email protected] ~]#ip link show dev eth13: eth1: <broADCAST,MulTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAulT group default qlen 1000 link/ether 00:0c:29:a3:3e:ce brd ff:ff:ff:ff:ff:ff
25.删除网卡地址和添加网卡地址
[[email protected] ~]#ip addr del 172.18.7.7 dev eth1Warning: Executing wildcard deletion to stay compatible with old scripts. Explicitly specify the prefix length (172.18.7.7/32) to avoID this warning. This special behavIoUr is likely to disappear in further releases,fix your scripts![[email protected] ~]#ip addr add 172.18.7.7/24 dev eth1
26.配置eth1?卡别名为ens38:0,地址为4.4.4.4/24和删除
[[email protected] ~]#ip addr add 4.4.4.4 dev eth1 label eth1:0eth1:0: flags=4163<UP,MulTICAST> mtu 1500 inet 4.4.4.4 netmask 255.255.255.255 broadcast 0.0.0.0 ether 00:0c:29:a3:3e:ce txqueuelen 1000 (Ethernet)[@L_301_79@ data]#ifconfig eth1:1 1.1.1.1/24[[email protected] ~]#ip add flush dev eth1 label eth1:0
27.删除eth1?卡上的使?ip地址和增加
[[email protected] ~]#ip addr flush dev eth1[[email protected] ~]#ip addr add 172.18.7.7 dev eth1
28.查看路由表
[[email protected] data]#ip route showdefault via 172.18.0.1 dev eth0 default via 172.18.0.1 dev eth0 proto static metric 100 1.1.1.0/24 via 172.18.0.1 dev eth0 172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.7.127 metric 100 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 [[email protected] data]#ip route Listdefault via 172.18.0.1 dev eth0 default via 172.18.0.1 dev eth0 proto static metric 100 1.1.1.0/24 via 172.18.0.1 dev eth0 172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.7.127 metric 100 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
29.添加?络路由192.168.0.0/24
[[email protected] data]#ip route add 192.168.0.0/24 via 172.18.0.1
30.添加默认?关和删除
[[email protected] data]#ip route add default via 172.18.0.1[[email protected] data]#route add default gw 172.18.0.1指定端口ip route add default via 172.18.0.1 dev eth0[[email protected] data]#ip route del default via 172.18.0.1[[email protected] data]#route del default gw 172.18.0.1 dev eth0
31.配置dns?件,地址为172.18.0.1,重启永久?效
[[email protected] data]#vim /etc/resolv.conf
32.查看tcp协议,?数?显?ip和端?,所有状态?络连接
[[email protected] data]#netstat -tanActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:111 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:6000 0.0.0.0:* ListEN tcp 0 0 192.168.122.1:53 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:22 0.0.0.0:* ListEN tcp 0 0 127.0.0.1:631 0.0.0.0:* ListEN tcp 0 0 127.0.0.1:25 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:37698 0.0.0.0:* ListEN tcp 0 0 172.18.7.7:22 172.18.1.77:56968 ESTABliSHEDtcp 0 52 172.18.7.127:22 172.18.1.77:51868 ESTABliSHEDtcp6 0 0 :::111 :::* ListEN tcp6 0 0 :::6000 :::* ListEN tcp6 0 0 :::80 :::* ListEN tcp6 0 0 :::46709 :::* ListEN tcp6 0 0 :::22 :::* ListEN tcp6 0 0 ::1:631 :::* ListEN tcp6 0 0 ::1:25 :::* ListEN
33.查看udp协议,?数?显?ip和端?,所有状态?络连接
[[email protected] data]#netstat -uanActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 0.0.0.0:967 0.0.0.0:* udp 0 0 127.0.0.1:1005 0.0.0.0:* udp 0 0 192.168.122.1:53 0.0.0.0:* udp 0 0 0.0.0.0:67 0.0.0.0:* udp 0 0 0.0.0.0:111 0.0.0.0:* udp 0 0 0.0.0.0:5353 0.0.0.0:* udp 0 0 0.0.0.0:50817 0.0.0.0:* udp 0 0 0.0.0.0:52965 0.0.0.0:* udp6 0 0 :::967 :::* udp6 0 0 :::111 :::* udp6 0 0 :::54851 :::*
34.查看tcp协议,?数?显?ip和端?,所有处于监听状态?络连接
[[email protected] data]#netstat -tnlActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:111 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:6000 0.0.0.0:* ListEN tcp 0 0 192.168.122.1:53 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:22 0.0.0.0:* ListEN tcp 0 0 127.0.0.1:631 0.0.0.0:* ListEN tcp 0 0 127.0.0.1:25 0.0.0.0:* ListEN tcp 0 0 0.0.0.0:37698 0.0.0.0:* ListEN tcp6 0 0 :::111 :::* ListEN tcp6 0 0 :::6000 :::* ListEN tcp6 0 0 :::80 :::* ListEN tcp6 0 0 :::46709 :::* ListEN tcp6 0 0 :::22 :::* ListEN tcp6 0 0 ::1:631 :::* ListEN tcp6 0 0 ::1:25 :::* ListEN
35.查看udp协议,?数?显?ip和端?,所有处于监听状态?络连接
[[email protected] data]#netstat -unlActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 0.0.0.0:967 0.0.0.0:* udp 0 0 127.0.0.1:1005 0.0.0.0:* udp 0 0 192.168.122.1:53 0.0.0.0:* udp 0 0 0.0.0.0:67 0.0.0.0:* udp 0 0 0.0.0.0:111 0.0.0.0:* udp 0 0 0.0.0.0:5353 0.0.0.0:* udp 0 0 0.0.0.0:50817 0.0.0.0:* udp 0 0 0.0.0.0:52965 0.0.0.0:* udp6 0 0 :::967 :::* udp6 0 0 :::111 :::* udp6 0 0 :::54851 :::*
36.显?所有接?统计数据
[[email protected] data]#netstat -iKernel Interface tableIface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flgeth0 1500 78298 0 0 0 6449 0 0 0 BMRUeth1 1500 44702 0 0 0 314 0 0 0 BMRUlo 65536 210 0 0 0 210 0 0 0 LRUvirbr0 1500 0 0 0 0 0 0 0 0 BMU
37.显?eth0接?是流量数据
[[email protected] data]#netstat -I=eth0Kernel Interface tableIface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flgeth0 1500 78518 0 0 0 6478 0 0 0 BMRU
[[email protected] data]#ifconfig -s eth0Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flgeth0 1500 78621 0 0 0 6502 0 0 0 BMRU
38.centos6重启?络服务和关闭NetworkManager服务
service network restartservice NetworkManager stop
39.查看具体路由信息
[[email protected] data]#traceroute www.baIDu.comtraceroute to www.baIDu.com (61.135.169.121),30 hops max,60 byte packets 1 gateway (172.18.0.1) 1.235 ms 1.118 ms 1.030 ms 2 192.168.0.1 (192.168.0.1) 0.918 ms 0.813 ms 0.728 ms 3 123.118.208.1 (123.118.208.1) 5.181 ms 5.068 ms 4.984 ms 4 114.244.95.105 (114.244.95.105) 4.177 ms 61.148.163.181 (61.148.163.181) 7.078 ms 61.148.163.81 (61.148.163.81) 4.690 ms 5 61.148.157.229 (61.148.157.229) 5.187 ms 3.714 ms 4.964 ms
[[email protected] data]#tracepath 114.114.114.114 1?: [LOCALHOST] pmtu 1500 1: gateway 3.093ms 1: gateway 1.891ms 2: 192.168.0.1 2.132ms 3: 192.168.0.1 2.609ms pmtu 1480 3: 123.118.208.1 18.058ms 4: 114.244.95.61 3.921ms 5: no reply 6: 125.33.186.5 16.844ms 7: 219.158.4.230 13.296ms ^C
[[email protected] data]#mtr www.baIDu.com
40.子网掩码不同,网络IP可能是会不一样的
A:192.168.38.100/25B:192.168.38.200/24A--->B192.168.38.100与255.255.255.128=192.168.38.0192.168.38.200与255.255.255.128=192.168.38.128不相同B--->A192.168.38.100与255.255.255.0=192.168.38.0192.168.38.200与255.255.255.0=192.168.38.0
41.高于DNS的名字解析,测试时用。改名字时最好后面也加一个。
[[email protected] data]#vim /etc/hosts
42.抓包。-nn转化为数字形式
[[email protected] network-scripts]#tcpdump -i eth0 -nn icmptcpdump: verbose output suppressed,use -v or -vv for full protocol decodeListening on eth0,link-type EN10MB (Ethernet),capture size 262144 bytes16:33:22.816999 IP 172.25.0.111 > 192.168.66.111: ICMP echo request,ID 6893,seq 55,length 6416:33:22.817030 IP 192.168.66.111 > 172.25.0.111: ICMP echo reply,length 64
43.查看最新日志。
[[email protected] data]#tail /var/log/messagesAug 17 16:34:32 centos7 avahi-daemon[6307]: InvalID legacy unicast query packet.Aug 17 16:34:32 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:32 centos7 avahi-daemon[6307]: InvalID legacy unicast query packet.Aug 17 16:34:32 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:32 centos7 avahi-daemon[6307]: InvalID legacy unicast query packet.Aug 17 16:34:32 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:33 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:34 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:34 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘Aug 17 16:34:36 centos7 avahi-daemon[6307]: Received response from host 172.18.144.184 with invalID source port 50556 on interface ‘eth0.0‘
44.Ping -l 指定从哪个网卡访问。
[[email protected] data]#Ping -l 172.18.7.7 114.114.114.114Ping 114.114.114.114 (114.114.114.114) 56(84) bytes of data.64 bytes from 114.114.114.114: icmp_seq=1 ttl=86 time=12.6 ms64 bytes from 114.114.114.114: icmp_seq=2 ttl=89 time=12.5 ms
45.-0.3秒查看一次网卡吞吐量 。-i必须和后面的连在一起,指定网卡
[[email protected] data]#watch -n0.3 netstart -leth0
46.centos6上支持补全的包。。。。。退出重进生效
yum install bash-completion
46.显示IP和mcp地址对应的关系
[[email protected]entos7 data]#arp -nAddress HWtype HWaddress Flags Mask Iface172.18.0.1 ether 14:6b:9c:bd:6b:cd C eth0172.18.1.77 ether 98:e7:f4:68:64:aa C eth0[[email protected] data]#ip neigh 172.18.0.1 dev eth0 lladdr 14:6b:9c:bd:6b:cd STALE172.18.1.77 dev eth0 lladdr 98:e7:f4:68:64:aa REACHABLE总结
以上是内存溢出为你收集整理的LVM、网络协议和管理全部内容,希望文章能够帮你解决LVM、网络协议和管理所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)