• Linux学习之服务器端口查看的方法


    1、用netstat查看:

     1 [grid@rac121 admin]$ netstat -anp  | grep oracle
     2 (Not all processes could be identified, non-owned process info
     3  will not be shown, you would have to be root to see it all.)
     4 udp        0      0 169.254.50.253:22020        0.0.0.0:*                               3825/oracle+ASM1    
     5 udp        0      0 127.0.0.1:56330             0.0.0.0:*                               3832/oracle+ASM1    
     6 udp        0      0 169.254.50.253:43154        0.0.0.0:*                               3645/oracle+ASM1_as 
     7 udp        0      0 169.254.50.253:10393        0.0.0.0:*                               3618/oracle+ASM1    
     8 udp        0      0 169.254.50.253:42406        0.0.0.0:*                               3821/oracle+ASM1    
     9 udp        0      0 127.0.0.1:52905             0.0.0.0:*                               3645/oracle+ASM1_as 
    10 udp        0      0 127.0.0.1:46507             0.0.0.0:*                               3618/oracle+ASM1    
    11 udp        0      0 169.254.50.253:57133        0.0.0.0:*                               3825/oracle+ASM1    
    12 udp        0      0 169.254.50.253:57780        0.0.0.0:*                               3832/oracle+ASM1    
    13 udp        0      0 169.254.50.253:39351        0.0.0.0:*                               3832/oracle+ASM1    
    14 udp        0      0 169.254.50.253:62400        0.0.0.0:*                               3641/oracle+ASM1_oc 
    15 udp        0      0 127.0.0.1:41171             0.0.0.0:*                               3821/oracle+ASM1    
    16 udp        0      0 169.254.50.253:28762        0.0.0.0:*                               3618/oracle+ASM1    
    17 udp        0      0 169.254.50.253:45412        0.0.0.0:*                               3641/oracle+ASM1_oc 
    18 udp        0      0 127.0.0.1:50281             0.0.0.0:*                               3825/oracle+ASM1    
    19 udp        0      0 169.254.50.253:11628        0.0.0.0:*                               3821/oracle+ASM1    
    20 udp        0      0 169.254.50.253:25708        0.0.0.0:*                               3645/oracle+ASM1_as 
    21 udp        0      0 127.0.0.1:25083             0.0.0.0:*                               3641/oracle+ASM1_oc 
    22 ..............
    23 unix  3      [ ]         STREAM     CONNECTED     350548405 -                   /var/tmp/.oracle/sOHASD_IPC_SOCKET_11
    24 unix  3      [ ]         STREAM     CONNECTED     350547946 -                   /var/tmp/.oracle/sOHASD_IPC_SOCKET_11
    25 [grid@rac121 admin]$ netstat -anp  | grep 1521
    26 (Not all processes could be identified, non-owned process info
    27  will not be shown, you would have to be root to see it all.)
    28 tcp        0      0 10.1.252.68:1521            0.0.0.0:*                   LISTEN      7097/tnslsnr        
    29 tcp        0      0 10.1.252.75:1521            0.0.0.0:*                   LISTEN      3880/tnslsnr        
    30 tcp        0      0 10.1.252.121:1521           0.0.0.0:*                   LISTEN      3880/tnslsnr        
    31 tcp        0      0 10.1.252.68:61222           10.1.252.68:1521            ESTABLISHED -                   
    32 tcp        0      0 10.1.252.68:1521            10.1.252.122:25637          ESTABLISHED 7097/tnslsnr        
    33 tcp        0      0 10.1.252.68:1521            10.1.252.68:61222           ESTABLISHED 7097/tnslsnr        
    34 tcp        0      0 10.1.252.75:56925           10.1.252.75:1521            ESTABLISHED -                   
    35 tcp        0      0 10.1.252.75:41069           10.1.252.75:1521            ESTABLISHED 3569/asm_pmon_+ASM1 
    36 tcp        0      0 10.1.252.75:1521            10.1.252.75:56925           ESTABLISHED 3880/tnslsnr        
    37 tcp        0      0 10.1.252.75:1521            10.1.252.75:41069           ESTABLISHED 3880/tnslsnr        
    38 tcp        0      0 10.1.252.75:1521            10.1.21.25:3259             ESTABLISHED -                   
    39 [grid@rac121 admin]$ 

    2、lsof -i :port,使用lsof -i :port就能看见所指定端口运行的程序,同时还有当前连接。 

     1 [grid@rac121 admin]$ lsof -i :1521
     2 COMMAND  PID USER   FD   TYPE    DEVICE SIZE NODE NAME
     3 oracle  3569 grid   28u  IPv4 350620044       TCP rac121-vip:41069->rac121-vip:ncube-lm (ESTABLISHED)
     4 tnslsnr 3880 grid   14u  IPv4 350591497       TCP rac121:ncube-lm (LISTEN)
     5 tnslsnr 3880 grid   15u  IPv4 350591500       TCP rac121-vip:ncube-lm (LISTEN)
     6 tnslsnr 3880 grid   16u  IPv4 350620047       TCP rac121-vip:ncube-lm->rac121-vip:41069 (ESTABLISHED)
     7 tnslsnr 3880 grid   18u  IPv4 352031560       TCP rac121-vip:ncube-lm->rac121-vip:56925 (ESTABLISHED)
     8 tnslsnr 7097 grid   14u  IPv4 351091605       TCP rac-scan:ncube-lm (LISTEN)
     9 tnslsnr 7097 grid   15u  IPv4 352028561       TCP rac-scan:ncube-lm->rac122:25637 (ESTABLISHED)
    10 tnslsnr 7097 grid   16u  IPv4 352028634       TCP rac-scan:ncube-lm->rac-scan:61222 (ESTABLISHED)
    11 [grid@rac121 admin]$ 

    3、nmap 端口扫描

     1 [grid@rac121 admin]$ nmap 10.1.252.121
     2 
     3 Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2012-06-29 16:41 CST
     4 Interesting ports on rac121 (10.1.252.121):
     5 Not shown: 1671 closed ports
     6 PORT     STATE SERVICE
     7 21/tcp   open  ftp
     8 22/tcp   open  ssh
     9 53/tcp   open  domain
    10 111/tcp  open  rpcbind
    11 852/tcp  open  unknown
    12 1521/tcp open  oracle
    13 1522/tcp open  rna-lm
    14 1523/tcp open  cichild-lm
    15 8888/tcp open  sun-answerbook
    16 
    17 Nmap finished: 1 IP address (1 host up) scanned in 0.142 seconds
    18 [grid@rac121 admin]$ 

    4、文件/etc/services显示的各个服务的端口号:

     1 [grid@rac121 admin]$ cat /etc/services | grep 1521
     2 ncube-lm        1521/tcp                        # nCube License Manager
     3 ncube-lm        1521/udp                        # nCube License Manager
     4 [grid@rac121 admin]$ cat /etc/services | grep oracle
     5 oracle-oms      1159/tcp                        # Oracle OMS
     6 oracle-oms      1159/udp                        # Oracle OMS
     7 tlisrv          1527/tcp                        # oracle
     8 tlisrv          1527/udp                        # oracle
     9 oraclenames     1575/tcp                        # oraclenames
    10 oraclenames     1575/udp                        # oraclenames
    11 oraclenet8cman  1630/tcp                        # Oracle Net8 Cman
    12 oraclenet8cman  1630/udp                        # Oracle Net8 Cman
    13 oracle-em1      1748/tcp                        # oracle-em1
    14 oracle-em1      1748/udp                        # oracle-em1
    15 oracle-em2      1754/tcp                        # oracle-em2
    16 oracle-em2      1754/udp                        # oracle-em2
    17 oracle-vp2      1808/tcp                        # Oracle-VP2
    18 oracle-vp2      1808/udp                        # Oracle-VP2
    19 oracle-vp1      1809/tcp                        # Oracle-VP1
    20 oracle-vp1      1809/udp                        # Oracle-VP1
    21 oracle          2005/udp
    22 [grid@rac121 admin]$ 

    转自:http://blog.csdn.net/dbcommando/article/details/7703077

  • 相关阅读:
    npm 之 --save , -D,--save -dev的区别
    webpack 之 打包(最新版)
    npm 与 yarn 对比
    webpack 之 打包图片文件
    webpack 之 打包less文件
    javascript 之 Event Loop
    package.json中type的含义
    webpack 之 打包css文件操作
    常见问题 之 webpack打包css问题
    类方法和对象方法
  • 原文地址:https://www.cnblogs.com/sunfie/p/5138891.html
Copyright © 2020-2023  润新知