how u use the iptable firewall to restrict ssh,telnet,ftp
Answers were Sorted based on User's Feedback
Answer / sins
simply use..... iptables -A INPUT -s <sourse ip or n/w u
want to block the services> -p tcp --dport <specify prt
number> -j REJECT/DROP/DENY
| Is This Answer Correct ? | 26 Yes | 0 No |
Answer / rajesh dwivedi
If you restrict ssh/telnet or ftp u have to write a rule
for example u have to restrict ssh
IPTABLES -A INPUT -p tcp -s <IP Address or Domain IP> --
dport <ssh port> -j REJECT/DROP
| Is This Answer Correct ? | 12 Yes | 0 No |
For SSH
iptables -A INPUT -s <sourse ip or n/w u
want to block the services> -p tcp --dport <22> -j
REJECT/DROP/DENY
For Telnet
iptables -A INPUT -s <sourse ip or n/w u
want to block the services> -p tcp --dport <23> -j
REJECT/DROP/DENY
For FTP
iptables -A INPUT -s <sourse ip or n/w u
want to block the services> -p tcp --dport <21> -j
REJECT/DROP/DENY
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / srivathsan
Just a small typo to the file name, it is '/etc/hosts.deny'
Thanks,
- Vathsan.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / swapnil
if want to put on the INPUT then
iptables -A INPUT -s source -p protocol --dport destination
port -j DENY
if want to put the OUTPUT tables then
iptables -A OUTPUT -s source -p protocol --dport denation
port -j DENY
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / srivathsan
Followed by iptables command mentioned by Sins to restrict
domains for various services, pleaese run
$ service iptables save
$ restorecon /etc/sysconfig/iptables.
Also, you could block the domains by adding an entry inside
/etc/hots.deny like,
sshd: <Unwanted domain url>
:qw to save changes to the file.
- Vathsan.
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / nrupan mampilly
iptables -I INPUT -t filter -s source -p protocol --dport
portnumber -j REJECT
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anil kumar pinnaka
chkconfig --level < run level for enabling the iptables > on
This will enables the ip table for the given run level.
so that these service will ge blocked.
| Is This Answer Correct ? | 1 Yes | 15 No |
How to convert an IP address to a Domain name using Unix ?
What are main anti-spam features available in sendmail?
rpm package installation error in centos 6.4 [root@localhost packages6.4]# rpm -ivh nfs-utils-1.2.3-36.el6.i686.rpm warning: nfs-utils-1.2.3-36.el6.i686.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY error: Failed dependencies: keyutils >= 1.4-4 is needed by nfs-utils-1:1.2.3-36.el6.i686 libevent is needed by nfs-utils-1:1.2.3-36.el6.i686 libevent-1.4.so.2 is needed by nfs-utils-1:1.2.3-36.el6.i686 libgssglue is needed by nfs-utils-1:1.2.3-36.el6.i686 libgssglue.so.1 is needed by nfs-utils-1:1.2.3-36.el6.i686 libgssglue.so.1(libgssapi_CITI_2) is needed by nfs-utils-1:1.2.3-36.el6.i686 libnfsidmap.so.0 is needed by nfs-utils-1:1.2.3-36.el6.i686 libtirpc is needed by nfs-utils-1:1.2.3-36.el6.i686 libtirpc.so.1 is needed by nfs-utils-1:1.2.3-36.el6.i686 nfs-utils-lib >= 1.1.0-3 is needed by nfs-utils-1:1.2.3-36.el6.i686 rpcbind is needed by nfs-utils-1:1.2.3-36.el6.i686
what is the difference between unix and linux...
what is difference between inetd and xinetd
what is meant by mysql clustering
what is kernel panic error ? how will you fix it if you have face it after rebooting without the the help of rescue disk ?
How to build new filesystem ? and what is irig file system?
why you are using nis server
1 which file contains information about os wether it's 32 bit or 64 bit os 2 difference between logical block and physical block?? 3 what is the size of logical block and physical block?? 4 daemon for nfs on client end as well as server end??? 5 how to confirm from client end about nfs server sharing?? 6 what contains information about file and directory creating time or modification time??
This question is belong to linux support. "one of my customer told to me, my application is getting slow response". how to resolve the issue. what are the steps you will follow to resolve the issue.
How to load the old kernel without rebooting server