Re: [Xen-users] About MAC address

Stephen Liu
Fri, 19 Sep 2008 09:33:54 -0000

--- "Nemeth, Tamas" <nice@titanic.nyme.hu> wrote:

> Hi!
>
> Sorry, i don''t know anything about debian, but a mac address
> in /etc/network/interfaces is strange for me.
>
> It''s possibly for the domU to change the mac address of any
virtual
> interface by the command "ip link set ethX address
> XX:XX:XX:XX:XX:XX",
> or similar. Xen will not notice the change. The mac address provided
> by
> xen is like a default mac address of a real card, and can be changed
> (until the next reboot of the domU). Maybe some script in you domU
> system do this change during boot?
>
> Anyway, the udev system may persistently link mac addresses and
> device
> names (i.e. eth0, eth1). Take a look
> at /etc/udev/rules.d/70-persistent-net.rules or something like this.


Hi Tamas,


I don''t have "70-persistent-net.rules" here.


# ls /etc/udev/rules.d/
020_permissions.rules       z25_persistent-net.rules
025_libgphoto2.rules        z45_persistent-net-generator.rules
025_libsane.rules           z50_run.rules
udev.rules                  z55_hotplug.rules
xen-backend.rules           z60_alsa-utils.rules
z20_persistent-input.rules  z60_xserver-xorg-input-wacom.rules
z20_persistent.rules        z75_cd-aliases-generator.rules
z25_persistent-cd.rules     z99_hal.rules
* end *


# cat /etc/udev/rules.d/z25_persistent-net.rules
....
# PCI device 0x10de:0x0373 (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*",
ATTRS{address}=="00:0e:a6:f9:a3:5b",
NAME="eth0"
* end *


There is only ONE NIC here.


$ cat /etc/udev/rules.d/z45_persistent-net-generator.rules
# These rules generate rules to keep network interface names unchanged
# across reboots write them to
/etc/udev/rules.d/z25_persistent-net.rules.
#
# The default name for this file is z45_persistent-net-generator.rules.

ACTION!="add",
GOTO="persistent_net_generator_end"
SUBSYSTEM!="net",
GOTO="persistent_net_generator_end"

# ignore the interface if a name has already been set
NAME=="?*",
GOTO="persistent_net_generator_end"

# ignore "secondary" raw interfaces of the madwifi driver
KERNEL=="ath*", ATTRS{type}=="802",
GOTO="persistent_net_generator_end"

# provide nice comments for the generated rules
SUBSYSTEMS=="pci", \
 ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}"
SUBSYSTEMS=="usb", \
 ENV{COMMENT}="USB device $attr{idVendor}:$attr{idProduct}"
SUBSYSTEMS=="ieee1394", \
 ENV{COMMENT}="Firewire device $attr{host_id}"
SUBSYSTEMS=="xen", \
 ENV{COMMENT}="Xen virtual device"
ENV{COMMENT}=="", \
 ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})"
ATTRS{driver}=="?*", \
 ENV{COMMENT}="$env{COMMENT} ($attr{driver})"

# ignore interfaces without a driver link like bridges and VLANs
KERNEL=="eth*|ath*|wlan*|ra*|sta*", DRIVERS=="?*",\
        IMPORT{program}="write_net_rules $attr{address}"

ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"

LABEL="persistent_net_generator_end"
* end *


B.R.
Stephen



Send instant messages to your online friends http://uk.messenger.yahoo.com