RE: Issue with static ip in NM



On Thu, 2009-04-23 at 07:00 -0500, Hooker, Jonathan wrote:
> That makes sense. Unfortunately, I am somewhat new to this level of network management, would it be possible to maybe get an example? Also remembering that it is possible to have multiple usb devices connected at the same time...

Right, which is why NM doesn't use device names, since those change with
plug/unplug too.  Unfortunately, since most manufacturers seem to ignore
stuff like the USB serial number and populate that field with zeros or
some other non-device-unique value, all we've got left is the MAC
address to uniquely identify a particular device.

But of course, Garmin sets a valid, globally unique serial number on
every device, right?  That makes your life a lot easier.

So you'll put some udev rules files in /etc/udev/rules.d (the
user-editable rules directory) that detect the presence of your device,
and run a small helper script which can then assign a MAC to the device
based off the serial number.  Check out:

http://reactivated.net/writing_udev_rules.html

You'll be matching sysfs attributes, so something like:

ACTION!="add|change", GOTO="fake_mac_end"
SUBSYSTEM!="usb", GOTO="fake_mac_end"

SUBSYSTEMS=="usb", ATTRS{idVendor}!="<your vid>", GOTO="fake_mac_end"
SUBSYSTEMS=="usb", ATTRS{idProduct}!="<your pid>", GOTO="fake_mac_end"

SUBSYSTEMS=="usb", ATTRS{iSerial}=="?*", ENV{ID_FAKE_MAC_USB_SERIAL}="$attr{iSerial}"
SUBSYSTEMS=="usb", IMPORT{program}="fake-the-mac $env{ID_FAKE_MAC_USB_SERIAL} $tempnode", GOTO="fake_mac_end"

LABEL="fake_mac_end"

then in the script /lib/udev/fake-the-mac, you'll assign a MAC of your
choice (maybe by hashing the serial #) to the device in argv[2] using
ethtool or whatever.

Dan

> These are actually development devices. They do have the capability of getting out on the network but it is just because of some routing rules where we route its static ip through the eth0 of the machine to allow it on.
> 
> Jonathan Hooker
> Desktop Support - Engineering (Linux)
> Garmin International
> Jonathan Hooker Garmin com
> 
> -----Original Message-----
> From: Dan Williams [mailto:dcbw redhat com]
> Sent: Thursday, April 23, 2009 6:52 AM
> To: Hooker, Jonathan
> Cc: networkmanager-list gnome org
> Subject: Re: Issue with static ip in NM
> 
> On Thu, 2009-04-23 at 06:09 -0500, Hooker, Jonathan wrote:
> > Hi,
> >
> >
> >
> > I am currently having some issues with setting a static ip to a usb0
> > ethernet device due to the fact that it changes mac addresses every
> > time I plug it in. Is there any means of predicting this change so
> > that I can get the its config file
> > in /etc/NetworkManager/system-connections setup properly? Thanks for
> > your help!
> 
> One way to do this is to set up a udev rules file that will always
> assign a custom MAC to the device.  Since the MAC comes up random, the
> device clearly isn't used to connect to a real ethernet network, and
> it's probably a PocketPC/Windows Mobile device?
> 
> Dan
> 
> >
> >
> > Jonathan Hooker
> >
> > Desktop Support – Engineering (Linux)
> >
> > Garmin International
> >
> > Jonathan Hooker Garmin com
> >
> >
> >
> >
> > ______________________________________________________________________
> > This e-mail and any attachments may contain confidential material for
> > the sole use of the intended recipient. If you are not the intended
> > recipient, please be aware that any disclosure, copying, distribution
> > or use of this e-mail or any attachment is prohibited. If you have
> > received this e-mail in error, please contact the sender and delete
> > all copies.
> >
> > Thank you for your cooperation
> > _______________________________________________
> > NetworkManager-list mailing list
> > NetworkManager-list gnome org
> > http://mail.gnome.org/mailman/listinfo/networkmanager-list
> 
> 
> This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.
> 
> Thank you for your cooperation



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]