FreeBSD Set Speed Duplex For My Network Card ( NIC )

Q. How do I set / change the speed ( duplex settings ) on my FreeBSD network card? I’d like to change default 10Mbps to 100Mbps or vice versa. Linux user can use ethtool to set an Ethernet card speed and duplex, can I use the same command on FreeBSD?

A. ethtool is not required on FreeBSD. By default, the NIC auto-negotiates the speed and duplex of the connection. Make sure port speed set correctly on your switch. You need use the ifconfig command to configure the speed and duplex settings on the adapter. You also need to update your /etc/rc.conf file to set speed and duplex configuration.

Task: View Current Speed and Duplex Settings

Simply, use ifconfig command, enter:
# ifconfig em0
# ifconfig interface-name
# ifconfig | grep media


em0: flags=8843 mtu 1500
        inet netmask 0xffffffc0 broadcast
        ether 00:30:48:93:1e:9a
        media: Ethernet 10baseT/UTP 
        status: active

ifconfig command to change speed and duplex settings

General syntax is as follows to set 10Mbps full-duplex:
ifconfig <interface-name> <IP_address> media 10baseTX mediaopt full-duplex
Set 100Mbps full-duplex, enter:
ifconfig <interface-name> <IP_address> media 100baseTX mediaopt full-duplex
Set 1000Mbps full-duplex, enter:
ifconfig <interface-name> <IP_address> media 1000baseTX mediaopt full-duplex
For example, set interface em0 with IP to 100Mbps full duplex, enter:
# ifconfig em0 media 100baseTX mediaopt full-duplex
If the interface is currently forced to 100 full duplex, in order to change to half duplex you must type the following command:
# ifconfig em0 media 100baseTX -mediaopt full-duplex
The -mediaopt option disable the specified media options (full-duplex) on the interface i.e. go back to half duplex.

Make speed and duplex settings permanent

To make configuration changes persistence, update /etc/rc.conf file. Open config file using text editor, enter:
# vi /etc/rc.conf
Find line that read as follows:
To set em0 interface to 10Mbps full, enter:
ifconfig_em0="inet x.x.x.x netmask y.y.y.y media 10baseT/UTP mediaopt full-duplex"
To set em0 interface to 100Mbps full, enter:
ifconfig_em0="inet x.x.x.x netmask y.y.y.y media 100baseTX mediaopt full-duplex"
To set em0 interface to 1000Mbps full, enter:
ifconfig_em0="inet x.x.x.x netmask y.y.y.y media 1000baseTX mediaopt full-duplex"
Make sure you replace x.x.x.x and y.y.y.y with actual IP and netmask address. Here is entry from my own personal FreeBSD workstation:
ifconfig_em0="inet netmask media 100baseT/UTP mediaopt full-duplex"
Save and close the file. Restart the networking:
# /etc/rc.d/netif restart

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

🐧 6 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
6 comments… add one
  • Raj Feb 7, 2008 @ 19:13

    Good article. Just a quick note about DHCP, following will not work:
    ifconfig_em0="media 100baseTX mediaopt full-duplex"

    I got it working by creating /etc/start_if.em0:
    ifconfig em0 media 100baseTX mediaopt full-duplex
    Make sue /etc/rc.conf just has the following config directive:



    • Shadowwraith Jan 22, 2017 @ 5:32

      I am new at this but I got it working using
      ifconfig_em0=”DHCP media 100baseTX mediaopt full-duplex”

      …reasoning that…
      ifconfig_em0=”inet x.x.x.x netmask y.y.y.y media 100baseTX mediaopt full-duplex”
      is the same as…
      ifconfig_em0=”DHCP media 100baseTX mediaopt full-duplex”
      …the only difference being that it’s a static vs. dynamic address

  • nbari Aug 10, 2010 @ 16:44

    if you are on a remote server take care when doing this:

    # /etc/rc.d/netif restart

    that will also mess with your routes and probability your server will become unreachable so better run this:

    ( /etc/rc.d/netif restart ; /etc/rc.d/routing restart )

    that way after restarting the ‘network’ you can also restart your routes and still access the server

  • Vijay Kishore Feb 5, 2014 @ 9:18

    I am using freescale processor MPC8548E based customized board .

    Once the Linux is loaded on the targetm I gave the following ommand:
    ifconfig media 100baseTX mediaopt full-duplex
    as mentioned above.

    But it is dispplaying the error:
    ifconfig: bad address ‘media’…

    I am trying to set the board eth1 port to work in 100 Mbps, Full Duplex mode.

  • Samir Osama Nov 1, 2020 @ 22:15

    When I write
    # /etc/rc.d/netif restart
    After my command ifconfig…….
    He is send me cannot restart netif. Set_enable to yes in /etc/rc.conf ot use one restart instead of restart

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