New section: "Setting Up Network Interface Cards"
The idea came from the old PPP-primer. I will add index entries later. Reviewed by: "english checking" and other fixes by mij
This commit is contained in:
parent
00655d1396
commit
972ca9fe30
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=14520
1 changed files with 391 additions and 0 deletions
|
|
@ -415,6 +415,397 @@ exit 0
|
|||
system boot.</para>
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<sect1info>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Marc</firstname>
|
||||
<surname>Fonvieille</surname>
|
||||
<contrib>Contributed by </contrib>
|
||||
<!-- 6 October 2002 -->
|
||||
</author>
|
||||
</authorgroup>
|
||||
</sect1info>
|
||||
|
||||
<title>Setting Up Network Interface Cards</title>
|
||||
|
||||
<para>Nowadays we can not think about a computer without thinking
|
||||
about a network connection. Adding and configuring a network
|
||||
card is a common task for any FreeBSD administrator.</para>
|
||||
|
||||
<sect2>
|
||||
<title>Locating the Correct Driver</title>
|
||||
|
||||
<para>Before you begin, you should know the model of the card
|
||||
you have, the chip it uses, and whether it is a PCI or ISA card.
|
||||
FreeBSD supports a wide variety of both PCI and ISA cards.
|
||||
Check the Hardware Compatibility List for your release to see
|
||||
if your card is supported.</para>
|
||||
|
||||
<para>Once you are sure your card is supported, you need
|
||||
to determine the proper driver for the card. The file
|
||||
<filename>/usr/src/sys/i386/conf/LINT</filename> will give you
|
||||
the list of network interfaces drivers with some information
|
||||
about the supported chipsets/cards. If you have doubts about
|
||||
which driver is the correct one, read the manual page of the
|
||||
driver. The manual page will give you more information about
|
||||
the supported hardware and even the possible problems that
|
||||
could occur.</para>
|
||||
|
||||
<para>If you own a common card, most of the time you will not
|
||||
have to look very hard for a driver. Drivers for common
|
||||
network cards are present in the <filename>GENERIC</filename>
|
||||
kernel, so your card should show up during boot, like so:</para>
|
||||
|
||||
<screen>dc0: <82c169 PNIC 10/100BaseTX> port 0xa000-0xa0ff mem 0xd3800000-0xd38
|
||||
000ff irq 15 at device 11.0 on pci0
|
||||
dc0: Ethernet address: 00:a0:cc:da:da:da
|
||||
miibus0: <MII bus> on dc0
|
||||
ukphy0: <Generic IEEE 802.3u media interface> on miibus0
|
||||
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
|
||||
dc1: <82c169 PNIC 10/100BaseTX> port 0x9800-0x98ff mem 0xd3000000-0xd30
|
||||
000ff irq 11 at device 12.0 on pci0
|
||||
dc1: Ethernet address: 00:a0:cc:da:da:db
|
||||
miibus1: <MII bus> on dc1
|
||||
ukphy1: <Generic IEEE 802.3u media interface> on miibus1
|
||||
ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto</screen>
|
||||
|
||||
<para>In this example, we see that two cards using the &man.dc.4;
|
||||
driver are present on the system.</para>
|
||||
|
||||
<para>To use your network card, you will need to load the proper
|
||||
driver. This may be accomplished in one of two ways. The
|
||||
easiest way is to simply load a kernel module for your network
|
||||
card with &man.kldload.8;. A module is not available for all
|
||||
network card drivers (ISA cards and cards using the &man.ed.4;
|
||||
driver, for example). Alternatively, you may statically compile
|
||||
the support for your card into your kernel. Check
|
||||
<filename>/usr/src/sys/i386/conf/LINT</filename> and the
|
||||
manual page of the driver to know what to add in your kernel
|
||||
configiration file. For more information about recompiling your
|
||||
kernel, please see <xref linkend="kernelconfig">. If your card
|
||||
was detected at boot by your kernel (<filename>GENERIC</filename>)
|
||||
you do not have to build a new kernel.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>Configuring the Network Card</title>
|
||||
|
||||
<para>Once the right driver is loaded for the network card, the
|
||||
card needs to be configured. As with many other things, the
|
||||
network card may have been configured at installation time by
|
||||
<application>sysinstall</application>.</para>
|
||||
|
||||
<para>To display the configuration for the network interfaces on
|
||||
your system, enter the folowing command:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>ifconfig</userinput>
|
||||
dc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255
|
||||
ether 00:a0:cc:da:da:da
|
||||
media: Ethernet autoselect (100baseTX <full-duplex>)
|
||||
status: active
|
||||
dc1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
|
||||
ether 00:a0:cc:da:da:db
|
||||
media: Ethernet 10baseT/UTP
|
||||
status: no carrier
|
||||
lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
|
||||
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
|
||||
inet 127.0.0.1 netmask 0xff000000
|
||||
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500</screen>
|
||||
|
||||
<note>
|
||||
<para>Old versions of FreeBSD may require the <option>-a</option>
|
||||
option following &man.ifconfig.8;, for more details about the
|
||||
correct syntax of &man.ifconfig.8;, please refer to the manual
|
||||
page. Note also that entries concerning IPv6
|
||||
(<literal>inet6</literal> etc.) were omitted in this
|
||||
example.</para>
|
||||
</note>
|
||||
|
||||
<para>In this example, the following devices were
|
||||
displayed:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><devicename>dc0</devicename>: The first Ethernet
|
||||
interface</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><devicename>dc1</devicename>: The second Ethernet
|
||||
interface</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><devicename>lp0</devicename>: The parallel port
|
||||
interface</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><devicename>lo0</devicename>: The loopback device</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para><devicename>tun0</devicename>: The tunnel device used by
|
||||
<application>ppp</application></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>FreeBSD uses the driver name followed by the order in
|
||||
which one the card is detected at the kernel boot to name the
|
||||
network card. For example <devicename>sis2</devicename> would
|
||||
be the third network card on the system using the &man.sis.4;
|
||||
driver.</para>
|
||||
|
||||
<para>In this example, the <devicename>dc0</devicename> device is
|
||||
up and running. The key indicators are:</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para><literal>UP</literal> means that the card is configured
|
||||
and ready.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The card has an Internet (<literal>inet</literal>)
|
||||
address (in this case 192.168.1.3).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>It has a valid subnet mask (<literal>netmask</literal>;
|
||||
0xffffff00 is the same as 255.255.255.0).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>It has a valid broadcast address (in this case,
|
||||
192.168.1.255).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The MAC address of the card (<literal>ether</literal>)
|
||||
is 00:a0:cc:da:da:da</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The physical media selection is on autoselection mode
|
||||
(<literal>media: Ethernet autoselect (100baseTX
|
||||
<full-duplex>)</literal>). We see that
|
||||
<devicename>dc1</devicename> was configured to run with
|
||||
<literal>10baseT/UTP</literal> media. For more
|
||||
information on available media types for a driver, please
|
||||
refer to its manual page.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The status of the link (<literal>status</literal>)
|
||||
is <literal>active</literal>, i.e. the carrier is detected.
|
||||
For <devicename>dc1</devicename>, we see
|
||||
<literal>status: no carrier</literal>. This is normal when
|
||||
an ethernet cable is not plugged into the card.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>If the &man.ifconfig.8; output had shown something similar
|
||||
to:</para>
|
||||
|
||||
<screen>dc0: flags=8843<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
|
||||
ether 00:a0:cc:da:da:da</screen>
|
||||
|
||||
<para>it would indicate the card has not been configured.</para>
|
||||
|
||||
<para>To configure your card, you need <username>root</username>
|
||||
privileges. The network card configuration can be done from the
|
||||
command line with &man.ifconfig.8; but you would have to do it
|
||||
after each reboot of the system. The file
|
||||
<filename>/etc/rc.conf</filename> is where to add the network
|
||||
card's configuration.</para>
|
||||
|
||||
<para>Open <filename>/etc/rc.conf</filename> in your favorite
|
||||
editor. You need to add a line for each network card present on
|
||||
the system, for example in our case, we added these lines:</para>
|
||||
|
||||
<programlisting>ifconfig_dc0="inet 192.168.1.3 netmask 255.255.255.0"
|
||||
ifconfig_dc1="inet 10.0.0.1 netmask 255.255.255.0 media 10baseT/UTP"</programlisting>
|
||||
|
||||
<para>You have to replace <devicename>dc0</devicename>,
|
||||
<devicename>dc1</devicename>, and so on, with
|
||||
the correct device for your cards, and the addresses with the
|
||||
proper ones. You should read the card driver and
|
||||
&man.ifconfig.8; manual pages for more details about the allowed
|
||||
options and also &man.rc.conf.5; manual page for more
|
||||
information on the syntax of
|
||||
<filename>/etc/rc.conf</filename>.</para>
|
||||
|
||||
<para>If you configured the network during installation, some
|
||||
lines about the network card(s) may be already present. Double
|
||||
check <filename>/etc/rc.conf</filename> before adding any
|
||||
lines.</para>
|
||||
|
||||
<para>You will also have to edit the file
|
||||
<filename>/etc/hosts</filename> add the names and the IP
|
||||
adresses of various machines of the LAN, if they are not already
|
||||
there. For more information please refer to &man.hosts.5;
|
||||
and to <filename>/usr/share/examples/etc/hosts</filename>.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>Testing and Troubleshooting</title>
|
||||
|
||||
<para>Once you have made the necessary changes in
|
||||
<filename>/etc/rc.conf</filename>, you should reboot your
|
||||
system. This will allow the change(s) to the interface(s) to
|
||||
be applied, and verify that the system restarts without any
|
||||
configuration errors.</para>
|
||||
|
||||
<para>Once the system has been rebooted, you should test the
|
||||
network interfaces.</para>
|
||||
|
||||
<sect3>
|
||||
<title>Testing the Ethernet Card</title>
|
||||
|
||||
<para>To verify that an Ethernet card is configured correctly,
|
||||
you have to try two things. First, ping the interface itself,
|
||||
and then ping another machine on the LAN.</para>
|
||||
|
||||
<para>First let's test the interface:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>ping -c5 192.168.1.3</userinput>
|
||||
PING 192.168.1.3 (192.168.1.3): 56 data bytes
|
||||
64 bytes from 192.168.1.3: icmp_seq=0 ttl=64 time=0.082 ms
|
||||
64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.074 ms
|
||||
64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=0.076 ms
|
||||
64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=0.108 ms
|
||||
64 bytes from 192.168.1.3: icmp_seq=4 ttl=64 time=0.076 ms
|
||||
|
||||
--- 192.168.1.3 ping statistics ---
|
||||
5 packets transmitted, 5 packets received, 0% packet loss
|
||||
round-trip min/avg/max/stddev = 0.074/0.083/0.108/0.013 ms</screen>
|
||||
|
||||
<para>Now we have to ping another machine on the LAN:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>ping -c5 192.168.1.2</userinput>
|
||||
PING 192.168.1.2 (192.168.1.2): 56 data bytes
|
||||
64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=0.726 ms
|
||||
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.766 ms
|
||||
64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.700 ms
|
||||
64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.747 ms
|
||||
64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.704 ms
|
||||
|
||||
--- 192.168.1.2 ping statistics ---
|
||||
5 packets transmitted, 5 packets received, 0% packet loss
|
||||
round-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</screen>
|
||||
|
||||
<para>You could also use the machine name instead of
|
||||
<literal>192.168.1.2</literal> if you have set up the
|
||||
<filename>/etc/hosts</filename> file.</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>Troubleshooting</title>
|
||||
|
||||
<qandaset>
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>Where can I find information about possible trouble
|
||||
I may experience with my network card?</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>The manual page of the driver is the first piece of
|
||||
documentation to read. The mailing lists archives can
|
||||
also be useful.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>When I try to ping a machine on my LAN, I get this
|
||||
message: <errorname>ping: sendto: Permission
|
||||
denied</errorname>.</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>This means that you do not have permission to
|
||||
send ICMP packets. Check to see if a firewall is
|
||||
running on the machine and if there are any rules
|
||||
blocking ICMP.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>I see a lot of <errorname>watchdog
|
||||
timeout</errorname> messages in the system logs, and
|
||||
when I try to ping a machine on the LAN, I get this
|
||||
message: <errorname>ping: sendto: No route to
|
||||
host</errorname>.</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>The first thing to do is to check your network
|
||||
cable. Many cards require a PCI slot supporting the
|
||||
Bus Mastering. On some old motherboards, only one PCI
|
||||
slot allows it (most of time slot 0). Check the
|
||||
network card and the motherboard documentation to
|
||||
determine if that may be the problem.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>I see a lot of <errorname>device timeout</errorname>
|
||||
messages in the system logs, and my network card does not
|
||||
work.</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>Having one or two of these messages is sometimes
|
||||
normal with some cards. However, if they persist and the
|
||||
network is not usable, make sure the network cable is
|
||||
plugged in and that there are no IRQ conflicts between
|
||||
the network card and another device (or devices) on the
|
||||
system.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>The performance of the card is poor, what can I
|
||||
do?</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>It is difficult to answer to that question. What is
|
||||
your definition of <quote>poor performance</quote>? Double
|
||||
check everything in your configuration, read the
|
||||
&man.tuning.7; manual page, and try to avoid cheap
|
||||
network cards. Many users have noted that setting the
|
||||
media selection mode to <literal>autoselect</literal>
|
||||
results in bad performance on some hardware.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>Are there any recommended network cards or cards I
|
||||
should stay away from?</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>You should avoid cheap cards for serious usage. Cheap
|
||||
cards often use buggy chipsets, and most of time do not
|
||||
provide very good performance. Many FreeBSD users like
|
||||
cards using the &man.fxp.4; chipset, however, this does
|
||||
not mean that all other chipsets are bad.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
</qandaset>
|
||||
</sect3>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="configtuning-virtual-hosts">
|
||||
<title>Virtual Hosts</title>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue