Mark's NetBSD Networking How-To


WARNING: The information in this page is grossly out-dated. I will leave the pages up in case they might be of some use.

NOTE: I have not used NetBSD for more than 2 years! I have not used MacOS or Mac hardware in more than three years. If you have questions, you are probably better off e-mailing the NetBSD mailing lists rather than me.


NetBSD Note: These instructions assume that you have a Macintosh already running NetBSD 1.3x. Note that some of these instructions will not work for the 1.2 and 1.2.1 distributions of NetBSD. I have tried to point out where 1.3 differs from 1.2, but I can't make any promises. Also, if you are unclear about terminology used in sections 1 and 2, please see section 3 first.

Contents

  1. Connecting Your NetBSD Computer to the Internet Via Ethernet
  2. Setting up a Local Ethernet Network that is Not Connected to the Internet


Connecting Your NetBSD Computer to the Internet Via Ethernet

This section assumes that you have a NetBSD computer that you would like to connect to a local-area network that has an Internet connection. In this case, you may or may not have control over the Internet connection and network setup. It also assumes that you have an Ethernet card or on-board Ethernet interface and it is recognized by NetBSD.

Getting Ready

Before you start, you will need the following information:

  1. IP Address for your NetBSD computer.
  2. Hostname for your NetBSD computer.
  3. Domain name for your network.
  4. Netmask for your network.
  5. IP Address(es) for your network name server(s).
  6. The IP Address for your network gateway (router).

In this tutorial, I will use the following values as examples:

Configuring the System

  1. Edit the /etc/rc.conf file. Enter information in the Basic network configuration area:

    hostname="Your Hostname"
    domainname="Your Domain Name"
    defaultroute="Your Gateway"

    Here is how I have set it up in my example file:

    hostname="binky"
    domainname="lifeinhell.net"
    defaultroute="202.233.42.1"

    Note that this setup with the /etc/rc.conf file is new to NetBSD 1.3. For information on 1.2, see the MacBSD Networking How-To.

  2. Create a file called /etc/resolv.conf as follows:

    domain Your Domain Name
    nameserver Your Name Server
    nameserver Another Name Server (Optional)
    lookup bind file

    Here is how I have set it up in my example file:

    domain lifeinhell.net
    nameserver 202.233.42.2
    nameserver 210.132.192.6
    lookup bind file

    You really only need one name server entry, but if your network has more than one (and it really should), then add in the second (or third). If you would like the name resolver to check your /etc/hosts before it checks the name server, change the final line to:

    lookup file bind

  3. Create an /etc/ifconfig.xxN file as follows:

    inet Your IP Address netmask Your Netmask

    Here is how I have set it up in my example file:

    inet 202.233.42.4 netmask 255.255.255.0

    The actual filename that you need to create depends on the type of Ethernet card or interface that you have. On the mac68k-port, the two most common type are ae for Apple Ethernet and sn for Sonic. You can use the dmesg command to examine your boot log and see what interface, if any, that NetBSD has recognized. On my IIcx with a Asante Mac-Con ethernet card, I get:

    ae0 at nubus0 slot 9: MacCon Ethernet, 32KB memory
    ae0: Ethernet address 00:00:94:61:3d:e5

    Therefore, I have created a /etc/ifconfig.ae0 file. On my Centris 650, I am using on-board Ethernet which uses the Sonic chip-set. At boot time, I get:

    sn0 at obio0 address 08:00:07:0c:97:23

    Therefore, I have created a /etc/ifconfig.sn0 file on my Centris 650. Note: The use of the /etc/ifconfig.xxN is not found in the 1.2 distribution. See the MacBSD Networking How-To for information on setting up a /etc/hostname.xxN file.

  4. The final step is to reboot your machine to allow the changes to take effect.

Testing Your Connection

As you are rebooting, watch the console for error messages. Use the ping command to test your connectivity. Try to ping the gateway machine IP address first. This will test local connectivity on the LAN. If you cannot ping the gateway, you are not going to be able to connect to the Internet. If you cna ping the gateway, try pinging a known host on the Internet. For example, ping www.netbsd.org will test both the ability to do a DNS lookup from your name server as well as your ability to connect to the Internet.


Setting up a Local Ethernet Network that is Not Connected to the Internet

This section assumes that you have a NetBSD computer that you would like to connect to a local-area network that does not have an Internet connection. It does, however, assume that you have more than one computer that you would like to connect via an Ethernet connection. It also assumes that you have an Ethernet card or on-board Ethernet interface and it is recognized by NetBSD. The example I use in this section describes the actual network I have set up in my home.

