For the life of me I can't seem to remember these simple commands to edit IPTables so I just wanted to document the few that I seem to be using the most:
View current rules
View a list of current rulesiptables -L
Insert a new rule
This will insert a new rule in the INPUT chain in the number 5 slot:iptables -I INPUT 5 -p tcp --dport [port] -j ACCEPT
Insert a new rule and allow only from specific IP address
This will insert a new rule in the INPUT chain in the number 5 slot and only allow a connection from the IP address specified:iptables -I INPUT 5 -p tcp -s [ip address] --dport [port] -j ACCEPT
Delete specific rule
This will delete rule number 5 from the list. Change the 5 to whatever number you need to deleteiptables -D INPUT 5
Save rules to a file
Make sure to save the rules to a file so they are applied upon boot. Note that I needed to use the "sh -c" option for sudo or you will get a permission denied errorsudo sh -c "iptables-save >/etc/iptables.rules"