How to connect laptop and desktop w/NICs

Matthew Seaman m.seaman at
Fri Apr 11 07:12:58 PDT 2003

On Fri, Apr 11, 2003 at 01:10:53PM +0100, Jonathon McKitrick wrote:
> Hi all,
> I am making a first foray into home networking.  I have little (read: none)
> experience in this.  All I have done is my firewall for my dialup on my
> laptop.
> My new desktop box just had 4.8 installed, and the laptop is 4.7.  Both have
> NIC cards.  I have a set of cables and a switch, and also a direct
> (crossover) network cable.

Ummm... Plug a cable in to each NIC and then connect to the central
switch?  Make sure the switch is powered up, and that it has green
(for values of green that can include yellow or amber depending on the
model of switch you're using) lights showing to say it's detected the
connection to your two machines.  There may also be LEDs on your NICs
that show that you've got a connection there.  Now try bringing up the
interface on each machine:

On the desktop:

    ifconfig xl0 inet up

on the laptop:

    ifconfig fxp0 inet up

where (obviously) you should substitute the correct device names for
xl0 and fxp0.

Now you should be able to test basic connectivity by pinging one
machine from the other:


and you should see lights flash on the networking kit to indicate
activity, and the ping command should show packets coming back with a
round-trip time of about 1ms ish on 100mb/s networks.

That's basically it for a local connection.  You can put entries into
/etc/hosts to map hostnames onto those IP numbers for ease of use, and
you can add entries to /etc/rc.conf to make the interfaces
autoconfigure on boot up:

    ifconfig_xl0="inet netmask 0xffffff00"

You could also use your crossover cable to make a direct connection
machine to machine, but in that case you will have to override the
autodetection of link speed etc., and make sure both ends are running
at the same speed and duplex settings:

    ifconfig_xl0="inet netmask 0xffffff00 media 100baseTX mediaopt full-duplex"

but generally it's easier just to plug into a switch and let it work
out the settings automatically.
> What is the easiest way to 
> Connect my laptop to my desktop for file transfers?

As above.
> Also, I followed basic instructions for setting up natd and a gateway on the
> laptop so I could dial out and have the desktop use it as a gateway, but the
> desktop does not seem to recognize anything beyond its NIC card.  What steps
> should I follow to figure out where my config is wrong?

On your laptop you need to have:


in /etc/rc.conf, or it won't route packets between it's interfaces.

On your desktop you need to have:


(ie. the IP number of your laptop) as the default route to send any
packets not detined for locally attached networks.

You should also beware that the firewall on your laptop permits your
desktop machine to pass packets to and fro.  It's probably best to
temporarily disable your firewall while your working out how the
networking goes together --- just add a 'pass all' rule that short
circuits the rest of the ruleset:

    ipfw add 1 add allow ip from any to any

and that you can delete once you're done:

    ipfw delete 1 

(That way, if you lose connectivity when you bring the firewall back
up, you know it's that which must have caused it.)

For diagnosing problems with networking, always start by verifying
that the physical connectivity is there.  Inspect the cabling and make
sure that RJ45 jacks are pushed home into sockets.  Make sure the
blinkenlights are showing the correct status.  Use 'netstat -i' to see
if you're getting any errors on the interfaces: you shouldn't be
getting any on a home network although you may see collisions if
you're not on a full-duplex setup.

Once you've eliminated the local hardware, start to think further
afield.  Use ping(8) to test that you can get packets to and fro using
the IP number of another machine on the same local network.  Then ping
machines further away or use traceroute to determine where the problem
is.  Use tcpdump(1) to look at the network traffic on intermediate
gateways.  Remember that problems with the DNS can give the effect of
being unable to connect to a remote site, even though the networking
setup is perfectly sound: use 'dig' or 'host' to verify that you can
resolve hostnames into IP numbers.

A good introductory text on IP networking is the Crab book "TCP/IP
Network Administration" by Craig Hunt



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list