OpenBSD Restart Networking Service

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


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @