≡ Menu

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

Fig.01: OpenBSD restart networking service

References

Sysadmin because even developers need heroes!!!

Share this tutorial on:
{ 0 comments… add one }
Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , ,