1. Turn off the Ubuntu firewall UFW disable
2. Uninstall the iptables apt-get remove iptables
1. Use the IPTABLES-F command to turn off the firewall, but before using this command, do remember to use Iptables-l to view the default target,iptables-f of all the chains in your system. This command just clears all the rules, Just don't really close iptables. Imagine if your chain default target is drop, you have rules to allow certain ports, but once the iptables-l is applied and all rules are cleared, the default target blocks any access. Of course include remote SSH Admin server for you.
So my recommended shutdown Firewall command is
Iptables-p INPUT ACCEPT
Iptables-p FORWARD ACCEPT
Iptables-p OUTPUT ACCEPT
Iptables-f
In short, when you want to make any changes on your server, it is best to have a test environment that has been fully tested and then applied to your server. In addition, to use good iptables, it is necessary to understand the operating principle of iptables, Know what to do with each packet iptables. So that we can write the rules accurately and avoid unnecessary trouble.
2. By default, Ubuntu has no firewall, unless you install it yourself, how to delete it.
If it's an enabled iptables, you can delete it.
sudo apt-get remove iptables
Don't remember Apt-get to remove it, some days it's no use for Ubuntu
iptables is a kernel module can not delete the drop
Now check your iptables rule
sudo iptables-l
sudo iptables-t nat-l
If it's all empty, it's not a iptables problem.
If there are many rules, clear the rule and modify the default policy
sudo iptables-f
sudo iptables-t nat-f
sudo iptables-p accep T
sudo iptables-t nat-p ACCEPT