How to Set Static IP on OpenBSD

· #openbsd

It’s easy to set a static IP on OpenBSD.

First, you need to choose which interface you will set the static IP to.

$ ifconfig

Example, i will choose urtwn0.

urtwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	lladdr 7c:c2:c6:0c:fd:89
	index 4 priority 4 llprio 3
	groups: wlan egress
	media: IEEE802.11 autoselect (OFDM54 mode 11g)
	status: active

Create a new file with a formatted hostname.(interface you choose)

$ doas nvim /etc/hostname.urtwn0

Write your preferred IP.

inet 192.168.1.19 0xffffff00

Set new gateway if you dont have.

$ doas echo 192.168.1.1 >> /etc/mygate

Then, apply the changes madeor it will not work.

$ doas ksh /etc/netstart

Enjoyed the post?

You can support this blog with donate ❤️

Questions or comments? email me.