A
A
At3iSt2016-10-14 22:24:19
linux
At3iSt, 2016-10-14 22:24:19

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

1 answer(s)
O
Official account of the Timeweb team, 2020-07-13
@timeweb_team

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 question

Ask a Question

731 491 924 answers to any question