Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-07-2011, 09:26 AM   #1
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
iptables - SSH works fine after connecting but takes ages to connect

I want only one remote machine to be able to access a server, so I've run the following commands on the server so that only a machine with the IP address can connect to it in any way:

  iptables -F
  iptables -N LOGDROP
  iptables -A LOGDROP -j LOG -m limit --limit 5/min
  iptables -A LOGDROP -j DROP
  iptables -A INPUT -s -j ACCEPT
  iptables -A INPUT -j LOGDROP
  iptables -A OUTPUT -j ACCEPT
However, this is causing it to take ages for me to connect to it from SSH. But then finally when it does connect, I can execute commands through SSH at the expected speed and responsiveness through. So I'm doing something wrong when setting up the iptables rules to make things go very slowly upon connecting. If you have any suggestions of how to fix this or can see my error, please let me know. Thanks.
Old 10-07-2011, 09:28 AM   #2
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 358
Blog Entries: 3

Rep: Reputation: 47
Are you sure this depends on iptables?

Try to add this line to /etc/ssh/sshd_config:
UseDNS no
UseDNS Specifies whether sshd(8) should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The
default is “yes”.
AddressFamily inet

Last edited by Lexus45; 10-07-2011 at 09:49 AM.
1 members found this post helpful.
Old 10-07-2011, 10:01 AM   #3
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Original Poster
Rep: Reputation: 16
The problem did only appear when iptables was enabled, and your suggestions solved the problem. Thanks!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dhclient takes ages to connect to wpa-secured network, then "no dhcpoffers received" solitaira Linux - Wireless Networking 5 05-01-2010 04:49 AM
Takes ages to connect to smtp Swakoo Linux - General 3 08-23-2005 03:32 AM
X takes ages and ages to load! dcdbutler Slackware 9 03-23-2005 07:53 AM
vnc over ssh works fine but then i have X problem... suhis Linux - General 1 08-17-2004 04:33 PM
iptables works fine but not after boot wslogue Linux - Security 2 11-24-2003 09:51 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration