Config files for multiple IP's on VLANs

How can you do it with individual ifcfg-* files?

I’ve tried adding them like this:

Filename: ifcfg-vlan1:0

but it fails on ifup, thinking it might be the filename (the vlan tagging being picked up from the name) I tried renaming it but still no go.

I can add IP’s via ifconfig, eg
ifconfig vlan1:0 netmask up

and I’m pretty sure I could add multiples to the ifcfg-vlan1 file but how do I add them from individual config files?


There might be something useful for you in this thread.

OS 11.4 network manager default connection can handle virtual interfaces?

Thank You,

No, essentially that’s suggesting to do the same as I’ve already tried, ie adding a config file for ifcfg-<interface>.0
It just doesn’t work when DEVICE (or ETHERDEVICE) is a vlan
If I specify DEVICE as vlan1:1 or vlan1 I get

Interface vlan1:1 is not available

If I try with ETHERDEVICE=vlan1 I get

ERROR: trying to add VLAN #1 to IF -:vlan1:- error: File exists

If I try with ETHERDEVICE=vlan1.1 I get

ERROR: vlan interface is same with ethernet interface

I don’t see how ETHERDEVICE could be anything but a real interface, the way VLANs work.

I was trying anything by that point! :slight_smile:

I don’t think you can have a hierarchy of VLANs. The VLAN ID is just a 12 bit field in the frame.

I think you may be confusing VLANs with interface aliases. If you had wanted aliases the old syntax of eth0:1 and so forth is no longer needed, because you can bind multiple IPs to a real interface without an alias. If you really want a VLAN interface, have a look at man ifcfg-vlan.

I know that but AIUI you have to specify all the IP’s in the same config file which means you can’t (easily) bring down individual IP’s.

I want to be able to do

ifup vlan1.0

and it brings up a second IP address on vlan1

Doesn’t the third example in man 5 ifcfg-vlan do what you want? Then you run ifup lan1 eth0.

No, that’s just for a single IP vlan.

As I understand the man page, you just create other files lan2, lan3, lan4, etc all referring to the same VLAN, since the VLAN ID is specified in one of the lines. Nowhere is it said that you can have only one file per VLAN.

No, that just errors:

ERROR: trying to add VLAN #1 to IF -:bond0:- error: File exists

File as added btw is ‘ifcfg-vip1’


As I said before I think ETHERDEVICE has to be a real device.

ETHERDEVICE is a ‘real’ device, that’s a copy of the existing vlan config (which works perfectly) just renamed, with VLAN_ID added (as it was previously referenced in the name) and a new IP.

Probably doesn’t help I’m after multiple IP’s ontop of VLAN’s on top of bonding. :wink:

No, by a real device I mean eth0, eth1. But a quick search show that it apparently is possible to run VLANs on top of bonding, but it is possible that the openSUSE scripts don’t handle this correctly.

You can always create your own bindings using the vconfig utility, which is what the scripts call anyway. Just try some of the various tutes on the net, like the second half of this one: LiNUX Horizon - VLAN - Virtual Local Area Network

Not sure how the hell it would work using a eth? with the bonding.

I know how to add them, I just want to add them via the proper ifcfg scripts if it is possible.

I can just run

ifconfig vlan1:0 netmask up

or just add that to a script but I’d rather use the proper ifcfg config files.

Maybe you should ask this a little apologetically in the SLES forums since you sound like an enterprise user, even though you are using openSUSE. Only a fraction of us here even have an inkling of what a VLAN is.