1. 程式人生 > >LINUX常見命令

LINUX常見命令

sys col roo start art cap win 服務 out

1 服務起停

比如 service rsyslog restart

查看服務是否運行

[[email protected] ~]# service rsyslog status
rsyslogd (pid 30843) is running...


2 根據進程名查看端口占用情況

[[email protected] ~]# netstat -nap | grep syslog
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 30843/rsyslogd
tcp 0 0 :::514 :::* LISTEN 30843/rsyslogd
udp 0 0 0.0.0.0:514 0.0.0.0:* 30843/rsyslogd
udp 0 0 :::514 :::* 30843/rsyslogd
unix 3 [ ] DGRAM 637901 30843/rsyslogd /dev/log
unix 2 [ ] DGRAM 637911 30843/rsyslogd

3 使用yum對rsyslog進行升級

# cd /etc/yum.repos.d
# wget http://rpms.adiscon.com/v8-stable/rsyslog.repo
# yum update rsyslog

4 驗證包是否安裝了

[[email protected] ~]# rpm -qa | grep rsyslog
rsyslog-8.29.0-1.el6.x86_64

5 配置防火墻規則

iptables -A INPUT -m state --state NEW -m udp -p udp -i eth0 --dport 514 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp -i eth0 --dport 514 -j ACCEPT

6 查看服務網絡聯通情況

[[email protected] ~]# tcpdump port 514
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
00:02:09.946198 IP reverse.gdsz.cncnet.net.fiorano-rtrsvc > 138.128.192.190.16clouds.com.shell: Flags [S], seq 381626941, win 65535, options [mss 1380,nop,wscale 1,nop,nop,sackOK], length 0
00:02:09.946572 IP 138.128.192.190.16clouds.com.shell > reverse.gdsz.cncnet.net.fiorano-rtrsvc: Flags [S.], seq 1926436450, ack 381626942, win 29200, options [mss 1460,nop,nop,sackOK,nop,wscale 6], length 0
00:02:10.151413 IP reverse.gdsz.cncnet.net.fiorano-rtrsvc > 138.128.192.190.16clouds.com.shell: Flags [.], ack 1, win 64970, length 0

7

LINUX常見命令