网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

linux系统开启指定端口

时间:2024-10-28 04:27:46

1、测试主机linux主机是否安装该命令工具,出现以下提示说明nc命令未安装[root@localhost ~]# nc -l 8888-bash: nc: command not found

2、安装nc命令root@localhost ~]# yum install -y nc

3、查看当前启动的端口[root@localhost ~]# netstat -luntpActive Int髫潋啜缅ernet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1355/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2416/master tcp6 0 0 :::22 :::* LISTEN 1355/sshd tcp6 0 0 ::1:25 :::* LISTEN 2416/master udp 0 0 0.0.0.0:68 0.0.0.0:* 10838/dhclient udp 0 0 0.0.0.0:8561 0.0.0.0:* 10838/dhclient udp6 0 0 :::6388 :::* 10838/dhclient [root@localhost ~]# nc -l 8888

4、启动测试端口[root@localhost ~]# nc -l 8888

5、确认端口是否已经有8888的端口[root@localhost ~]# netstat -luntpActive Internet co荏鱿胫协nnections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1355/sshd tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 20289/nc tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2416/master tcp6 0 0 :::22 :::* LISTEN 1355/sshd tcp6 0 0 :::8888 :::* LISTEN 20289/nc tcp6 0 0 ::1:25 :::* LISTEN 2416/master udp 0 0 0.0.0.0:68 0.0.0.0:* 10838/dhclient udp 0 0 0.0.0.0:8561 0.0.0.0:* 10838/dhclient udp6 0 0 :::6388 :::* 10838/dhclient

6、好了现在可以进行其他相关测试了

© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com