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. 

Next:
$ 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:
#dhcp
inet 192.168.1.4 255.255.255.0 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 192.168.1.1):
192.168.1.1

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

Verification:
$ ifconfig -a
In our example, the em0 interface should display an IP address of 192.168.1.4.
$ ping -c 3 www.yahoo.com

Courtesy of:

No comments:

Post a Comment