Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 8021  / 1 Year ago, fri, december 16, 2022, 10:31:53

I've been using ubuntu server for a while, however I have never really invested time into iptables. I was wondering if there was a recommended way to setup iptables on a basic server intall. An iptables boilerplate essentially.



Also, an explanation of all of the most commonly used ubuntu server ports would be very helpful.


More From » server

 Answers
4

It is fantastic that you are interested in iptables.



As you can see, however, there is a bit of a learning curve.



The basics are



All services listen on ports. One analogy would be an apartment complex, your ports are analogous to apartment numbers.



Common ports are



FTP - 21



SSH - 22



Apache - HTTP 80 ; HTTPS 443



You can get a complete list of ports from a google search or /etc/services



This might help as well



https://help.ubuntu.com/10.04/serverguide/C/index.html



From there, enter iptables. As a firewall, iptables is one way of limiting access.



Basically you have 3 broad options.




  1. Public servers, ie apache. Here you will allow all traffic and blacklist bad acting IP (spammers)


  2. Private servers, ie ssh. Here you will deny all traffic and white list authorized connections.


  3. Limit. You may allow ping, but only at a certain rate.




If you are new to iptables, you may wish to start with ufw. ufw is a command line front end to iptables and is easier to learn. The syntax is very similar to iptables so it is easy to transition from ufw to iptables.



See:



https://help.ubuntu.com/community/UFW



https://help.ubuntu.com/community/IptablesHowTo



That information should get you started. If you have a problem, feel free to ask a more specific question.



I also have an introductory page to iptables if you like. I have maintained it over the years with feedback from people new to iptables, hope it helps.



http://bodhizazen.com/Tutorials/iptables


[#40777] Sunday, December 18, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
listeerrated

Total Points: 354
Total Questions: 112
Total Answers: 100

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
listeerrated questions
Wed, Jun 8, 22, 11:43, 2 Years ago
Wed, Mar 23, 22, 03:25, 2 Years ago
Wed, Jun 2, 21, 20:28, 3 Years ago
;