How To – Change Server Name/Hostname/Gateway/IP Addresses on OpenBSD

Changing the name/IP address of the server is quite simple. Using your favorite text editor editing the following files and change all reference to server name and server IP address.

  • /etc/hosts
  • /etc/hosts.allow
  • /etc/hosts.deny
  • /etc/mygate
  • /etc/myname
  • /etc/hostname.*
  • /etc/resolv.conf
  • /etc/nttpd.conf
  • /var/www/conf/httpd.conf

At the command prompt run the following command to reconfigure your NIC with the new IP address and applicable netmask.

# ifconfig le1 inet IP_ADDRESS_HERE netmask NETMASK_HERE

The “le1″ is the device name of the NIC. Not sure what the NIC device name is? At the console prompt type without quotes “ifconfig -a” and locate the network card device name.

If you make modifications to NIC called rl0 by editing the /etc/hostname.rl0 or modify /etc/mygate/ (default gateway) file you will then need to restart / reset / update TCP/IP configuration including routing table and set up the default routes by issuing the following command.

# sh /etc/netstart rl0

To stop network service and transmission via a NIC

# ifconfig rl0 down

To start network service and transmission via a NIC

# ifconfig pnc0 up

Source: OpenBSD FAQ – Networking
Source: OpenBSD Restart Networking Service

Comments are closed.