Skip to content

Configure Network on NetBSD

NetBSD

Operating System 6.0.1
Website NetBSD Website

Introduction

The network is an essential part of system configuration. I will cover some aspects of it here.

Configuration

Display Interfaces and Associated IPs

Here's the command:

ifconfig

Static IPs

We can declare interfaces persistently:

1
2
3
4
5
6
[...]
# Add local overrides below
#
ifconfig_vr0="inet 192.168.0.254 netmask 255.255.255.0" # Wan
ifconfig_vr1="inet 192.168.1.254 netmask 255.255.255.0" # DMZ
[...]

You add an ifconfig entry with the interface name, followed by its parameters.

Gateway

It's possible to set the gateway like this:

1
2
3
[...]
defaultroute="192.168.0.138"
[...]

Or alternatively:

192.168.0.138

Restart Network Services

/etc/rc.d/network restart