OpenBSD Restart Networking Service

Posted on in Categories , , last updated November 8, 2016

How do I restart networking service under OpenBSD operating system from a shell prompt? How do I start / stop interface on a OpenBSD?

You need to use the /etc/netstart command scripts for network startup. It is the command script that is invoked by rc during an automatic reboot and after single user mode is exited; it performs network initialization including routing. If you made changes to interface called pnc0 by editing /etc/hostname.pnc0, type the following command to restart / reset / update TCP/IP configuration including routing table and set up the default routes:
# sh /etc/netstart pnc0
OR use doas command to run root level tasks:
$ doas -u root sh /etc/netstart pnc0
Mark an interface down i.e. stop networking service and transmission via interface called vio1:
# ifconfig vio1 down
To bring back interface, type:
# ifconfig vio1 up

To restart all interfaces:

$ doas -u root sh /etc/netstart
If your interface name is vio0, config file is /etc/hostname.vio0:
$ cat /etc/hostname.vio0

To see your default gateway, enter:

$ cat /etc/mygate

To see your hostname, enter:

$ cat /etc/myname

To see your DNS server IP address, enter:

$ cat /etc/resolv.conf

To see your routing table:

$ route show
$ netstat -r
$ netstat -r -n
$ netstat -r -f inet -n ## only IPv4 ##

Sample outputs:

Fig.01: OpenBSD restart networking service
Fig.01: OpenBSD restart networking service


Leave a Comment