12

Ubuntu 开放指定端口

 4 years ago
source link: https://yjyj.net/learn/6209.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Ubuntu 开放指定端口

2021-05-27

一般情况下,ubuntu安装好的时候,iptables会被安装上,如果没有的话先安装
sudo apt-get install iptables
添加开放端口

# sudo iptables -I INPUT -p tcp --dport [端口号] -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# 临时保存配置,重启后失效
sudo iptables-save

安装 iptables-persistent工具,持久化开放端口配置
sudo apt-get install iptables-persistent

sudo netfilter-persistent save
sudo netfilter-persistent reload

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK