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
References
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 0 comments... add one ↓
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |