FreeBSD: How To Start / Stop / Restart Network and Routing Services

FreeBSD is a Unix-like free operating system. You can install to choose third party software on FreeBSD from the Ports Collection. Many services such as POP3 server daemons, IMAP, etc. could be started using the inetd.

However, networking can be stop or started using special script located in /etc/rc.d/ directory. This directory includes script to stop or start network, and other services such as SSH server.

FreeBSD 5.x/6.x and above version – start or stop network service

FreeBSD 5.x/6.x and above version comes with netif script to start, restart, stop network service. You need to login as a root user. Then you can use following commands:

To start FreeBSD network service:
# /etc/rc.d/netif start
To stop FreeBSD network service:
# /etc/rc.d/netif stop
To restart FreeBSD network service:
# /etc/rc.d/netif restart

Manual method using ifconfig

To stop network card (NIC) on-fly:
# ifconfig network-interface down
To start network card (NIC) on fly:
# ifconfig network-interface up
To list down network interface:
# ifconfig -d
To list up network interface:
# ifconfig -u

FreeBSD Update / restart routing tables / service

It is also necessary to update routing table after restating networking service, enter:
# /etc/rc.d/routing restart

How do I restart network service over ssh session?

You need to type the commands as follows in order to avoid problems:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart

FreeBSD 4.x and prior version only – start, restart, stop network service

To start network service under FreeBSD you need to copy special script as follows:

# cp /usr/share/examples/etc/netstart /etc/network

Execute this script:

. /etc/network


sh /etc/network

Please note that script will do all necessary work for you i.e. it will start network, routing, firewall etc.

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

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig 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 glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep 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
7 comments… add one
  • Anonymous Feb 6, 2006 @ 18:33

    Whats the difference between /etc/netstart and /etc/rc.d/netif for restarting networking?

  • 🐧 nixcraft Feb 6, 2006 @ 19:15

    /etc/netstart is old method and does not support all the options (like stop, restart etc), which is now supported by /etc/rc.d/netif script. Ease of use is main difference between two.

  • ELF May 29, 2007 @ 13:21

    Thank you very mach 🙂

  • tech Jul 29, 2008 @ 10:03

    You need to type the commands as follows in order to avoid any problems:
    # /etc/rc.d/networking restart && /etc/rc.d/routing restart

    The right way is:
    # /etc/rc.d/netif restart && /etc/rc.d/routing restart

    I am right?

  • 🐧 nixCraft Jul 29, 2008 @ 11:36

    Yes, you are right. It was typo on my part and the post has been updated.

    I appreciate your feedback and post.

  • tamas Mar 20, 2009 @ 19:24

    Thank you for the easy to unterstand articles.
    I try to use vlans. How can I ‘restart’ the virtual interface? The command /etc/rc.d/netif restart vlan5 not works for me.
    Another vlan question: what about interfaces? Must have the external/real/physical interface an address?

  • Carole Dec 14, 2011 @ 4:04

    I wish the caveat note about running /etc/rc.d/routing restart immediately afterwards was near the note about /etc/rc.d/netif restart — I just took down my host remotely by not finding out that tidbit a little too late after it didn’t come up.

    Appreciate the info. A little asterix ** note beside the first command of “routing restart” would have really saved my nightmare. (I was already in a panic to reboot my network interface, and didn’t get a chance to read through the entire document — it seemed easy and clear enough with the first command)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum