OPENBSD NOTES: Basic Network Configuration AUG 2005
REFERENCE: Identify the key files:
text config files
/etc/hostname.neX <- one of these for each nic /etc/mygate <- default route /etc/resolv.conf <- dns server resolution
ifconfig: bring up or down an interface
ifconfig ${DEVICE} down
ex: ifconfig ne0 down
Dynamic Host Configuration Protocol (DHCP)
To get OpenBSD to auto start dhclient on boot edit /etc/hostname.neX like this:
echo dhcp > /etc/hostname.neX
Basically, the configuration file for your network IP addressing information is in the /etc directory and begins with 'hostname.' followed by the name of the Ethernet interface. The following is the correct syntax for this file:
dhcp NONE NONE NONE
start a DHCP client from the command line
dhclient neX
Static IP address configuration
To configure the system for a static IP address, enter the IP address, subnet mask, and the rest in the /etc/hostname.neX file:
192.168.0.5 255.255.255.0 NONE NONE
Change IP address on running machine w/o reboot
Unlinke linux, there are no network script frontends for ifconfig. Use ifconfig to change the IP address for a given interface.
ifconfig neX inet 10.10.192.5 netmask 255.255.255.224
Default route or Gateway IP address
The default route, or 'gateway' address needs to go in a file inside the /etc directory called 'mygate'. The file may not exist on a default install.
touch /etc/mygate
Populate it with the IP address for the default route.
192.160.0.1
Change the default route on running machine w/o reboot
first, remove the old route
route del -net 169.254.0.0 netmask 255.255.0.0 gw 0.0.0.0 dev eth0
or if you prefer, flush them all out
route flush
now add the new default route (gateway) for the machine
route add default 10.10.192.1
DNS configuration
Place the DNS server information in /etc/resolv.conf
nameserver 64.21.192.4 nameserver 10.10.0.13 lookup file bind
hostname configuration
The hostname for the machine, or host and domain is in the plain text file:
/etc/myname
Change the hostname on running machine w/o reboot
Just use the hostname command
hostname myhost.domain.com