Answer the question
In order to leave comments, you need to log in
How to allow incoming connections only for a few IPs on a specific port?
Hello.
Please tell me how to allow incoming connections only for a few IP addresses on a specific port, and forbid all others from outside.
In other words, there is a certain MySQL database server and three IP addresses (for example: xxxx, yyyy, zzzz ). So, you need to close access to port 3306 for everyone, except for these addresses. And also allow one of them to connect via SSH.
Answer the question
In order to leave comments, you need to log in
in this case, you can configure the rules you need using the iptables utility to configure firewall rules.
For example, you can block access to port 3306 from all ips with the command
`iptables -A INPUT -p tcp --dport 3306 -j DROP`
Then you can add permissions for individual ip with the command
`iptables -A INPUT -s -p tcp - -dport 3306 -j ACCEPT`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question