Usually the first step after installing NetBSD is to get the network card configured so you can get online.
Once you’re able to get connected to your network, you can begin downloading software and start adding functionality to your system. All settings can be made via the command line and using a GUI is not necessary.
At this point we assume you have NetBSD installed on your system and you’re able to successfully log into the system as root or with root privileges. You should also have some basic UNIX skills such as changing directories and editing files with VI.
First we need to identify the network card device ID. We do this by running ‘ifconfig’. This will output the current network devices installed in the system and what their current settings are.
ifconfig -a
Here is a sample output after running ifconfig:
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
address: 00:40:63:ea:c4:9a
media: Ethernet autoselect (100baseTX full-duplex)
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
inet 127.0.0.1 netmask 0xff000000
From the output, we can see that ‘vr0′ is the network card we want to configure based on ‘media: Ethernet’ indicated in the output. We can now assign an IP address to it. To do this, we add a line to the ‘/etc/rc.conf’ system config file that looks like this. Make sure to use an IP address that is compatible with your network.
ifconfig_vr0="192.168.1.253 netmask 255.255.255.0 media autoselect"
If you want to use DHCP instead, you would simply add a new line to the rc.conf file:
dhclient="YES"
Next we need to specify a ‘defaultroute’ so that our NetBSD systems knows how to get out to the internet. This is usually the IP address of your firewall or Linksys router, etc. We specify the defaultroute by adding another line to the rc.conf file.
defaultroute="192.168.1.254"
The last step is to specify a DNS server so that our NetBSD system knows how to find web sites and other servers on the internet. To do this, we create a new file named ‘resolv.conf’ in /etc and add the following line. We chose to use an OpenDNS server.
nameserver 208.67.222.222
If you have not specified a hostname for your system yet, this would be a good time to do so. To do this, you add the hostname to the rc.conf file by adding a new line. Make sure to specify a hostname that is compatible with your network.
hostname="netbsd"
It is usually a good idea to then add the local hostname to the ‘/etc/hosts’ file. Use the IP address that you assigned to the network card above.
192.168.1.253 netbsd
This concludes configuring the basic network settings. You can now reboot the system and allow the settings to take affect.