200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 测试tcp和udp端口连通性

测试tcp和udp端口连通性

时间:2022-03-16 17:05:12

相关推荐

测试tcp和udp端口连通性

测试tcp和udp端口连通性

测试tcp和udp端口连通性tcp端口命令 telnet udp端口命令 ncnc命令用法nc命令man帮助示例nc默认tcp协议,使用udp要指定u

测试tcp和udp端口连通性

tcp端口

命令 telnet

#测试连接成功telnet 192.168.126.133 22Trying 192.168.126.133...Connected to 192.168.126.133.Escape character is '^]'.SSH-2.0-OpenSSH_7.4elnet> q#测试连接失败telnet 192.168.126.133 90Trying 192.168.126.133...telnet: Unable to connect to remote host: Connection refused

udp端口

命令 nc

#查找提供nc命令的安装包[root@module ~]# yum provides nc已加载插件:fastestmirror源 'zgf' 在配置文件中未指定名字,使用标识代替Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastDetermining fastest mirrors2:nmap-ncat-6.40-13.el7.x86_64 : Nmap's Netcat replacement源 :zgf匹配来源:提供 :nc#安装[root@module ~]# yum -y install nmap-ncat-6.40-13.el7.x86_64#查看帮助信息[root@module ~]# nc --help[root@module ~]# man nc

nc命令用法

Usage: ncat [options] [hostname] [port]#用法:ncat[选项][主机名][端口]Options taking a time assume seconds. Append 'ms' for milliseconds,#花费时间的选项以秒为单位。附加“ms”毫秒,'s' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).#“s”表示秒,“m”表示分钟,或“h”表示小时(例如500ms)。-4 Use IPv4 only#仅使用IPv4-6Use IPv6 only#仅使用IPv6-U, --unixsock Use Unix domain sockets only#仅使用Unix域套接字-C, --crlf Use CRLF for EOL sequence#对EOL序列使用crlf-c, --sh-exec <command> Executes the given command via /bin/sh#通过/bin/sh执行给定命令-e, --exec <command> Executes the given command#执行给定的命令--lua-exec <filename> Executes the given Lua script#执行给定的lua脚本-g hop1[,hop2,...] Loose source routing hop points (8 max)#松散源路由跳点(最大8个)-G <n> Loose source routing hop pointer (4, 8, 12, ...)#松散源路由跃点指针(4,8,12,…)-m, --max-conns <n> Maximum <n> simultaneous connections#最大同时连接数<n>-h, --help Display this help screen#显示此帮助屏幕-d, --delay <time> Wait between read/writes#读取/写入之间的等待-o, --output <filename> Dump session data to a file#将会话数据转储到文件-x, --hex-dump <filename> Dump session data as hex to a file#将会话数据作为十六进制转储到文件-i, --idle-timeout <time> Idle read/write timeout#空闲读/写超时-p, --source-port portSpecify source port to use#指定要使用的源端口-s, --source addrSpecify source address to use (doesn't affect -l)#指定要使用的源地址(不影响 -l)-l, --listenBind and listen for incoming connections#绑定并侦听传入连接-k, --keep-open Accept multiple connections in listen mode#在侦听模式下接受多个连接-n, --nodnsDo not resolve hostnames via DNS#不通过DNS解析主机名-t, --telnetAnswer Telnet negotiations#回答telnet协商-u, --udp Use UDP instead of default TCP#使用udp而不是默认TCP--sctp Use SCTP instead of default TCP#使用sctp而不是默认TCP-v, --verbose Set verbosity level (can be used several times)#设置详细级别(可以多次使用)-w, --wait <time>Connect timeout#连接超时-zZero-I/O mode, report connection status only#零I/O模式,仅报告连接状态--append-output Append rather than clobber specified output files#追加而不是删除指定的输出文件--send-only Only send data, ignoring received; quit on EOF#仅发送数据,忽略已接收数据;在EOF上退出--recv-only Only receive data, never send anything#仅接收数据,从不发送任何内容--allowAllow only given hosts to connect to Ncat#仅允许给定主机连接到Ncat--allowfile A file of hosts allowed to connect to Ncat#允许连接到Ncat的主机文件--deny Deny given hosts from connecting to Ncat#拒绝给定主机连接到Ncat--denyfile A file of hosts denied from connecting to Ncat#拒绝连接到Ncat的主机文件--brokerEnable Ncat's connection brokering mode#启用Ncat的连接代理模式--chat Start a simple Ncat chat server#启动一个简单的Ncat聊天服务器--proxy <addr[:port]> Specify address of host to proxy through#指定要代理的主机地址--proxy-type <type> Specify proxy type ("http" or "socks4" or "socks5")#指定代理类型(“http”或“socks4”或“socks5”)--proxy-auth <auth> Authenticate with HTTP or SOCKS proxy server#使用HTTP或SOCKS代理服务器进行身份验证--ssl Connect or listen with SSL#使用ssl连接或侦听--ssl-cert Specify SSL certificate file (PEM) for listening#指定用于侦听的ssl证书文件(PEM)--ssl-key Specify SSL private key (PEM) for listening#指定用于侦听的ssl私钥(PEM)--ssl-verify Verify trust and domain name of certificates#验证证书的信任和域名--ssl-trustfile PEM file containing trusted SSL certificates#包含受信任ssl证书的ssl信任文件PEM文件--ssl-ciphersCipherlist containing SSL ciphers to use#密码包含要使用的ssl密码的密码列表--version Display Ncat's version information and exit#显示Ncat的版本信息并退出See the ncat(1) manpage for full options, descriptions and usage examples#有关完整选项、说明和使用示例,请参阅ncat(1)手册页