Getting Ready

  1. First, you will need to physically connect the computers on your network. This means that all computers will need a network interface (Ethernet) card. You will also need to physically connect them via Ethernet cable. If you only have two computers, you can connect them directly using a crossed 10Base-T Ethernet cable or a single BNC (Thinnet) cable. In the case of BNC, you will still wnat to use terminators on both ends. If you have more than two computers, you can use BNC cable to connect them in a chain. If you are going to use 10Base-T cable, you will need to purchase a hub. You should be able to pick up a 5 or 8 port hub for a very reasonable price. Personally, I am using 10Base-T cable and an 8-port hub.
  2. Next, you will need to decide on an IP address block. RFC 1918 specifies that the following networks are "internal" and cannot be used on the "real" Internet.

    10.0.0.0 to 10.255.255.255
    172.16.0.0 to 172.31.255.255
    192.168.0.0 to 192.168.255.255

    In my case, I decided to use a single class C block 192.168.3.0. Since I am using a class C, my netamsk will be 255.255.255.0.

  3. Finally, you will decide on a domain name and hostnames for your computers. If you are going to connect to an Internet provider (ISP) via PPP, then you will probably want to use your provider's domain name so you do not have problems with PPP. Actually, once you have your network setup, you might want to consider using IP-NAT. Armen Babikyan wrote up an excellent IP-NAT How-To. In my case, I used the following:

    Domain Name: giganet.net (my ISP)
    Host 1: ratbert 192.168.3.1 (Centris 650 running NetBSD)
    Host 2: bullwinkle 192.168.3.2 (Mac IIcx running NetBSD)
    Host 3: bob 192.168.3.3 (IBM Thinkpad running FreeBSD)
    Host 4: macos 192.168.3.4 (Mac IIvi running MacOS)

Mark's LAN Diagram

Diagram of My LAN

Configuring the NetBSD Files

If you have read through Section 1 above, you may have noticed that we now have all the required information except for the gateway address. Since our LAN is not connected to the Internet, we will not use the gateway address. Now, we will follow the same basic steps as in Section 1. My examples come from my setup on my Centris 650.

  1. Edit the /etc/rc.conf file. Enter information in the Basic network configuration area:

    hostname="Your Hostname"
    domainname="Your Domain Name"
    defaultroute=""

    It is important to leave the defaultroute line blank. Here is how I have set it up on my Centris 650:

    hostname="ratbert"
    domainname="giganet.net"
    defaultroute=""

    Note that this setup with the /etc/rc.conf file is new to NetBSD 1.3. For information on 1.2, see the MacBSD Networking How-To.

  2. Create a file called /etc/resolv.conf as follows:

    domain Your Domain Name
    lookup file

    This tells NetBSd to use the /etc/hosts file to lookup the hostname to IP address mappings. If you also connect to the Internet via PPP on the same machine, you will want to set it up as follows:

    domain Your Domain Name
    nameserver Your Provider's Name Server
    nameserver Another Name Server (Optional)
    lookup file bind

    This tells NetBSD to first check the /etc/hosts file and use the name servers if it cannot find an entry in the /etc/hosts file. Since Ratbert also connects to the Internet via PPP, here is how I have set it up on my C650:

    domain giganet.net
    nameserver 203.182.192.135
    nameserver 203.182.192.35
    lookup file bind

  3. Edit the /etc/hosts file to create your LAN hist to IP mappings. Here is how I have set up mine:

    127.0.0.1 localhost localhost.giganet.net
    192.168.3.1 ratbert ratbert.giganet.net
    192.168.3.2 bullwinkle bullwinkle.giganet.net
    192.168.3.3 bob bob.giganet.net
    192.168.3.4 macos macos.giganet.net

    The /etc/hosts for all three *BSD machines is the exact same.

  4. Create an /etc/ifconfig.xxN file as follows:

    inet Your IP Address netmask Your Netmask

    Here is how I have set it up in my /etc/ifconfig.sn0 file on Ratbert:

    See Section 1 above if you do not understand how to determine the "xxN" part of the filename.

    inet 192.168.3.1 netmask 255.255.255.0

  5. The final step is to reboot your machine to allow the changes to take effect.

Testing Your Network

As you are rebooting, watch the console for error messages. Use the ping command to test your connectivity. Try to ping the gateway machine IP address first. This will test local connectivity on the LAN. If you cannot ping the gateway, you are not going to be able to connect to the Internet. If you cna ping the gateway, try pinging a known host on the Internet. For example, ping www.netbsd.org will test both the ability to do a DNS lookup from your name server as well as your ability to connect to the Internet.

Aagain, once you have your network setup, you might want to consider using IP-NAT. Armen Babikyan wrote up an excellent IP-NAT How-To. With IP-NAT, you can connect to the Internet from any machine on your LAN over a single PPP connection at the same time!

Final Notes

I did not include instructions on how to set up computers running other operating systems. I did this on purpose. B-> It should be fairly straight forward to set up under MacTCP, Open Transport, FreeBSD, BSDI, or Windows 95/NT. But if you have questions, you can e-mail me as I have set up networking under those operating systems. If you have Linux, OS/2, or some other OS, you should be able to connect it to your LAN, but please do not ask me for help.

FAQ 1: Should I run routed?
Simple answer: No!
Long answer: No you should not. The routed daemon is the UN*X implementation of the RIP routing protocol. There is no need to use routing since you only have a single network. A general rule of thumb is that you do not need a routing protocol unless you have two Ethernet cards.

FAQ 2: Should I run named?
Simple answer: No!
Long answer: No you should not. The named daemon (also known as BIND) acts as a DNS server. If you do not have a permanent Internet connection, there is no need to run named. In fact, running named could cause problems with a stand alone LAN. Use the /etc/hosts file to map your hostnames to IP addresses.


Go Back
Back to my Mark's MacBSD How-To Index.


Last updated, 98-09-19.
This page and all pages in this site are Copyright 1997-98 by Mark Andres. All right reserved.

URL for this page: http://www2.giganet.net/~mark/NetBSD/howtos/net-howto.html