1
2
3
4
5
|
[root@localhost ~]
#yum -y install libpcap-devel ncurses-devel
[root@localhost ~]
# tar zxvf nethogs-0.8.0.tar.gz
[root@localhost ~]
# cd nethogs
[root@localhost nethogs]
# make && make install
[root@localhost nethogs]
# nethogs eth0
|
1
2
3
4
|
[root@localhost current]
# tar xvf iozone3_420.tar
[root@localhost ~]
# cd iozone3_420/src/current/
[root@localhost current]
# make linux
[root@localhost current]
# ./iozone -a -n 512m -g 16g -i 0 -i 1 -i 5 -f /mnt/iozone -Rb ./iozone.xls
|
1
2
3
4
5
6
|
[root@localhost ~]
# tar zxvf iftop-0.17.tar.gz
[root@localhost ~]
# cd iftop-0.17
[root@localhost iftop-0.17]
# ./configure
[root@localhost iftop-0.17]
# make && make install
[root@localhost iftop-0.17]
# iftop
[root@localhost iftop-0.17]
# iftop -i eth0 #指定监控网卡接口
|
1
2
3
|
[root@localhost ~]
# chmod +x nmon_x86_64_rhel6
[root@localhost ~]
# mv nmon_x86_64_rhel6 /usr/sbin/nmon
[root@localhost ~]
# nmon
|
1
2
3
4
|
[root@localhost ~]
# yum -y install multitail
[root@localhost ~]
# multitail -e "fail" /var/log/secure #筛选关键字进行监控
[root@localhost ~]
# multitail -l "ping baidu.com" #监控后面的命令-l将要执行的命令
[root@localhost ~]
# multitail -i /var/log/messages -i /var/log/secure #-i指定一个文件名
|
1
2
3
4
5
6
7
|
[root@localhost ~]
# cd fail2ban-0.8.11
[root@localhost fail2ban-0.8.11]
# python setup.py install
[root@localhost fail2ban-0.8.11]
# cd files/
[root@localhost files]
# cp ./redhat-initd /etc/init.d/fail2ban
[root@localhost files]
# service fail2ban start
[root@localhost files]
# chkconfig --add fail2ban
[root@localhost files]
# chkconfig fail2ban on
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[root@localhost ~]
# grep -v "^#" /etc/fail2ban/jail.conf | grep -v "^$"
[DEFAULT]
ignoreip = 127.0.0.1
/8
#忽略本机IP
bantime = 600
#符合规则后封锁时间
findtime = 600
#在多长时间内符合规则执行封锁如600秒达到3次则执行
maxretry = 3
#最大尝试次数
backend = auto
#日志修改检测日志gamin、polling和auto这三种
usedns = warn
[
ssh
-iptables]
enabled =
true
#默认是禁用false
filter = sshd
action = iptables[name=SSH, port=
ssh
, protocol=tcp]
# sendmail-whois[name=SSH,dest=收件人邮箱, sender=发件人邮箱, sendername="Fail2Ban"]
logpath =
/var/log/sshd
.log
#响应的错误日志一般在/var/log/secure
maxretry = 5
#尝试错误次数覆盖全局中的maxretry
|
1
2
3
4
5
6
7
8
|
[root@localhost ~]
# touch /var/log/sshd.log
[root@localhost ~]
# service fail2ban restart
[root@localhost ~]
# fail2ban-client status #查看监控已经开启
Status
|- Number of jail: 1
`- Jail list:
ssh
-iptables
[root@localhost ~]
# iptables -L #iptables过滤表有fail2ban一条规则
fail2ban-SSH tcp -- anywhere anywhere tcp dpt:
ssh
|
1
2
3
4
5
6
7
|
[root@localhost ~]
# yum -y install tmux
[root@localhost ~]
# tmux #打开tmux会话终端
离开当前会话先ctrl+b后再按d
[root@localhost ~]
# tmux ls #列出会话
[root@localhost ~]
# tmux a -t 编号/name #回到指定会话,exit关闭当前会话
[root@localhost ~]
# tmux new -s lamp #创建一个lamp会话名
[root@localhost ~]
# tmux kill-server #关闭所有终端
|
1
2
3
4
5
6
7
|
[root@localhost ~]
# tar zxvf agedu-r9723.tar.gz
[root@localhost ~]
# cd agedu-r9723
[root@localhost ~]
# ./configure
[root@localhost ~]
# make && make install
[root@localhost ~]
# agedu -s / #-s扫描
[root@localhost ~]
# agedu -w --address 192.168.0.10:80 #-w输入一个网页链接
[root@localhost ~]
# agedu -w --address 192.168.0.108080 --auth none #--auth关闭认证如果不加端口号会生成一个随机的用浏览器访问
|
1
2
3
4
5
6
7
|
[root@localhost ~]
# tar jxvf nmap-6.40.tar.bz2
[root@localhost nmap-6.40]
# ./configure
[root@localhost nmap-6.40]
# make && make install
[root@localhost ~]
# nmap 192.168.0.10 #获取基本信息
[root@localhost ~]
# nmap -O 192.168.0.10 #获取系统版本信息
[root@localhost ~]
# nmap -A 192.168.0.10 #获取系统综合信息
[root@localhost ~]
# nmap 192.168.0.0/24 #获取一个网段工作设备基本信息
|
1
2
3
4
5
|
[root@localhost ~]
# tar zxvf httperf-0.9.0.tar.gz
[root@localhost ~]
# cd httperf-0.9.0
[root@localhost httperf-0.9.0]
# ./configure
[root@localhost httperf-0.9.0]
# make && make install
[root@localhost ~]
# httperf --hog --server=192.168.0.202 --uri=/index.html --num-conns=10000 --wsess=10,10,0.1
|