11f1c [Solved] Dropped SSH Connections - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old December 1st, 2009, 00:01
ahankinson ahankinson is offline
Junior Member
 
Join Date: Nov 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default Dropped SSH Connections

I have two machines with different network cards. On the first machine, when I restart anything to do with the networking, e.g. "/etc/rc.d/netif restart" or "/etc/rc.d/ipfw restart" it will maintain the ssh connection through the restart. This machine is running FreeBSD 7.2 with the following hardware:
Code:
$ pciconf -vl
...
bce0@pci0:9:0:0:	class=0x020000 card=0x01b31028 chip=0x164c14e4 rev=0x12 hdr=0x00
    vendor     = 'Broadcom Corporation'
    device     = 'Broadcom NetXtreme II Gigabit Ethernet Adapter (BCM5708)'
    class      = network
    subclass   = ethernet
...
On the second machine, however, the connection hangs and I have to close the terminal. It does not exit the connection, it simply waits until it times out. I'm running 8.0-RELEASE on this machine.

It is running this hardware:

Code:
$ pciconf -vl
...
em0@pci0:5:0:0:	class=0x020000 card=0x34768086 chip=0x10968086 rev=0x01 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Intel PRO/1000 EB (Intel PRO/1000 EB)'
    class      = network
    subclass   = ethernet
...
I've tried the same firewall settings on both machines which did not seem to make a difference.

Any clues as to why this happens? Generally, is this likely to be a difference in hardware capabilities, or is it a software configuration problem?

Thanks in advance.
Reply With Quote
  #2  
Old December 1st, 2009, 00:30
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

The fact that it doesn't happen in 7.2 is quite surprising. The behaviour seems pretty normal to me...
Reply With Quote
  #3  
Old December 1st, 2009, 00:58
ahankinson ahankinson is offline
Junior Member
 
Join Date: Nov 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I just double-checked. I'm now using IPFW on the 7.2 machine and PF on the 8.0 machine. Restarting netif on the 8.0 machine now maintains the connection, but restarting PF results in a dropped connection. Restarting both netif and IPFW on the 7.2 machine maintains the connection.

I'm beginning to suspect that it is actually a firewall problem. Maybe I'm missing an 'established' rule on the PF side of things. I'll change it up and report back.
Reply With Quote
  #4  
Old December 1st, 2009, 01:04
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

That is correct behaviour. When you restart pf using the RC script it probably clears PF's state table. You should not be adding "established" rules to a stateful firewall as that entirely defeats the point of a stateful firewall. The key is to avoid resetting the firewall's state table.

Why are you restarting PF? If you just want to reload the ruleset, use pfctl(8) instead.
Reply With Quote
  #5  
Old December 1st, 2009, 01:19
anomie's Avatar
anomie anomie is offline
Member
 
Join Date: Nov 2008
Location: Texas
Posts: 783
Thanks: 49
Thanked 113 Times in 100 Posts
Default

Note that you can do: # /etc/rc.d/pf reload

That uses pfctl as well.
__________________
"Do Not Engage in Useless Activity" --Miyamoto Musashi
Reply With Quote
  #6  
Old December 1st, 2009, 21:13
ahankinson ahankinson is offline
Junior Member
 
Join Date: Nov 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you all for your expertise & replies. I've fixed the problem.
Reply With Quote
  #7  
Old December 1st, 2009, 22:30
DutchDaemon's Avatar
DutchDaemon DutchDaemon is offline
Administrator
 
Join Date: Nov 2008
Location: Rotterdam, the Netherlands
Posts: 9,817
Thanks: 30
Thanked 1,883 Times in 1,329 Posts
Default

How? Share solutions.
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules
FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki
Before you post: How to ask questions the smart way
If you must know .. So, what does an Adminstrator/Moderator do?
---> Do not PM me with FreeBSD questions. I do not work here. <---
Reply With Quote
  #8  
Old December 2nd, 2009, 18:59
phoenix's Avatar
phoenix phoenix is offline
Moderator
 
Join Date: Nov 2008
Location: Kamloops, BC, Canada
Posts: 3,141
Thanks: 43
Thanked 701 Times in 579 Posts
Default

It could also be a difference between the "default rule" for IPFW and PF. I don't know about PF, but IPFW's default rule is "deny ip from any to any", which will kill all active network connections when you restart/reload IPFW rules.

However, one can change that via a kernel option (IPFW_DEFAULT_TO_ACCEPT), which sets the default rule to "allow ip from any to any" which will not kill active connections during a restart/reload.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #9  
Old December 4th, 2009, 17:52
ahankinson ahankinson is offline
Junior Member
 
Join Date: Nov 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Sorry for not including the solution I discovered. I mostly just followed the instructions suggested by others in this thread. By using

Code:
/etc/rc.d/pf reload
instead of restart it does not break the network connection. As for why it doesn't happen on IPFW, I'm still not sure why.
Reply With Quote
  #10  
Old December 4th, 2009, 18:34
phoenix's Avatar
phoenix phoenix is offline
Moderator
 
Join Date: Nov 2008
Location: Kamloops, BC, Canada
Posts: 3,141
Thanks: 43
Thanked 701 Times in 579 Posts
Default

Did you read what I posted? That tells you why.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
screen: Keep Your Processes Running Despite A Dropped Connection bsdvm Howtos & FAQs 32 May 21st, 2011 13:54
Force disconnect on unattended SSH/SFTP connections kyan Web & Network Services 5 March 17th, 2011 17:52
SSHGuard not Blocking Connections Lego Web & Network Services 49 November 21st, 2009 19:26
PF: Block outgoing connections CodeBlock Firewalls 2 November 1st, 2009 01:09
mysql connections doubts? klabacita Web & Network Services 0 March 27th, 2009 03:06


All times are GMT +1. The time now is 22:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0