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


Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts