Sunday, April 12, 2015

Changing Interface name using Udev for vmxnet3 driver type( Ubuntu)

I wanted to change the name of interface whose driver is vmxnet3 by appending X and ending with

Interface count

Use udevadm to list properties and attributes

 

root@cisco-pkt-vm:~# udevadm info -a -p /sys/class/net/eth2

looking at device '/devices/pci0000:00/0000:00:15.0/0000:03:00.0/net/Xeth2':

KERNEL=="eth2"

SUBSYSTEM=="net"

DRIVER==""

ATTR{mtu}=="1500"

ATTR{type}=="1"

ATTR{netdev_group}=="0"

ATTR{flags}=="0x1003"

ATTR{speed}=="10000"

ATTR{dormant}=="0"

ATTR{addr_assign_type}=="3"

ATTR{dev_id}=="0x0"

ATTR{duplex}=="full"

ATTR{iflink}=="2"

ATTR{addr_len}=="6"

ATTR{address}=="00:0c:29:ce:b0:11"

ATTR{operstate}=="up"

ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"

ATTR{tx_queue_len}=="1000"

ATTR{ifalias}==""

ATTR{ifindex}=="2"

ATTR{link_mode}=="0"

looking at parent device '/devices/pci0000:00/0000:00:15.0/0000:03:00.0':

KERNELS=="0000:03:00.0"

SUBSYSTEMS=="pci"

DRIVERS=="vmxnet3"

ATTRS{irq}=="18"

 

 

Once we know the properties adding rules in udev.

Edit file /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="vmxnet3", KERNEL=="eth*", NAME="Xeth$attr{ifindex}"

 

After reboot you wil see it being eth2 being renamed to Xeth2

 

root@cisco-pkt-vm:~# ifconfig

 

Xeth2 Link encap:Ethernet HWaddr 00:0c:29:ce:b0:11

inet6 addr: fe80::20c:29ff:fece:b011/64 Scope:Link

Xeth3 Link encap:Ethernet HWaddr 00:0c:29:ce:b0:1b

collisions:0 txqueuelen:1000

RX bytes:120 (120.0 B) TX bytes:3745 (3.7 KB)

 

Xeth4 Link encap:Ethernet HWaddr 00:0c:29:ce:b0:25

inet6 addr: fe80::20c:29ff:fece:b025/64 Scope:Link

RX bytes:120 (120.0 B) TX bytes:3745 (3.7 KB)

Xeth5 Link encap:Ethernet HWaddr 00:0c:29:ce:b0:2f

inet6 addr: fe80::20c:29ff:fece:b02f/64 Scope:Link

RX bytes:120 (120.0 B) TX bytes:3745 (3.7 KB)

No comments:

Post a Comment

Featured Post

XDP - Getting Started with XDP (Linux)