How to create a VLAN with iproute2 to survive reboot

New to Debian (Or Linux in general)? Ask your questions here!

How to create a VLAN with iproute2 to survive reboot

Postby dernikov1 » 2017-09-27 06:13

Hi,
I searched for an information how to create a VLANs with iproute2 (ip link add) that will survive a reboot, without custom scripts or adding a post-up command to /etc/network/interfaces.
With the vlan package installed and standard configuration for a vlan in /etc/network/interfaces, vlan goes up, but without the vlan package installed, it won't start.
If I manualy create a vlan and restart a network with "service networking restart" everthing starts as expected.
Main reason for the post are claims that the iproute2 (ip tool) is default way to create a vlans, because the vlan package is obsolete.
I couldn't found an instruction with a setup that only changing /etc/network/interfaces is enough for creating a vlan.
So i need help.

#configuration and commands

iproute2 command manual vlan
ip link add link eth0 name eth0.100 type vlan id 100

configuration example
#/etc/network/interfaces
source /etc/network/interfaces.d/*
allow-hotplug eth0 eth1

auto lo bond0
iface lo inet loopback

iface bond0 inet manual
slaves eth0 eth1
bond_mode 4
bond_miimon 100
bond_downdelay 200
bond_updelay 200

auto vlan10
iface vlan10 inet static
address 192.168.10.10
netmask 255.255.255.0
network 192.168.10.0
vlan-raw-device bond0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
dns-nameservers 8.8.8.8
dernikov1
 
Posts: 1
Joined: 2017-09-27 05:23

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable