Linux知识点之网络通信

1.为“ssh”生成、管理和转换认证密钥的命令是

ssh-keygen(选项)

2.如何指定登录用户

ssh [email protected]

3.指定端口登录

$ ssh 192.168.0.102 -p 222

4.ssh创建秘钥

$ ssh-keygen -t dsa/rsa

5.删除主机秘钥

$ ssh-keygen -R 192.168.0.102

6.列出所有的端口

netstat -a

7.列出TCP协议的端口

netstat -at

8.UDP协议的端口

netstat -au

9.列出处于监听状态的socket

netstat -l

10.列出监听的TCP端口

netstat -lt

11.网络连接状态有哪些

/* The socket is listening for incoming connections. 侦听来自远方TCP端口的连接请求 */

2)、SYN_SENT:客户端通过应用程序调用connect进行active open.于是客户端tcp发送一个SYN以请求建立一个连接.之后状态置为SYN_SENT.

/*The socket is actively attempting to establish a connection. 在发送连接请求后等待匹配的连接请求 */

3)、SYN_RECV:服务端应发出ACK确认客户端的 SYN,同时自己向客户端发送一个SYN. 之后状态置为SYN_RECV

/* A connection request has been received from the network. 在收到和发送一个连接请求后等待对连接请求的确认 */

4)、ESTABLISHED: 代表一个打开的连接,双方可以进行或已经在数据交互了。

/* The socket has an established connection. 代表一个打开的连接,数据可以传送给用户 */

5)、FIN_WAIT1:主动关闭(active close)端应用程序调用close,于是其TCP发出FIN请求主动关闭连接,之后进入FIN_WAIT1状态.

/* The socket is closed, and the connection is shutting down. 等待远程TCP的连接中断请求,或先前的连接中断请求的确认 */

6)、CLOSE_WAIT:被动关闭(passive close)端TCP接到FIN后,就发出ACK以回应FIN请求(它的接收也作为文件结束符传递给上层应用程序),并进入CLOSE_WAIT.

/* The remote end has shut down, waiting for the socket to close. 等待从本地用户发来的连接中断请求 */

7)、FIN_WAIT2:主动关闭端接到ACK后,就进入了 FIN-WAIT-2 .

/* Connection is closed, and the socket is waiting for a shutdown from the remote end. 从远程TCP等待连接中断请求 */

8)、LAST_ACK:被动关闭端一段时间后,接收到文件结束符的应用程序将调用CLOSE关闭连接。这导致它的TCP也发送一个 FIN,等待对方的ACK.就进入了LAST-ACK .

/* The remote end has shut down, and the socket is closed. Waiting for acknowledgement. 等待原来发向远程TCP的连接中断请求的确认 */

9)、TIME_WAIT:在主动关闭端接收到FIN后,TCP 就发送ACK包,并进入TIME-WAIT状态。

/* The socket is waiting after close to handle packets still in thenetwork.等待足够的时间以确保远程TCP接收到连接中断请求的确认 */

10)、CLOSING: 比较少见.

/* Both sockets are shut down but we still don’t have all our datasent. 等待远程TCP对连接中断的确认 */

11)、CLOSED: 被动关闭端在接受到ACK包后,就进入了closed的状态。连接结束.

/* The socket is not being used. 没有任何连接状态 */

12)、UNKNOWN: 未知的Socket状态。

/* The state of the socket is unknown. */

12.ping

在网络维护过程中,Ping命令是一个经常使用的DOS命令,它是用来检查网络是否畅通或者网络连接速度的命令。可用于诊断连接性、可访问性和名称解析,可以探测对方计算机的活动情况,还可以通过数据返回时间简单推测对方的操作系统。

13.如何使用ping

举例

ping www.xxxxxxx.com

14.ifconfig

在Linux系统中主要用于显示配置网络设备,通常需要以root身份登录或使用sudo以便在Linux机器上使用ifconfig工具。依赖于ifconfig命令中使用一些选项属性,ifconfig工具不仅可以被用来简单地获取网络接口配置信息,还可以修改这些配置。

15.配置网卡的IP地址,在eth0上配置上192.168.0.1 的IP地址及24位掩码

ifconfig eth0 192.168.0.1 netmask 255.255.255.0

16.若想再在eth0上在配置一个192.168.1.1/24 的IP地址怎么办?

ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0

17.配置网卡的硬件地址

ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

18.将网卡禁用

ifconfig eth0 down

19.将网卡启用

ifconfig eth0 up

20.在指定网络接口上发出DHCP请求

[root@linuxcool ~]# dhclient eth0

Supongo que te gusta

Origin blog.csdn.net/daocaokafei/article/details/120338666
Recomendado
Clasificación