# VLAN's, udev and renaming Virtual Network Interfaces

## TheAl

Hi, 

1st, my goal :

Setup a linux box with 802.1Q VLANs and rename interfaces to something more readable.

I can rename NI with the udev stuff, and it seems to be the best way to do it.

I can setup VLANs, with MAC incremented for all vlans (but, there is a bug if you plan to use both _native_ interface (aka untagged) *and* vlans, because the Gentoo init script olny increment MAC for the 2nd VLAN, so you have 2 interfaces with same MAC ...).

But, VLANs are setup after the udev stuff, so I cannot rename VLANs.

I can workarround this with preup and postup() functions, but I think this can be better if supported by Gentoo init scripts.

Any ideas how to do it ?

----------

## TheAldo

Hi,

I'm encountering the same need here.

Any got an idea or a status of the net scripts ?

Thanks

----------

## UberLord

I have no idea what the problem even is.

Try posting your configs and what you expect to happen and what really happens

----------

## TheAl

Ok, sorry for my so bad english  :Confused: 

I want to setup VLAN interfaces on my network card.

So I can do it using /etc/conf.d/net :

```
vconfig_eth0=( "set_name_type VLAN_PLUS_VID_NO_PAD" )

vlans_eth0="2 999 18 10"
```

1st problem is to setup a MAC address for each VLAN, because the switch behind cannot have same MAC on different VLAN (this is normal).

So, add this :

```
mac_vlan2=("00:0c:6e:ee:ee:5b")

mac_vlan999=("00:0c:6e:ee:ee:5c")

mac_vlan18=("00:0c:6e:ee:ee:5d")

mac_vlan10=("00:0c:6e:ee:ee:5f")

```

and it's working well.

Now, to make it simplier to admin and understand, I want to rename those VLAN interface, for exemple vlan2 -> mgt

How to do it ?

I cannot use the udev renaming scheme, because udev is already started when I create subinterfaces.

----------

## UberLord

baselayout-1.12.0-pre1 will feature a "rename" module which allows the following

```
# Rename by interface name

rename_vlan2="mgt"

# Rename by MAC

rename_000C6EEEEE5B="mgt"

```

EDIT: This doesn't work for vlans - heh. Not sure what I can do about this as the vlan is sill reported with the old interface name whereas it's real one has changed - which makes it impossible to stop as it stands.

----------

## TheAl

 *UberLord wrote:*   

> EDIT: This doesn't work for vlans - heh. Not sure what I can do about this as the vlan is sill reported with the old interface name whereas it's real one has changed - which makes it impossible to stop as it stands.

 

I can see 2 options : 

1/ Modify the vconfig tool to accept renaming vlan interfaces at setup (probably hard to do)

2/ Playing with udev and force a reload (udevstart) after the vlan creation to rename it

Let me know what is the best way to do it.

----------

## UberLord

 *TheAl wrote:*   

> Let me know what is the best way to do it.

 

The best way todo it is to hack the VLAN kernel module to report the new interface name via /proc/net/vlan/config.

At this time, I'm very tempted to stop the rename module working for vlan interfaces as it will cause too many problems.

I don't see this at that big an issue - especially as vconfig allows 4 different naming schemes.

However, if you thing it's that big an issue, and can provide a working patch to our up and coming 1.12.0pre1 release then we'll look at it.

----------

## TheAl

 *UberLord wrote:*   

> ]I don't see this at that big an issue - especially as vconfig allows 4 different naming schemes.
> 
> 

 

It's not a big issue, just easy to manage. Let me take an example, a fireall. To limit network cards in PC (and dont use expansive Multiple interface card) we setup 802.1Q VLAN on a gigabit interface with maybe 6 active subinterfaces.

When editing rules and routing, it's realy easier to have "dmz" "lan" "vpn" network interfaces than VLAN002, VLAN123, ...

 *UberLord wrote:*   

> ]The best way todo it is to hack the VLAN kernel module to report the new interface name via /proc/net/vlan/config. 

 

Yes, seems the best way to do it.

Will take a look if I a can get some spare time  :Sad: 

----------

## UberLord

BTW, it does cause too many problems, so 1.12.0_pre2 (in portage) doesn't allow VLAN interfaces to be renamed.

----------

