Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.hardware > #1622
| From | Pascal Hambourg <boite-a-spam@plouf.fr.eu.org> |
|---|---|
| Newsgroups | comp.os.linux.hardware |
| Subject | Re: USB Network dongle, exact copy |
| Date | 2013-02-02 16:12 +0100 |
| Organization | Plouf ! |
| Message-ID | <kejaca$10cg$1@saria.nerim.net> (permalink) |
| References | <510bb446@news.synserver.de> <keis9c$rl0$1@saria.nerim.net> |
Pascal Hambourg a écrit :
>
> f0o a écrit :
>> I've recently bought 2 USB wired Network dongles. Both have
>> the same MAC, Serial & DeviceNr. Whenever I plug em in, one
>> (the latter one on the BUS) gets to ethX and the other one to
>> renameX.
>>
>> I generally dont mind this as I can rename them via iproute2
>> and also change thier MACs. But I cant seem to 'guess' a
>> propper way to distinguishing them apart from an `ip link ls`
>> and grep&tail for the last ethX aswell as for the renameX to
>> get to them.
>>
>> Is there a general way to map Network-Interfaces to BUS-IDs?
>
> I have done this with two PCI network interfaces on a Sun Ultra
> workstation, by modifying the udev rules to take the hardware path into
> account. One funny thing about these Sun machines is that all Sun
> network interfaces (HME) have the same MAC address (the openfirmware has
> an option to disable this feature, but that would have been less fun).
> So I guess it is possible with USB devices too.
>
> If you insist I will boot this station and retrieve what I did exactly.
Here is what I did on a Debian 6.0 (Squeeze) system with a USB wireless
network adapter (wlan0) :
1) Plug in one USB network adapter in the first USB port.
2) Display the interface name :
# ip link
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN
qlen 1000
link/ether 00:0c:76:72:1e:91 brd ff:ff:ff:ff:ff:ff
3) Display the udev info for this interface with a bit of the first parent :
# udevadm info --path=/sys/class/net/wlan0 --attribute-walk
looking at device
'/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/net/wlan6':
KERNEL=="wlan6"
SUBSYSTEM=="net"
DRIVER==""
ATTR{addr_len}=="6"
ATTR{dev_id}=="0x0"
ATTR{ifalias}==""
ATTR{iflink}=="14"
ATTR{ifindex}=="14"
ATTR{features}=="0x2000"
ATTR{type}=="1"
ATTR{link_mode}=="0"
ATTR{address}=="00:0c:76:72:1e:91"
ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
ATTR{operstate}=="down"
ATTR{mtu}=="1500"
ATTR{flags}=="0x1002"
ATTR{tx_queue_len}=="1000"
looking at parent device
'/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0':
KERNELS=="1-6:1.0"
SUBSYSTEMS=="usb"
4) Write down the KERNELS== value which depends on the USB port the
adapter is plugged into. Then plug the adapter in the second USB port
and write down the new KERNELS== value.
5) Edit /etc/udev/rules.d/70-persistent-net.rules and find the rule
related to the USB network adapter based on its MAC address and
interface name (this is all one line) :
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:0c:76:72:1e:91", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
6) Change the NAME= and add the KERNELS== value for the first USB port :
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:0c:76:72:1e:91", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan6", KERNELS=="1-6:1.0"
7) Duplicate the rule and modify the NAME and KERNELS values for the
second USB port :
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:0c:76:72:1e:91", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan5", KERNELS=="1-5:1.0"
8) Save the file and check that the rules work by plugging the adapter
in each port and displaying the interface names.
Back to comp.os.linux.hardware | Previous | Next — Previous in thread | Find similar | Unroll thread
USB Network dongle, exact copy f0o <f0o@devilcode.org> - 2013-02-01 13:23 +0100
Re: USB Network dongle, exact copy Richard Kettlewell <rjk@greenend.org.uk> - 2013-02-01 12:36 +0000
Re: USB Network dongle, exact copy Allodoxaphobia <knock_yourself_out@example.net> - 2013-02-01 15:34 +0000
Re: USB Network dongle, exact copy Richard Kettlewell <rjk@greenend.org.uk> - 2013-02-01 16:50 +0000
Re: USB Network dongle, exact copy Pascal Hambourg <boite-a-spam@plouf.fr.eu.org> - 2013-02-02 12:11 +0100
Re: USB Network dongle, exact copy Pascal Hambourg <boite-a-spam@plouf.fr.eu.org> - 2013-02-02 16:12 +0100
csiph-web