LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-07-2011, 10:26 AM   #1
veeruk101
Member
 
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 11.22.33.44 can connect to it in any way:

Code:
  iptables -F
  iptables -N LOGDROP
  iptables -A LOGDROP -j LOG -m limit --limit 5/min
  iptables -A LOGDROP -j DROP
  iptables -A INPUT -s 11.22.33.44 -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, 10:28 AM   #2
Lexus45
Member
 
Registered: Jan 2010
Location: Kurgan, Russia
Distribution: Slackware, Ubuntu
Posts: 352
Blog Entries: 3

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

Try to add this line to /etc/ssh/sshd_config:
Code:
UseDNS no
Quote:
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”.
or
Code:
AddressFamily inet

Last edited by Lexus45; 10-07-2011 at 10:49 AM.
 
1 members found this post helpful.
Old 10-07-2011, 11:01 AM   #3
veeruk101
Member
 
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!
 
  


Reply


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 05:49 AM
Takes ages to connect to smtp Swakoo Linux - General 3 08-23-2005 04:32 AM
X takes ages and ages to load! dcdbutler Slackware 9 03-23-2005 08:53 AM
vnc over ssh works fine but then i have X problem... suhis Linux - General 1 08-17-2004 05:33 PM
iptables works fine but not after boot wslogue Linux - Security 2 11-24-2003 10:51 AM


All times are GMT -5. The time now is 04:52 AM.

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