📄 config-network-setup.html
字号:
<li><p>The physical media selection is on autoselection mode (<var class="LITERAL">media:Ethernet autoselect (100baseTX <full-duplex>)</var>). We see that <ttclass="DEVICENAME">dc1</tt> was configured to run with <varclass="LITERAL">10baseT/UTP</var> media. For more information on available media typesfor a driver, please refer to its manual page.</p></li><li><p>The status of the link (<var class="LITERAL">status</var>) is <varclass="LITERAL">active</var>, i.e. the carrier is detected. For <ttclass="DEVICENAME">dc1</tt>, we see <var class="LITERAL">status: no carrier</var>. Thisis normal when an Ethernet cable is not plugged into the card.</p></li></ol><p>If the <a href="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a> output hadshown something similar to:</p><pre class="SCREEN">dc0: flags=8843<BROADCAST,SIMPLEX,MULTICAST> mtu 1500 ether 00:a0:cc:da:da:da</pre><p>it would indicate the card has not been configured.</p><p>To configure your card, you need <tt class="USERNAME">root</tt> privileges. Thenetwork card configuration can be done from the command line with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a> but youwould have to do it after each reboot of the system. The file <ttclass="FILENAME">/etc/rc.conf</tt> is where to add the network card's configuration.</p><p>Open <tt class="FILENAME">/etc/rc.conf</tt> in your favorite editor. You need to add aline for each network card present on the system, for example in our case, we added theselines:</p><pre class="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"</pre><p>You have to replace <tt class="DEVICENAME">dc0</tt>, <tt class="DEVICENAME">dc1</tt>,and so on, with the correct device for your cards, and the addresses with the properones. You should read the card driver and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ifconfig&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ifconfig</span>(8)</span></a> manualpages for more details about the allowed options and also <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=rc.conf&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">rc.conf</span>(5)</span></a> manual pagefor more information on the syntax of <tt class="FILENAME">/etc/rc.conf</tt>.</p><p>If you configured the network during installation, some lines about the networkcard(s) may be already present. Double check <tt class="FILENAME">/etc/rc.conf</tt>before adding any lines.</p><p>You will also have to edit the file <tt class="FILENAME">/etc/hosts</tt> to add thenames and the IP addresses of various machines of the LAN, if they are not already there.For more information please refer to <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=hosts&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">hosts</span>(5)</span></a> and to <ttclass="FILENAME">/usr/share/examples/etc/hosts</tt>.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN16216" name="AEN16216">11.8.3 Testing andTroubleshooting</a></h2><p>Once you have made the necessary changes in <tt class="FILENAME">/etc/rc.conf</tt>,you should reboot your system. This will allow the change(s) to the interface(s) to beapplied, and verify that the system restarts without any configuration errors.</p><p>Once the system has been rebooted, you should test the network interfaces.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN16221" name="AEN16221">11.8.3.1 Testing the EthernetCard</a></h3><p>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.</p><p>First test the local interface:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">ping -c5 192.168.1.3</kbd>PING 192.168.1.3 (192.168.1.3): 56 data bytes64 bytes from 192.168.1.3: icmp_seq=0 ttl=64 time=0.082 ms64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.074 ms64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=0.076 ms64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=0.108 ms64 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 lossround-trip min/avg/max/stddev = 0.074/0.083/0.108/0.013 ms</pre><p>Now we have to ping another machine on the LAN:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">ping -c5 192.168.1.2</kbd>PING 192.168.1.2 (192.168.1.2): 56 data bytes64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=0.726 ms64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.766 ms64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.700 ms64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.747 ms64 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 lossround-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</pre><p>You could also use the machine name instead of <tt class="HOSTID">192.168.1.2</tt> ifyou have set up the <tt class="FILENAME">/etc/hosts</tt> file.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16238" name="AEN16238">11.8.3.2 Troubleshooting</a></h3><p>Troubleshooting hardware and software configurations is always a pain, and a painwhich can be alleviated by checking the simple things first. Is your network cableplugged in? Have you properly configured the network services? Did you configure thefirewall correctly? Is the card you are using supported by FreeBSD? Always check thehardware notes before sending off a bug report. Update your version of FreeBSD to thelatest STABLE version. Check the mailing list archives, or perhaps search theInternet.</p><p>If the card works, yet performance is poor, it would be worthwhile to read over the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=tuning&sektion=7"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">tuning</span>(7)</span></a> manual page.You can also check the network configuration as incorrect network settings can cause slowconnections.</p><p>Some users experience one or two ``<tt class="ERRORNAME">device timeout</tt>''messages, which is normal for some cards. If they continue, or are bothersome, you maywish to be sure the device is not conflicting with another device. Double check the cableconnections. Perhaps you may just need to get another card.</p><p>At times, users see a few ``<tt class="ERRORNAME">watchdog timeout</tt>'' errors. Thefirst thing to do here is to check your network cable. Many cards require a PCI slotwhich supports Bus Mastering. On some old motherboards, only one PCI slot allows it(usually slot 0). Check the network card and the motherboard documentation to determineif that may be the problem.</p><p>``<tt class="ERRORNAME">No route to host</tt>'' messages occur if the system is unableto route a packet to the destination host. This can happen if no default route isspecified, or if a cable is unplugged. Check the output of <tt class="COMMAND">netstat-rn</tt> and make sure there is a valid route to the host you are trying to reach. Ifthere is not, read on to <a href="advanced-networking.html">Chapter 24</a>.</p><p>``<tt class="ERRORNAME">ping: sendto: Permission denied</tt>'' error messages areoften caused by a misconfigured firewall. If <tt class="COMMAND">ipfw</tt> is enabled inthe kernel but no rules have been defined, then the default policy is to deny alltraffic, even ping requests! Read on to <a href="firewalls.html">Section 14.9</a> formore information.</p><p>Sometimes performance of the card is poor, or below average. In these cases it is bestto set the media selection mode from <var class="LITERAL">autoselect</var> to the correctmedia selection. While this usually works for most hardware, it may not resolve thisissue for everyone. Again, check all the network settings, and read over the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=tuning&sektion=7"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">tuning</span>(7)</span></a> manualpage.</p></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="configtuning-rcng.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="configtuning-virtual-hosts.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Using rc under FreeBSD 5.X</td><td width="34%" align="center" valign="top"><a href="config-tuning.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Virtual Hosts</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -