How to enable a disabled network interface


#1

My PC has both hard wired NIC and wireless NIC.

I used the checkbox at bottom of GUI NIC configuration to disable the wireless NIC. (I checked the box at the bottom: “Disable this network device”)

( Both were connecting and I did not wish to use Wireless. )

Now the Wirless NIC does NOT appear in the network manager. I don’t know how to “bring it back”. It does physically exist and dmesg shows it. But even if I do an “ifconfig” the NIC does not show up.

[user@Apc_HPC8200] ~% dmesg | grep rtw
rtwn0 on uhub3
rtwn0: <vendor 0x0bda product 0x8176, class 0/0, rev 2.00/2.00, addr 3> on usbus1
rtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R
rtwn0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
rtwn0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
rtwn0: 1T1R
rtwn0: 11ng MCS 20MHz
rtwn0: MCS 0-7: 6.5Mbps - 65Mbps
rtwn0: 11ng MCS 20MHz SGI
rtwn0: MCS 0-7: 7Mbps - 72Mbps
random: harvesting attach, 8 bytes (4 bits) from rtwn0
firmware: 'rtwn-rtl8192cfwT' version 111: 16126 bytes loaded at 0xffffffff8388b000
firmware: 'rtwn-rtl8192cfwT' version 111: 16126 bytes loaded at 0xffffffff8388b000
              • 8<-

      [user@Apc_HPC8200] ~% ifconfig -a
      em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
      options=85259b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO>
      ether xx:xx:xx:xx:xx:25
      inet6
      inet 192.168.70.204 netmask 0xffffff00 broadcast 192.168.70.255
      nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
      media: Ethernet autoselect (100baseTX )
      status: active
      lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
      options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
      inet6 ::1 prefixlen 128
      inet6
      inet 127.0.0.1 netmask 0xff000000
      nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
      groups: lo


#2

I also tried running:

 $ sudo bsdconfig

but the NIC did not show up in that app either.


#3

not sure, but read the man page for “ifconfig”

edit:
something like

sudo ifconfig em0 down

for the hard line


#4

