Under Ubuntu Open port seems to have two main methods, one is Ubuntu comes with the firewall, one is iptables, here we mainly use iptables. The system version for this article is ubuntu14.04 and ubuntu16.04
Installing Iptables
In general, when Ubuntu is installed, Iptables will be installed, there is no installation and nothing, a command can be installed.
Apt-get Install Iptables
Once you've installed it, you're ready to add rules.
Iptables-i input-p TCP--dport 80-j ACCEPT
You can then directly save the
Iptables-save
Persistent iptables
The above does only temporarily save the open port information, if the server restarts, the saved information is dropped, so we need to persist the port information, here we use iptables-persistent
Installing Iptables-persistent
Apt-get Install Iptables-persistent
Persistent information
Service Iptables-persistent Save
Linux/ubuntu Port Open