How to Change Your Hostname In OpenBSD

by bram

How to Change Your Hostname In OpenBSD

A quick note on how to change your hostname and IP configuration in OpenBSD.

/etc/hosts
Vastly more important in BSD than it is in Linux. This is where you specify the IP address of your hostname. Change the hostname here to match your hosts new name. It should be the same as what you specify in /etc/myname.

/etc/myname
This is just like /etc/HOSTNAME in Linux. It defines the realname of the host. Simply change it to whatever you want to call your host.

/etc/hostname.xl0 (or other interface name)
Change these to line up with what you specified in /etc/hosts.

/etc/resolv.conf
Just like Linux. This is where you specify your DNS servers and domain resolution information.

/etc/mygate
Simply put the IP address of the default router.