Check /etc/rc.conf. There should be a line ifconfig_<device_name>=, where <device_name> is your wifi NIC. Edit the line to be something like `ifconfig_wlan0=“WPA SYNCDHCP”.


#5

I had previously attempted to edit /etc/rc.conf but the line I added was:

[ ifconfig_wlan0="DHCP”

which it didn’t think was correct and didn’t work. I modified the line as VIT suggested and this brought back the interface from the CommandLine (CLI) temporarily.

It was better if I followed up with additional commands:

[      sudo /etc/rc.d/netif restart
[      sudo ifconfig wlan0 up

The interface will also now show up in the TrueOS Network Manager but withOUT the ability to “enable/disable” the wlan0 interface on the main Network Manager window.

A system reboot/restart will also disable all this work and reset the /etc/rc.conf file.

I noticed that after I make the changes to rc.conf and run the commands listed above, in the “Control Panel / Device Manager” under network/ethernet there is still no reference to the wlan0 interface.

I am under the impression that although I can tell FreeBSD that the interface is available, I have no idea how to inform TrueOS that the interface is available so (I think) TrueOS is cleaning up (deleting) my changes at boot time and killing this wlan0 interface.

[user@Apc_HPC8200] ~% ifconfig -a
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=85259b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO>
        ether xx:xx:xx:xx:xx:25
        inet 192.168.70.204 netmask 0xffffff00 broadcast 192.168.70.255 
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: lo 
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether xx:xx:xx:xx:xx:a2
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
        status: associated
        ssid crazywifi channel 1 (2412 MHz 11g ht/20) bssid xx:xx:xx:xx:xx:68
        regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
        scanvalid 60 protmode CTS ht20 ampdulimit 64k ampdudensity 8 shortgi
        -stbc -ldpc wme bintval 200
        groups: wlan

CtrlPnl_DeviceMgr-2018-04-15_d2839


#6

I have a different experience on UNSTABLE. Disabling/enabling wireless device works fine for me with the atheros card. Which branch are you on? Have you considered upgrading?

In /etc/rc.conf, make sure you have wlans_rtwn0="wlan0" (from your original post, I assume you have a realtek card). Reboot your machine and make sure the change sticks.
In a terminal, sudo pc-wifimanager wlan0 should open up the wifi-manager window. What does it show? There should be the Disable this wireless device checkbox. Un-check it. Then push Apply
button. Does it work?

BTW, openrc service manager might be a better option to restart network service on TrueOS sudo rc-service network restart .

Edit:
It should be sudo pc-wificonfig wlan0.


#7
] ~% about

===================
General information
===================

boot environment now (N) … 12.0-CURRENT-up-20180414_002308 NR 2018-04-14
       after restart (R) … 12.0-CURRENT-up-20180414_002308 NR 2018-04-14
boot loader …………………………………… BSD
            type ……………………… BIOS
CPU ………………………………………………………… Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz
    number of cores ……………… 4
host ……………………………………………………… APC_HPC8200
memory ………………………………………………… 16384 MB available, 14301 MB free
OS git branch ……………………………………………………………………………………… trueos-stable-18.03
OS git revision ………………………………………………………………………………… fa797a5a3
OS kernel build time ………………………………………………………… Mon 2018 Mar 26 00:24:47 UTC
OS kernel identity …………………………………………… (uname -i) GENERIC
OS platform (architecture) ……………………… (uname -m) amd64
OS release level ………………………………………………… (uname -r) 12.0-CURRENT
OS version and patch level …… (freebsd-version) 12.0-CURRENT
TrueOS package set ………………… PRODUCTION
TrueOS version …………………………… TrueOS-Desktop-201803131015
uptime ………………………………………………… 5 mins
user  …………………………………………………… user

More (TrueOS Desktop):

    desktop environment …… Lumina
    sound card driver ………… pcm1: <NVIDIA (0x0051) (HDMI/DP 8ch)> (play) default
    wireless driver ……………… rtwn0
    X11 drivers ………………………… nvidia_drv.so

] ~% cat /etc/rc.conf
webcamd_enable="YES"
kldload_i915=""
kld_list=""
kldload_nvidia="nvidia-modeset nvidia"
# Auto-Enabled NICs from pc-sysinstall
wlans_rtwn0="wlan0"
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
hostname="APC_HPC8200"
zfs_enable="YES"
ifconfig_wlan0="WPA DHCP"
  • (rebooting now to “make sure the change sticks”)
    -Ben

#8

… After the reboot above…

] ~% sudo pc-wifimanager wlan0
Password:
sudo: pc-wifimanager: command not found

] ~% sudo find / -name pc-wifimanager -print

At this point … I ran “ifconfig -a” and noticed that there was no wlan0 interface.

I ran your “sudo rc-service network restart”…
… I again ran “ifconfig -a” and now wlan0 is back

“pc-wifimanager” is still missing.

] ~% sudo pc-wificonfig wlan0
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Locale: "en"

After running this command, the wlan0 interface is back … sort of. (but still has issues)

  • No wifi icon in task bar
  • Will not join my configured AP. Only joins unlocked available network AP.

Seeing if it will maintain after a reboot…

-Ben


#9

Apologies, I meant pc-wificonfig. It was a late night when I typed that and I mixed the command with the project name somehow.

To set up wifi, one usually needs to:

  • load appropriate kernel module (/boot/kernel/rtwn.ko in your case). It seems like it’s loaded in your case.
  • modify /etc/rc.conf to configure the network:
    #if_rtwn_load="YES"  # I think this is no longer needed as the kernel module gets loaded differently
    wlans_rtwn0="wlan0"
    ifconfig_wlan0="WPA DHCP"
    
    From the pc-networkmanager code, it looks like all it does is just removes the ifconfig_ line from the rc.conf:
    https://github.com/trueos/pc-networkmanager/blob/master/src/wificonfig/wificonfigwidgetbase.cpp#L96
    but then again, I don’t know the source code well… yet.
  • Update /etc/wpa_supplicant.conf by adding entry for your network:
    ctrl_interface=/var/run/wpa_supplicant
    
    network={
      ssid="your_network_name"
      priority=145
      scan_ssid=1
      psk="very_secret_key_goes_here"
    }
    
  • Make sure the network service is running
  • Make sure the wpa_supplicant service is running
  • Make sure the dhcpcd service is running
    In my case, sudo rc-status gives:
    network.re0           [  started  ]
    dhcpcd.wlan0          [  started  ]
    network.wlan0         [  started  ]
    wpa_supplicant.wlan0  [  started  ]
    
    One may need to create appropriate links in the /etc/init.d folder for those services.

I was hoping you won’t need to do any of that manually and you can just use pc-wificonfig UI to do it for you. The network UI can usually be accessed through one of the following:

  • sudo pc-netmanager
  • pc-nettray (this is the tray icon you’re missing; you might want to add it to autorun applications)
  • sudo pc-wificonfig wlan0

I suggested you to cut to the chase and go straight to the wificonfig UI. So, when you open it, try:

  • uncheck Disable this wireless device checkbox
  • push the Scan button. Now you should see your wifi network in the list available networks.
  • Select your network from the list and push Add selected button and follow the wizard dialog
  • If needed, select your network profile from the configured profiles list and push the Edit button and configure the network security etc.
  • When you’re done, push the Apply button in the pc-wificonfig main window.

I hope the manager is smart enough to update the necessary config files, configure and restart the necessary services. Maybe try reboot and check all the needed services have started.

I hope that’ll help.
If I have enough time I might try switching to STABLE and see what else I’m missing.

Edit: maybe all you have left to do is to change your network priority. Try move your AP up in the list or modify wpa_supplicant.conf to assign it higher priority.


#10

This was a fantastic thread. I learned a lot of CLI commands to assist when I have wifi issues. Thank you Vit!

Time was not working with me on this and I need to move forward so…

… It is a new machine that I can afford to blow away and reinstall. (which I have now done) WiFi must work on this because I am building it for a new user who will require Wifi. The WiFi card is a little USB dongle so I plan to recommend to never disable for now and unplug USB if needed to disable.

My Laptop has a physical switch to disable the WiFi NIC and I have not had an issue with that to date.

Thanks!
-Ben


#11