Results 1 to 8 of 8

Thread: Questions regarding replacing a wifi card on a laptop

  1. #1

    Default Questions regarding replacing a wifi card on a laptop

    I have a laptop computer running openSUSE Leap 15.0 and network manager. The internal wifi card failed, so I replaced it with a new one (of the same brand and model). When I rebooted, the wifi did not work. I found the following problem(s):

    1. The old interface was wlan0, but the new card appears as wlan1. Somehow the system seems to remember the old card so it added the new card as a different interface, and network manager was configured to work on the old interface.
    2. The /etc/NetworkManager/system-connections/<wifi-name> file has a mac address listed in it, which pertained to the old card. The new card obviously has a different mac address.

    I was able to use the nmcli command to create a new connection and made it work with the new wifi card. But my question is, how and where does the system remember the old wlan0 interface? Can I delete it and move the new card to wlan0?

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,293
    Blog Entries
    2

    Default Re: Questions regarding replacing a wifi card on a laptop

    The problem you describe echoes what happens in the virtualization world if the GuestVM is cloned or redeployed into a new network.
    The machine boots up in the new network, detects a network card with a new MAC address and creates a new interface for that network.

    The result is that you nave an original interface that no longer works but has the original MAC address,
    And a new, working network interface but now has a MAC address which isn't the machine's default.

    Nowadays, openSUSE uniquely fixes this problem in the virtualization world, so it's been awhile since I've had to manually deal with this... I still have to fix this when I deal with other distros...

    I can't find my notes on this and oddly I can't do a successful Internet search so I'll have to just describe what should be done from memory, if it doesn't work, then I hope you can figure out what's missing...

    First thing to know before proceeding is that a main reason why your wlan1 was created is because every hardware NIC that's manufactured has its own unique MAC address burned into its silicon, that's why simply replacing old with new resulted in an identified "different" NIC. The unique MAC address from the manufacturer ensures that there is never any doubt that wherever it might be deployed in the world, it will be recognized as unique and won't conflict in any network, anywhere.
    We will need to make changes that use the MAC address in your new card but otherwise with the configuration of your old NIC.

    Open 2 text editors to the following location where your network interface files are located
    Network interface files are simply files the OS uses to keep track of network devices, and contain configuration settings. They <represent> the associated hardware, but do not have to statically describe a configuration that is exactly the hardware defaults.
    Code:
    /etc/sysconfig/network/
    Open your two interface files, in your case wlan0 and wlan1

    Copy the MAC address from your wlan1 and paste to over-write and replace the MAC address in wlan0.

    Inspect the rest of your wlan0 interface file for anything else that might need to be modified.

    Save and close your text editors.

    Open up your YaST Network Setting Module.
    Delete/remove your wlan1
    Reboot.

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3

    Default Re: Questions regarding replacing a wifi card on a laptop

    @tsu2
    Thanks for your answer, I understand fully that the mac address is different between my old card and new card. The old card has been removed from the system, and the new card is installed in its place. At any rate, my system is under NetworkManager control, so the /etc/sysconfig/network/ifcfg-* files are not relevant. In fact I deleted the /etc/sysconfig/network/ifcfg-wlan0 file and the new wifi card still shows up as wlan1. There is no ifcfg-wlan1 file. YaST Network Settings ("yast2 lan") also does not apply because that is not for NetworkManager.

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Questions regarding replacing a wifi card on a laptop

    Quote Originally Posted by amblabs View Post
    I was able to use the nmcli command to create a new connection and made it work with the new wifi card. But my question is, how and where does the system remember the old wlan0 interface? Can I delete it and move the new card to wlan0?
    The answer lies with udev. In particular, /etc/udev/rules.d/70-persistent-net.rules contains the discovered network devices and is responsible for the persistent naming you've observed (current and previous devices). For example,
    Code:
    # This file was automatically generated by the /usr/lib/udev/write_net_rules
    # program,run by the persistent-net-generator.rules rules file.
    #
    # You can modify it,as long as you keep each rule on a single
    # line,and change only the value of the NAME= key.
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:74:e4:b1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    Remove the entries contained there (or just edit to reflect the desired 'wlan0' naming), and at next boot the current device will be named wlan0.
    openSUSE Leap 15.0; KDE Plasma 5

  5. #5
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,293
    Blog Entries
    2

    Default Re: Questions regarding replacing a wifi card on a laptop

    Quote Originally Posted by deano_ferrari View Post
    The answer lies with udev. In particular, /etc/udev/rules.d/70-persistent-net.rules contains the discovered network devices and is responsible for the persistent naming you've observed (current and previous devices). For example,
    Code:
    # This file was automatically generated by the /usr/lib/udev/write_net_rules
    # program,run by the persistent-net-generator.rules rules file.
    #
    # You can modify it,as long as you keep each rule on a single
    # line,and change only the value of the NAME= key.
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:74:e4:b1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    Remove the entries contained there (or just edit to reflect the desired 'wlan0' naming), and at next boot the current device will be named wlan0.
    I haven't looked at that file for a long time...
    If the contents might need to be modified, I'd recommend reading up further on how the file is generated, it's possible any direct edits may be over-written otherwise.

    I also suspect that udev might be relevant if the device (wireless NIC in this case) connects through a removable device bus like USB... which is entirely possible. Otherwise, if the device is detected for instance as attached to a PCI bus I'd wonder if the device would be listed in this file.

    Side note...
    This is one of the things on the systemd long range roadmap, coding and configuring udev can require its own language so is one of the subsystems that systemd eventually hopes to standardize based on how Unit files are written.

    IMO and speculating a bit,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  6. #6

    Default Re: Questions regarding replacing a wifi card on a laptop

    @deano_ferrari
    You're spot on. /etc/udev/rules.d/70-persistent-net.rules is where the system designated the new wifi card to be wlan1. There was no line in it for wlan0, however, it got deleted automatically somehow. Anyway, changing "wlan1" to "wlan0" in this file and rebooting moved the interface to wlan0.

    @tsu2
    In my case, the wifi card is not USB. It's an internal PCI-E minicard.

  7. #7
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Questions regarding replacing a wifi card on a laptop

    Quote Originally Posted by tsu2 View Post
    I haven't looked at that file for a long time...
    If the contents might need to be modified, I'd recommend reading up further on how the file is generated, it's possible any direct edits may be over-written otherwise.
    I have edited it from time to time for the same reasons as the OP. It is '/usr/lib/udev/write_net_rules' that is responsible for the rule generation but manual editing can be done providing one is changing the name only...
    Code:
    # You can modify it,as long as you keep each rule on a single
    # line,and change only the value of the NAME= key.
    I also suspect that udev might be relevant if the device (wireless NIC in this case) connects through a removable device bus like USB... which is entirely possible. Otherwise, if the device is detected for instance as attached to a PCI bus I'd wonder if the device would be listed in this file.
    Yes, 'write_net_rules' (part of udev) handles ALL network-class devices regardless of the how they're attached.
    Last edited by deano_ferrari; 13-Sep-2019 at 18:36.
    openSUSE Leap 15.0; KDE Plasma 5

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,383
    Blog Entries
    1

    Default Re: Questions regarding replacing a wifi card on a laptop

    Quote Originally Posted by amblabs View Post
    @deano_ferrari
    You're spot on. /etc/udev/rules.d/70-persistent-net.rules is where the system designated the new wifi card to be wlan1. There was no line in it for wlan0, however, it got deleted automatically somehow. Anyway, changing "wlan1" to "wlan0" in this file and rebooting moved the interface to wlan0.
    Glad to have been of guidance.
    openSUSE Leap 15.0; KDE Plasma 5

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •