There is a certain command which can be executed in the command line where the command itself is mainly for restarting network service in FreeBSD operating system. The command must be executed as ‘root’ account where it can be acquired by logging in as a normal user and then switching it to the ‘root’ account or just directly logging in as ‘root’ account. The logging process can be done locally or remotely where there is a limitation for ‘root’ account regarding it. Read the article titled ‘How to Allow root account to connect via SSH in FreeBSD’ in this link so that ‘root’ account itself can do a remote connection via SSH to start logging in remotely.
After gaining access either locally or remotely as ‘root’ account, just execute the following command for restarting network service using the following command :
service netif restart
The above command execution can be shown in the real situation where in the context of this article, the access connection to the command line using ‘root’ account is done remotely :
root@mybsd:~ # service netif restart Stopping dhclient. dhclient not running? (check /var/run/dhclient.em1.pid). Stopping Network: lo0 em0 em1. lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> groups: lo em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 08:00:27:5d:dc:96 hwaddr 08:00:27:5d:dc:96 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active em1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 08:00:27:5f:b7:29 hwaddr 08:00:27:5f:b7:29 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active Starting Network: lo0 em0 em1. lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> groups: lo em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 08:00:27:5d:dc:96 hwaddr 08:00:27:5d:dc:96 inet 10.0.2.15 netmask 0xffffff00 broadcast 10.0.2.255 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 08:00:27:5f:b7:29 hwaddr 08:00:27:5f:b7:29 inet 192.168.56.3 netmask 0xffffff00 broadcast 192.168.56.255 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active root@mybsd:~ #
The output above is showing the restart process for each of the network interface card available in the operating system.
One thought on “How to Restart Network Service in FreeBSD”