Answer the question
In order to leave comments, you need to log in
How can one of the two IPs on Ubuntu be prohibited from connecting from the network?
Good afternoon.
There is an Ubuntu 18 server, two IP addresses are hammered through netplan: the main and alias (one ens3).
Now you can connect from the outside to the server from both IP addresses.
How to disable connection to the server from the main IP?
The whole point is that I connect to the VPN from an additional IP, and if necessary, I connect via ssh on the same IP. But I go to the network through VPN already from the main address and it is necessary that connections from the outside are completely blocked on it.
Thank you.
Answer the question
In order to leave comments, you need to log in
iptables -P INPUT DROP -i iface1
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT -o iface1
Learn iptables
The command to block all new connections coming to an ip address is as follows:
iptables -I INPUT -p ip to block -m state --state NEW - j DROP The
-I switch is for the rule to be at the top of the list and have priority.
The key -m state --state NEW - so that incoming reverse connections in response to open ones initiated by the host itself are not prohibited, but only new connections to an ip address from somewhere are prohibited.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question