1. 程式人生 > >Centos優化端口顯示

Centos優化端口顯示

serve init onf postfix emctl opp start -i netstat

Centos-7

[root@linux-node1 ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@linux-node1 ~]# netstat -ntpl
Active Internet connections (only servers)
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 1086/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1280/master tcp6 0 0 :::22 :::* LISTEN 1086/sshd tcp6 0 0 ::1:25 :::* LISTEN 1280
/master [root@linux-node1 ~]# systemctl stop postfix.service [root@linux-node1 ~]# systemctl enable postfix.service [root@linux-node1 ~]# sed -i s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g /etc/ssh/sshd_config [root@linux-node1 ~]# systemctl restart sshd [root@linux-node1 ~]# netstat -ntpl Active Internet connections (only servers) 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 1524/sshd

Centos-6

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.8 (Final)
[root@localhost ~]# netstat -ntpl
Active Internet connections (only servers)
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      1329/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1408/master         
tcp        0      0 :::22                       :::*                        LISTEN      1329/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1408/master         
[root@localhost ~]# /etc/init.d/postfix stop
Shutting down postfix:                                     [  OK  ]
[root@localhost ~]# chkconfig postfix off
[root@localhost ~]# sed -i s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g /etc/ssh/sshd_config
[root@localhost ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@localhost ~]# netstat -ntpl
Active Internet connections (only servers)
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      1540/sshd

Centos優化端口顯示