Results 1 to 2 of 2

Thread: Setting up networking in netBSD

  1. #1
    Advisor
    Join Date
    Apr 2002
    Posts
    858

    Setting up networking in netBSD

    Is there a nice command similar to netconf from slackware in netBSD to set up networking or is it all done through the difficult to use (in my opinion) ifconfig command? or are there config files to edit somewhere? I would like to get my netBSD system networked but don't really know where to start. Any info would be much appreciated.

  2. #2
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:Setting up networking in netBSD

    10.1.4. Creating a small home network

    Networking is one of the main strengths of Unix and NetBSD is no exception: networking is both powerful and easy to set up and inexpensive too, because there is no need to buy additional software to communicate or to build a server. Section 10.2.1 explains how to configure a NetBSD machine to act as a gateway for a network: with IPNAT all the hosts of the network can reach the Internet with a single connection to a provider made by the gateway machine. The only thing to be checked before creating the network is to buy network cards supported by NetBSD (check the INSTALL file for a list of supported devices.)

    First, the network cards must be installed and connected to a hub, switch or directly (see Figure 10-1.)

    Next, check that the network cards are recognized by the kernel, studying the output of the dmesg command. In the following example the kernel recognized correctly an NE2000 clone:

    ...
    ne0 at isa0 port 0x280-0x29f irq 9
    ne0: NE2000 Ethernet
    ne0: Ethernet address 00:c2:dd:c1:d1:21
    ...

    If the card is not recognized by the kernel, check that it is enabled in the kernel configuration file and then that the card's IRQ matches the one that the kernel expects. For example, this is the isa NE2000 line in the configuration file; the kernel expects the card to be at IRQ 9.

    ...
    ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards
    ...

    If the card's configuration is different, it will probably not be found at boot. In this case, either change the line in the kernel configuration file and compile a new kernel or change the card's setup (usually through a setup disk or, for old cards, a jumper on the card.)

    The following command shows the network card's current configuration:

    # ifconfig ne0
    ne0: flags=8822<BROADCAST,NOTRAILERS,SIMPLEX,MULTICA ST> mtu 1500 media: Ethernet 10base2

    The software configuration of the network card is very easy. The IP address "192.168.1.1" (which is reserved for internal networks) is assigned to the card.

    # ifconfig ne0 inet 192.168.1.1 netmask 0xffffff00

    Repeating the previous command now gives a different result:

    # ifconfig ne0
    ne0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMP LEX,MULTICAST> mtu 1500
    media: Ethernet 10base2
    inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255

    The output of ifconfig has now changed: the IP address is now printed and there are two new flags, "UP" and "RUNNING". If the interface isn't "UP", it will not be used by the system to send packets.

    The host was given the IP address 192.168.1.1, which belongs to the set of addresses reserved for internal networks which are not reachable from the Internet. The configuration is finished and must now be tested; if there is another active host on the network, a ping can be tried. For example, if 192.168.1.2 is the address of the active host:

    # ping 192.168.1.2
    PING ape (192.168.1.2): 56 data bytes
    64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=1.286 ms
    64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0.649 ms
    64 bytes from 192.168.1.2: icmp_seq=2 ttl=255 time=0.681 ms
    64 bytes from 192.168.1.2: icmp_seq=3 ttl=255 time=0.656 ms
    ^C
    ----ape PING Statistics----
    4 packets transmitted, 4 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.649/0.818/1.286/0.312 ms

    With the current setup, at the next boot it will be necessary to repeat the configuration of the network card. In order to avoid repeating the card's configuration at each boot, two things need to be done: first, create the file /etc/ifconfig.ne0 containing the following line:

    inet 192.168.1.1 netmask 0xffffff00

    Next, in the /etc/rc.conf file, set the following option

    auto_ifconfig=YES

    At the next boot the network card will be configured automatically.

    The /etc/hosts file is a database of IP addresses and textual aliases: it should contain the addresses of all the hosts belonging to the internal network. For example:

    Example 10-9. /etc/hosts

    # $NetBSD: hosts,v 1.4 1997/01/09 05:33:14 mikel Exp $
    #
    # Host Database
    # This file should contain the addresses and aliases
    # for local hosts that share this file.
    # It is used only for "ifconfig" and other operations
    # before the nameserver is started.
    #
    #
    127.0.0.1 localhost
    #
    # RFC 1918 specifies that these networks are "internal".
    # 10.0.0.0 10.255.255.255
    # 172.16.0.0 172.31.255.255
    # 192.168.0.0 192.168.255.255

    192.168.1.1 ape.insetti.net ape
    192.168.1.2 vespa.insetti.net vespa
    192.168.1.0 insetti.net

    The /etc/nsswitch.conf should be modified as explained in Example 10-2.

    Note: in this example the file /etc/ifconfig.ne0 was created because the network card was recognized as ne0 by the kernel; if you are using a different adapter, substitute the appropriate name in place of ne0.

    Summing up, to configure the network the following must be done: the network adapters must be installed and physically connected. Next they must be configured (with ifconfig) and, finally, the /etc/hosts and /etc/nsswitch.conf files must be modified. This type of network management in very simplified and is suited only for small networks without sophisticated needs.

Similar Threads

  1. ibm just loves netBSD!!!
    By capybara in forum BSD
    Replies: 6
    Last Post: 01-25-2007, 01:16 AM
  2. NetBSD 2.0 Released
    By shebang in forum BSD
    Replies: 1
    Last Post: 02-19-2005, 12:15 AM
  3. Removed NETBSD
    By paradox in forum Announcements and Suggestions
    Replies: 4
    Last Post: 11-14-2003, 12:58 AM
  4. X on netBSD
    By kornp in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 06-19-2002, 01:09 AM
  5. NetBSD
    By Semp in forum Linux - General Topics
    Replies: 5
    Last Post: 03-13-2002, 12:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •