The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

2.2. Verifying the Ethernet Interface Configuration

To reiterate our basic assumption, this guide assumes that the Ethernet Interface in the FreeBSD system is named 'ed0'. This is the default for NE-1000, NE-2000, WD/SMC models 8003, 8013 and Elite Ultra (8216) network adapters.

Other models of network adapters may have different device names in FreeBSD. Check the FAQ for specifics about your network adapter. If you're not sure of the device name of your adapter, check the FreeBSD FAQ to determine the device name for the card you have and substitute that name (i.e.: 'de0', 'zp0', or similar) in the following steps.

As was the case with the host name, the configuration for the FreeBSD system's Ethernet Interface may have been specified when the system was installed.

To display the configuration for the interfaces in your FreeBSD system (Ethernet and others), enter the following command:

    # ifconfig -a
(In layman's terms: "Show me the InterFace CONFIGuration for my network devices.")

An example:

    # ifconfig -a
     ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu
    1500
          inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
          ether 01:02:03:04:05:06
     lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
     tun0: flags=8050<POINTOPOINT,RUNNING, MULTICAST> mtu 1500
     sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
     ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
     lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
          inet 127.0.0.1 netmask 0xff000000
    # _


In this example, the following devices were displayed:

ed0: The Ethernet Interface

lp0: The Parallel Port Interface (ignored in this guide)

tun0: The "tunnel" device; This is the one user-mode ppp uses!

sl0: The SL/IP device (ignored in this guide)

ppp0: Another PPP device (for kernel ppp; ignored in this guide)

lo0: The "Loopback" device (ignored in this guide)

In this example, the 'ed0' device is up and running. The key indicators are:

  1. Its status is "UP",

  2. It has an Internet ("inet") address, (in this case, 192.168.1.1)

  3. It has a valid Subnet Mask ("netmask"; 0xffffff00 is the same as 255.255.255.0), and

  4. It has a valid broadcast address (in this case, 192.168.1.255).



If the line for the Ethernet card had shown something similar to:

    ed0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
            ether 01:02:03:04:05:06
then the Ethernet card hasn't been configured yet.

If the configuration for the Ethernet interface is correct you can skip forward to Section 2.4.

2.2.1. Configuring your Ethernet Interface

Reminder: You must be logged in as 'root' to edit the system configuration files!

CAUTION: If you mangle the system configuration files, chances are your system WILL NOT BOOT correctly! Be careful!

The configuration file that specifies settings for the network interfaces when the system boots is in /etc/rc.conf. Use the default text editor ('ee') to edit this file.

Logged in as user 'root' load /etc/rc.conf into the editor with the following command:

# ee /etc/rc.conf

About 20 lines from the top of /etc/rc.conf is the section that describes which network interfaces should be activated when the system boots. In the default configuration file the specific line that controls this is:

    network_interfaces="lo0"       # List of network interfaces (lo0 is loopback).


You'll need to amend this line to tell FreeBSD that you want to add another device, namely the 'ed0' device. Change this line to read:

    network_interfaces="lo0 ed0"   # List of network interfaces (lo0 is loopback).


(Note the space between the definition for the loopback device ("lo0") and the Ethernet device ("ed0")!

Reminder: If your Ethernet card isn't named 'ed0', specify the correct device name here instead.

If you performed the installation of FreeBSD over a network connection then the 'network_interfaces=' line may already include a reference to your Ethernet adapter. If it is, verify that it is the correct device name.

Specify the Interface Settings for the Ethernet device ('ed0'):

Beneath the line that specifies which interfaces should be activated are the lines that specify the actual settings for each interface. In the default /etc/rc.conf file is a single line that says:

    ifconfig_lo0="inet 127.0.0.1"   # default loopback device configuration.


You'll need to add another line after that to specify the settings for your 'ed0' device.

If you performed the installation of FreeBSD over a network connection then there may already be an 'ifconfig_ed0=' line after the loopback definition. If so, verify that it has the correct values.

For our sample configuration we'll insert a line immediately after the loopback device definition that says:

    ifconfig_ed0="inet 192.168.1.1 netmask 255.255.255.0"


When you've finished editing /etc/rc.conf to specify and configure the network interfaces the section should look really close to:

    ---
    network_interfaces="ed1 lo0"    # List of network interfaces (lo0 is loopback).
    ifconfig_lo0="inet 127.0.0.1"   # default loopback device configuration.
    ifconfig_ed1="inet 192.168.1.1  netmask 255.255.255.0"
    ---


Once all of the necessary changes to /etc/rc.conf have been made, press the 'Esc' key to invoke the control menu. Select "leave editor" and be sure to select "save changes" when prompted.

For questions about FreeBSD, e-mail <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру