In this quick post I will explain how to add and configuring a network card under FreeBSD operating system using command line options.

To display the current configuration for the network interfaces on your FreeBSD server, type the following command:
# ifconfig

How Do I Configure the Network Card Under FreeBSD?

You need to use the ifconfig command as follows to assign an IP address:
# ifconfig interfaceName inet IPAddress

To assign an ip to lnc0 interface, enter:
# ifconfig lnc0 inet

Please note that lnc0 is an ethernet interface name. It can be Obtained by tying the following command:
# ifconfig -a

FreeBSD Ntwork Card’s Configuration

To setup up ip address permanently open a file called /etc/rc.conf and append/modify network entries as follows:
# vi /etc/rc.conf
Setup values as follows:
ifconfig_lnc0="inet netmask"
### Default gateway ###

Save and close the file. Please note that ifconfig_lnc0 is Ethernet interface name. It can be Obtained using ifconfig -a command.

You can restart networking service using the following command:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart

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

🐧 11 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
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 jobs killall kill pidof pstree pwdx time
Searchinggrep 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
11 comments… add one
  • Anonymous Sep 5, 2005 @ 19:25

    Thanks for this tip. It was very helpful

  • Hyip Jul 19, 2008 @ 9:25

    Could you please set up an .exe file to do the above procedure
    I think making a .exe file with the above commands will make the job easier for repeatedly changing ip addresses

  • Claus Larsen Dec 16, 2008 @ 13:08

    An exe file, do you have any idea about what you are saying, exe files is a windows thing.

  • Senphet Dec 15, 2009 @ 21:31

    .exe for bsd!? thanks for the good laugh ; )

  • wakka wakka Sep 10, 2010 @ 22:49

    lmao, maybe he meant a .bat file not .exe!

  • ozy-ns Dec 20, 2010 @ 13:47

    The .bat file is from windows too 😉

  • TnyTm Feb 17, 2011 @ 14:44

    Friggen windows nerds with your exe and bat files. However can you create a vbs script perhaps. I like the idea of changing the IP address easily from script. vbs would be nice.

  • Joe's Morgue Apr 2, 2012 @ 12:00

    I’m VERY much a beginner with *nix of ANY form [including FreeBSD] AND I can’t spell, but….

    .EXE and .BAT are NOT from Windows. They are from the days of DOS, which was usable within Windows….

    He is using a term he [and you] understood from his DOS [Windows] experience…

  • Mohammed Khalid Feb 2, 2013 @ 5:34

    Thanks a lot

  • Jason May 2, 2014 @ 16:29


    Just goes to show, that helpdesk staff shouldnt work on network stuff

  • John Stepp Feb 11, 2015 @ 21:07

    making a binary for this seems a little overkill.
    alias setnet ‘ee /etc/rc.conf’
    alias restartnet ‘/etc/rc.d/netif restart && /etc/rc.d/routing restart’

    (I know, ee; I just do not want to relearn vi at my age.)

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