centos 上我们可以直接用telnet进行连接,测试是否可以

如果没有telnet命令,可以使用yum 先安装telnet

yum install telnet

[root@VM_0_14_centos /]# telnet localhost 80

Trying 127.0.0.1…

Connected to localhost.

Escape character is ‘^]’.

 

macos 下面使用一下命令

van@van ~$ nc -vz -w 2 94.19.**.218 80

found 0 associations

found 1 connections:

     1: flags=82<CONNECTED,PREFERRED>

outif en0

src 192.168.10.51 port 59344

dst 94.191.120.218 port 80

rank info not available

TCP aux info available

 

Connection to 94.19.**.218 port 80 [tcp/http] succeeded!

 

van@van ~$ nc -help

usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port] [–apple-delegate-pid pid] [–apple-delegate-uuid uuid]

[-s source_ip_address] [-w timeout] [-X proxy_version]

[-x proxy_address[:port]] [hostname] [port[s]]

Command Summary:

-4Use IPv4

-6Use IPv6

-ASet SO_RECV_ANYIF on socket

-aSet SO_AWDL_UNRESTRICTED on socket

-b ifboundBind socket to interface

-cSend CRLF as line-ending

-CDon’t use cellular connection

-DEnable the debug socket option

-dDetach from stdin

-EDon’t use expensive interfaces

-FDo not use flow advisory (flow adv enabled by default)

-G conntimoConnection timeout in seconds

-hThis help text

-H keepidleInitial idle timeout in seconds

-I keepintvlInterval for repeating idle timeouts in seconds

-i secsDelay interval for lines sent, ports scanned

-J keepcntNumber of times to repeat idle timeout

-kKeep inbound sockets open for multiple connects

-K tclassSpecify traffic class

-lListen mode, for inbound connects

-L num_probes Number of probes to send before generating a read timeout event

-mSet SO_INTCOPROC_ALLOW on socket

-nSuppress name/port resolutions

-MUse MULTIPATH domain socket

-N num_probes Number of probes to send before generating a write timeout event

-OUse old-style connect instead of connectx

-p portSpecify local port for remote connects (cannot use with -l)

-rRandomize remote ports

-s addrLocal source address

-tAnswer TELNET negotiation

-UUse UNIX domain socket

-uUDP mode

-vVerbose

-w secsTimeout for connects and final net reads

-X protoProxy protocol: “4”, “5” (SOCKS) or “connect”

-x addr[:port]Specify proxy address and port

-zZero-I/O mode [used for scanning]

-oIssue socket options after connect/bind

–apple-delegate-pid pidSet socket as delegate using pid

Port numbers can be individual or ranges: lo-hi [inclusive]

 

发表评论

电子邮件地址不会被公开。