kern/102741: Multiple outbound connect() calls produce 'Network is unreachable'

Dan Burzynski dan at
Fri Sep 1 09:20:27 UTC 2006

>Number:         102741
>Category:       kern
>Synopsis:       Multiple outbound connect() calls produce 'Network is unreachable'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 01 09:20:26 GMT 2006
>Originator:     Dan Burzynski
>Release:        6.1
FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May  7 04:42:56 UTC 2006     root at  i386
When doing multiple (but not nessesarlity concurrent) outbound socket connections (such as using HTTP) we're seeing the error message 'Network is unreachable' after a random amount. It then persists for a while and then we're back to it working for a little while.

I've run a tcpdump and it seems that the point at which it complains that the network is unreachable, it's not even tried to make the connection.

This problem occurs on two different boxes installed with the same version of BSD (although their hardware is identical):

CPU: 2 x PowerEdge 1850 Xeon 3.0Ghz/2MB, 800FSB
Memory: 4GB Dual Rank DDR2 Memory (2x2GB)
Network: Dual embedded Intel Gigabit3 NICs; single and dual port Intel PRO/1000 
MT Gigabit adapters
The following simple Perl script reproduces the problem:

#!/usr/bin/perl -w

use strict;
use IO::Socket;

my $remote_host = '';
my $remote_port = '80';
my $times = 300;

for (my $i = 0; $i < $times; $i++) {
        my $socket = new IO::Socket::INET(
                PeerAddr => $remote_host,
                PeerPort => $remote_port,
                Proto => 'tcp',
                Type => SOCK_STREAM) || die ("Can't connect: $@");

        print $socket "HEAD / HTTP/1.1\r\nHost:$remote_host\r\n\r\n";
        my $answer = <$socket>;


It'll work a few times and the produce the error:

Can't connect: IO::Socket::INET: connect: Network is unreachable at ./ line 12.

Running Apache's 'ab' will also have the same effect, as will running something like portupgrade on something like vim where lots of little patches are required to be downloaded individually.


More information about the freebsd-bugs mailing list