Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This is varun here,
i am using a proxy server 172.20.x.x,
how do i block port 25 on this server so that anyone from ip range 172.20.x.x cannot access via telnet,etc.using this port.
If it is a proxy then it would be giving access in the first place without running an smtp proxy on that port, which is unlikely if you don't already know. so you'd need to be routing, not proxying, the traffic on it, and that would be where firewalls, including iptables / netfilter would be used to block traffic.
Sorry but now your confusing me a lot. In your original post you state
Quote:
how do i block port 25 on this server so that anyone from ip range 172.20.x.x cannot access via telnet,etc.using this port.
To which I gave you
Code:
iptables -A INPUT -s 172.20.0.0 -p tcp -dport 25 -j DROP
as a solution to block all traffic from your LAN on port 25.
Following you said
Quote:
yes i want to block all except my internal lan??
Today 12:59 PM
so the rule changed to
Code:
iptables -A INPUT -s !172.20.0.0 -p tcp -dport 25 -j DROP
that blocks all traffic except from your LAN.
And now you change your mind again to blocking all access from your LAN?
Could you PLEASE state what exactly you want to do:
1. block access to port 25 from anywhere
2. block access to port 25 from anywhere except your LAN
3. block access to port 25 ONLY from your LAN
4. something else??
You have to restart iptables for it to take effect. If it works, you also have to save the iptables settings, otherwise a reboot will revert to the original settings.
Note also that if you want to 'block' access to port 25 from 'anywhere', then you don't need iptables, you just don't run a server (presumably mailserver eg sendmail) on port 25; no server listening on port 25 = no way to connect on port 25, regardless of iptables.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.