批量查看服务器的FC HBA卡wwn地址和端口状态

方法一:

[root@langchao048 ~]# for i in 0 1 2 3 4 5; do cat /sys/class/fc_host/host$i/port_name; done
cat: /sys/class/fc_host/host0/port_name: No such file or directory
0x10000090fae416b3
0x10000090fae416b7
0x10000090fadf84c5
0x10000090fadf84c9
cat: /sys/class/fc_host/host5/port_name: No such file or directory

继续阅读“批量查看服务器的FC HBA卡wwn地址和端口状态”

linux文件确定改动时间的实践

使用到stat命令,如 stat /etc/hosts

ansible批量执行 stat /etc/hosts

修改前==========================================================
10.10.74.4 | success | rc=0 >>
#stat /etc/hosts
File: `/etc/hosts’
Size: 158 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 46 Links: 1
Access: (0644/-rw-r–r–) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2017-07-24 10:34:08.157207600 +0800
Modify: 2010-01-12 21:28:22.000000000 +0800
Change: 2016-11-21 10:20:18.207453325 +0800 继续阅读“linux文件确定改动时间的实践”

VMware新增、扩展磁盘如何不需重启系统

1、Vmware虚拟磁盘扩容

方法1:echo 1 > /sys/class/scsi_device/$DEVICE/device/rescan $DEVICE以实际为准

方法2:重新扫描特定的 SCSI Device
echo 1 > /sys/block/$DEVICE/device/rescan 用sda, sdb, sdc等替换$DEVICE

2、Vmware新增虚拟磁盘
[root@localhost ~]# grep mpt /sys/class/scsi_host/host?/proc_name
/sys/class/scsi_host/host0/proc_name:mptspi

echo “- – -” > /sys/class/scsi_host/host0/scan

3、Vmware虚拟磁盘扩容(更新LVM的PV大小)
对vmware硬盘容量扩容后,例如500G改成800G,不重启更新操作系统的PV大小
echo 1 > /sys/block/sdc/device/rescan
pvresize /dev/sdc

iptables 端口转发

第一步先开启ip转发

echo 1 > /proc/sys/net/ipv4/ip_forward

1、单网卡

单网卡,访问10.10.10.1:8888 相当于访问 11.11.11.1:80
iptables -t nat -A PREROUTING -d 10.10.10.1 -p tcp –dport 8888 -j DNAT –to-destination 11.11.11.1:80
iptables -t nat -A POSTROUTING -d 11.11.11.1 -p tcp –dport 80 -j SNAT –to 10.10.10.1

单网卡,192.168.1.2端口5555转发到192.168.1.189端口22
iptables -t nat -A PREROUTING -d 192.168.1.2 -p tcp –dport 5555 -j DNAT –to-destination 192.168.1.189:22
iptables -t nat -A POSTROUTING -d 192.168.1.189 -p tcp –dport 22 -j SNAT –to 192.168.1.2
这两句根据具体情况酌情添加:
iptables -A FORWARD -o eth0 -d 192.168.1.189 -p tcp –dport 22 -j ACCEPT
iptables -A FORWARD -i eth0 -s 192.168.1.189 -p tcp –sport 22 -j ACCEPT

继续阅读“iptables 端口转发”

pam_tally.so缺失的问题

经常有主机message日志有如下报错:
Oct 14 10:00:20 fst_svc_2 sudo: PAM unable to dlopen(/lib64/security/pam_tally.so): /lib64/security/pam_tally.so: cannot open shared object file: No such file or directory

Oct 14 10:00:20 fst_svc_2 sudo: PAM adding faulty module: /lib64/security/pam_tally.so

pam_tally.so没找到,pam_tally2.so却有,做软连接:
ln -s /lib64/security/pam_tally2.so /lib64/security/pam_tally.so

此时再登录,日志无报错。

Pages: Prev 1 2 3 4 5 6 7 8 9 10 ... 51 52 53 Next