运维联盟俱乐部

 找回密码
 立即注册
查看: 474|回复: 0

nc udp

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2023-8-2 11:13:44 | 显示全部楼层 |阅读模式
    nc命令测试udp端口联通性


    安装
    1. yum install -y nc
    复制代码

    1. [root@vm2 ~]# nc -h
    2. Ncat 7.50 ( https://nmap.org/ncat )
    3. Usage: ncat [options] [hostname] [port]

    4. Options taking a time assume seconds. Append 'ms' for milliseconds,
    5. 's' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).
    6.   -4                         Use IPv4 only
    7.   -6                         Use IPv6 only
    8.   -U, --unixsock             Use Unix domain sockets only
    9.   -C, --crlf                 Use CRLF for EOL sequence
    10.   -c, --sh-exec <command>    Executes the given command via /bin/sh
    11.   -e, --exec <command>       Executes the given command
    12.       --lua-exec <filename>  Executes the given Lua script
    13.   -g hop1[,hop2,...]         Loose source routing hop points (8 max)
    14.   -G <n>                     Loose source routing hop pointer (4, 8, 12, ...)
    15.   -m, --max-conns <n>        Maximum <n> simultaneous connections
    16.   -h, --help                 Display this help screen
    17.   -d, --delay <time>         Wait between read/writes
    18.   -o, --output <filename>    Dump session data to a file
    19.   -x, --hex-dump <filename>  Dump session data as hex to a file
    20.   -i, --idle-timeout <time>  Idle read/write timeout
    21.   -p, --source-port port     Specify source port to use
    22.   -s, --source addr          Specify source address to use (doesn't affect -l)
    23.   -l, --listen               Bind and listen for incoming connections
    24.   -k, --keep-open            Accept multiple connections in listen mode
    25.   -n, --nodns                Do not resolve hostnames via DNS
    26.   -t, --telnet               Answer Telnet negotiations
    27.   -u, --udp                  Use UDP instead of default TCP
    28.       --sctp                 Use SCTP instead of default TCP
    29.   -v, --verbose              Set verbosity level (can be used several times)
    30.   -w, --wait <time>          Connect timeout
    31.   -z                         Zero-I/O mode, report connection status only
    32.       --append-output        Append rather than clobber specified output files
    33.       --send-only            Only send data, ignoring received; quit on EOF
    34.       --recv-only            Only receive data, never send anything
    35.       --allow                Allow only given hosts to connect to Ncat
    36.       --allowfile            A file of hosts allowed to connect to Ncat
    37.       --deny                 Deny given hosts from connecting to Ncat
    38.       --denyfile             A file of hosts denied from connecting to Ncat
    39.       --broker               Enable Ncat's connection brokering mode
    40.       --chat                 Start a simple Ncat chat server
    41.       --proxy <addr[:port]>  Specify address of host to proxy through
    42.       --proxy-type <type>    Specify proxy type ("http" or "socks4" or "socks5")
    43.       --proxy-auth <auth>    Authenticate with HTTP or SOCKS proxy server
    44.       --ssl                  Connect or listen with SSL
    45.       --ssl-cert             Specify SSL certificate file (PEM) for listening
    46.       --ssl-key              Specify SSL private key (PEM) for listening
    47.       --ssl-verify           Verify trust and domain name of certificates
    48.       --ssl-trustfile        PEM file containing trusted SSL certificates
    49.       --ssl-ciphers          Cipherlist containing SSL ciphers to use
    50.       --version              Display Ncat's version information and exit
    复制代码
    1. [root@vm2 ~]# nc -zvu 192.168.56.1 123
    2. Ncat: Version 7.50 ( https://nmap.org/ncat )
    3. Ncat: Connected to 192.168.56.1:123.
    4. Ncat: UDP packet sent successfully
    5. Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.
    复制代码
    1. [root@vm2 ~]# ntpdate 192.168.56.1
    2. 2 Aug 11:14:06 ntpdate[5946]: step time server 192.168.56.1 offset 506468.928271 sec
    复制代码


    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-5-4 23:57 , Processed in 0.055027 second(s), 21 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表