But, what exactly does that?
This is only two alone rules with no meaning.
How can I deny all other IP?
There is two ways. The first is setting up deny policy with:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
But this way is no best practice because if you reset all rules you will lost connection to server. Use the second way:
You need "accept all" policy with the last rule in chains that deny all traffic:
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT --destination $host --jump DROP
iptables -A OUTPUT --source $host --jump DROP
$host - is the host's ip address
How can I edit the iptables for adding more IP to allow and keeping
blocking "not listed"?
You can add severall addresses or ip subnets to a single rule. For example:
iptables -A INPUT --source 192.168.2.111,192.168.2.1,192.168.56.0/24 --destination $host --protocol tcp --dport 27016 --jump ACCEPT
How can I make this iptables configuration persitent?
Pay attention: if you deny or drop all INPUT/OUTPUT traffic you need to define accepting rules for proper connection to server.
iptables -A INPUT --source 192.168.2.111 --protocol tcp --dport 22 --jump ACCEPT
iptables -A OUTPUT --match conntrack --ctstate ESTABLISHED,RELATED --jump ACCEPT
Use iptables carefully especially on remote servers which you cannot access directly if something went wrong.