Saturday, August 24, 2013

Set Static IP in OpenBSD (updated)

Run the following commands:
$ ifconfig -a

Look for the interface right after "lo0". We will use interface em0 as an example. 

$ cd /etc

Look for the file "hostname.<interface>. This is the file we need to edit. In our example:
$ sudo vi hostname.em0

Comment out "dhcp". Based on our example's network settings, my hostname.em0 now looks like this:
inet NONE

Next, edit, or create file "/etc/mygate" (required for internet connection):
# vi /etc/mygate
Add the following (for example, if your default gateway is

Save and exit, then reboot or restart your network for the changes to take effect.
Restarting the network:
# sh /etc/netstart

$ ifconfig -a
In our example, the em0 interface should display an IP address of
$ ping -c 3

Courtesy of:

No comments:

Post a Comment