Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cdc_ether persistent mac address [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 513
Location: Romania

PostPosted: Wed May 15, 2019 11:52 pm    Post subject: cdc_ether persistent mac address [Solved] Reply with quote

I have this usb dongle that is a 3g/4g modem which I use with various robots going outside. My phone or tablet has a gsm connection to the internet, and a vpn to home network, robot has the same setup, a gsm modem, vpn to home network, and when I'm going outside I prefer this setup to direct wifi connection between remote (phone or tablet) and client (generally a robot).

Anyway, long story short, this usb dongle I'm having is making a usb0 connection, which every time it gets created it has a different mac address. I want to make sure it's always the same mac address. Reason behind it is I kinda like to use NetworkManager. Anyway, problem is that because the mac address changes with every usage of the usb dongle or reboot, network manager always see's that usb0 connection as a new connection because mac address doesn't match. It just game be an idea of what I should be googleing. people who use a mac changer before network manager.

technically I want the same thing, but only because the device randomizez it. I think I should look into an udev rule that changes mac when driver is loaded?! I kinda don't like this. seems like a hack. any other ideas to keep a persistent mac on a cdc_ether usb0 device?


Last edited by axl on Wed May 22, 2019 5:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
TigerJr
Guru
Guru


Joined: 19 Jun 2007
Posts: 487
Location: /dev/x0

PostPosted: Tue May 21, 2019 10:15 pm    Post subject: Reply with quote

I didn't use NetworkManager

i have in /etc/conf.d/net
config_enp0s2f1u4=dhclient

and /etc/init.d/net.enp0s2f1u4 -> net.lo symlink

interface name does not include mac-address, it's usb port number, if i change usb port than i need to create new interface configuration.
_________________

Do not update portage without hotdog!

Xenogentooway?
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1364
Location: Montréal

PostPosted: Tue May 21, 2019 11:49 pm    Post subject: Reply with quote

I think you should create a Udev rule to set a static MAC address to the Usb dongle. Of course you don't use the random MAC address to make Udev detect the dongle but other static informations like the idProduct and the idVendor to make Udev recognise it. Than in the rule you make run the ip command to set the static MAC address you have choose.

I have not a rule example to show you but I did it before on other Ethernet (Wifi) devices types and it work unless some other processes change the MAC address again.
_________________
Paul
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 513
Location: Romania

PostPosted: Wed May 22, 2019 5:07 pm    Post subject: Reply with quote

Turns out, macchanger, ip, ifconfig all refuse to change the MAC. Had a closer look at the source code in kernel, and it seems to me that the mac is received from the dongle itself, and it will not work if changed. So, solved I guess.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum