rss logo

Configure network interfaces on OpenBSD

OpenBSD Logo



  • OS: OpenBSD 7.3


  • Get interface name:
openbsd# ifconfig
  • we need to create a /etc/hostname."interface_name" file for each interface, contening this information:
address_family address netmask broadcast [other options]


  • dhcp: put the interface in dhcp mode
  • address_family: inet for IPv4
  • address: ip address
  • netmask: network mask
  • NONE: No broadcast address


  • Set gateway:
# echo "" > /etc/mygate
  • Set em0 interface in dhcp:
# echo "dhcp" > /etc/hostname.em0
  • Set em1 interface in static:
inet NONE
  • Set a vlan10 interface on em1 interface:
inet NONE vlan 10 vlandev em1
  • Set DNS:
echo "nameserver" > /etc/resolv.conf
  • To take this changes into consideration we need to execute:
# sh /etc/netstart
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address