[clug] Debian: VLAN/802.11Q in /etc/network/interfaces?

Robert Edwards bob at cs.anu.edu.au
Thu Aug 5 00:13:42 MDT 2010


On 05/08/10 15:52, Alex Satrapa wrote:
> Noob question time =(
>
> In /etc/network/interfaces I know you can specify a basic interface like so:
>
>    iface eth0 inet static
>      address 192.168.1.100
>      netmask 255.255.255.0
>      gateway 192.168.1.1
>
>
> And I can configure an "alias" like so:
>
>    iface eth0:0 inet static
>      address 192.168.2.1
>      netmask 255.255.255.0
>
> But how do I specify a VLAN?
>
> In the shell, I have to do stuff like:
>
>    [root at here]# vconfig add eth0 123
>    [root at here]# ifconfig eth0.123 10.4.4.1 netmask 255.255.255.0
>
> Is there a way I can specify this in /etc/ somewhere so the machine will come up with the same interfaces when it reboots?
>
> Alex
>

We have this:

# a simple untagged IPv4 interface
auto eth1
iface eth1 inet static
	address ...
	netmask ...
	...

# an IPv4 alias on that interface
auto eth1:0
iface eth1:0 inet static
	address ...
	netmask ...
	...

# an interface on VLAN #4000 for IPv4
auto eth1.4000
iface eth1.4000 inet static
	pre-up modprobe 8021q
	pre-up vconfig add eth1 4000
	address ...
	netmask ...
	...

# same interface with an IPv6 address
iface eth1.4000 inet6 static
	address ...
	netmask ...
	...

# an IPv4 alias on the VLAN #4000 interface
iface eth1.4000:0 inet static
	address ...
	netmask ...
	...

etc. (you get the picture). All interfaces/addresses work fine
concurrently (provided the other end has the same VLAN tags etc.)

Cheers,

Bob Edwards.




More information about the linux mailing list