nc命令man帮助示例

EXAMPLES#示例# 表示主机名Connect to on TCP port 8080.#连接到TCP的端口8080ncat 8080Listen for connections on TCP port 8080.#侦听TCP端口8080上的连接ncat -l 8080Redirect TCP port 8080 on the local machine to host on port 80.#将本地计算机上的TCP端口8080重定向到端口80上的主机ncat --sh-exec "ncat 80" -l 8080 --keep-openBind to TCP port 8081 and attach /bin/bash for the world to access freely.#绑定到TCP端口8081并附加/bin/bash,让世界自由访问ncat --exec "/bin/bash" -l 8081 --keep-openBind a shell to TCP port 8081, limit access to hosts on a local network, and limit the maximum number of simultaneous connections to 3.#将shell绑定到TCP端口8081,限制对本地网络上主机的访问,并将同时连接的最大数量限制为3ncat --exec "/bin/bash" --max-conns 3 --allow 192.168.0.0/24 -l 8081 --keep-openConnect to smtphost:25 through a SOCKS4 server on port 1080.#通过端口1080上的SOCKS4服务器连接到smtphost:25ncat --proxy socks4host --proxy-type socks4 --proxy-auth user smtphost 25Create an HTTP proxy server on localhost port 8888.#在本地主机端口8888上创建HTTP代理服务器ncat -l --proxy-type http localhost 8888Send a file over TCP port 9899 from host2 (client) to host1 (server).#通过TCP端口9899从主机2(客户端)向主机1(服务器)发送文件HOST1$ ncat -l 9899 > outputfile#输出文件HOST2$ ncat HOST1 9899 < inputfile#输入文件Transfer in the other direction, turning Ncat into a “one file” server.#向另一个方向传输,将Ncat变成“一个文件”服务器。HOST1$ ncat -l 9899 < inputfileHOST2$ ncat HOST1 9899 > outputfile

nc默认tcp协议,使用udp要指定u

#目标主机 开启侦测udp端口nc -vulp 323Ncat: Version 7.50 ( /ncat )Ncat: Listening on :::323Ncat: Listening on 0.0.0.0:323#测试主机 测试udp端口 成功标志succeeded!nc -zvu 192.168.126.133 323Connection to 192.168.126.133 323 port [udp/*] succeeded!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。