0
点赞
收藏
分享

微信扫一扫

ubuntu常用命令集

野见 2023-06-28 阅读 58
ubuntu运维

一、查看侦听的端口

Usage: netstat [-ral] [-tuwx] [-en]


Display networking information


-r Routing table

-a All sockets

-l Listening sockets

Else: connected sockets

-t TCP sockets

-u UDP sockets

-w Raw sockets

-x Unix sockets

Else: all socket types

-e Other/more information

-n Don't resolve names


 netstat -atu##查看所有tcp、udp侦听端口

 netstat -aut|grep 6088#查看制定的端口的侦听列表

lsof -i -P -n | grep  6088#查看制定的端口的侦听列表


netstat -r  #查看路由表


二、查看防火墙

1.查看防火墙状态

ufw status  (普通用户:sudo ufw status)

inactive :没有激活

active:防火墙激活

2. 防火墙开放关闭端口

sudo ufw enable  (开启防火墙)

sudo ufw allow 80/tcp   #开放tcp80端口

sudo ufw reload  #重启防火墙

sudo ufw delete allow 80/tcp  #防火墙关闭指定协议普通端口

sudo ufw allow from 192.168.2.10 #开放指定ip的所有操作

sudo ufw delete allow from 192.168.2.10 #关闭指定ip的所有操作

sudo ufw allow from 192.168.2.10 to any port 80 #开放指定ip对应端口操作

sudo ufw delete allow from 192.168.2.10 to any port 80 #关闭指定ip对应端口操作

sudo ufw disable  #关闭防火墙


开放某一个端口的顺序

sudo ufw allow 80/tcp   #开放tcp80端口

sudo ufw reload  #重启防火墙

ufw  status  #查看防火墙状态







举报

相关推荐

0 条评论