configuring vlans

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

configuring vlans

Postby jiml8 » Oct 31st, '17, 05:39

I have just spent a painful weekend reconfiguring my network to support vlans, which is required because of the work I am doing.

I have a few questions about the best way to proceed with Mageia.

I figured out that I needed to load a kernel driver that was not loaded by default, the 8021q driver. I did so. Now I want that driver to load on every boot.

I have placed it in /etc/modules, which will cause it to be loaded, but I guess I am not certain that /etc/modules is not deprecated. Is there a better place to put this?

After loading the kernel module, I manually created the file ifcfg-eth0:6 in /etc/sysconfig/network-scripts. I don't know if I needed to do that or not, but I did it.

The contents of the file are as follows:
Code: Select all
DEVICE=eth0:6
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
METRIC=3
MII_NOT_SUPPORTED=no
USERCTL=no
DNS1=208.67.222.222
DNS2=192.168.0.1
RESOLV_MODS=no
LINK_DETECTION_DELAY=6
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=no
NM_CONTROLLED=no


After I created this file, I issued the command:
Code: Select all
ip link add link eth0:6 type vlan id 6

and, on my next ifconfig, I found that I now had an interface vlan0.

Now, my vlan0 had no ip address, so I put an ip address on it to match vlan6, and it works. Well, I had to make changes to shorewall, but once that was done, it works.

The system created a file ifcfg-vlan0 in /etc/sysconfig/network-scripts with the contents:
Code: Select all
DEVICE=vlan0
BOOTPROTO=dhcp
ONBOOT=yes


So.

I want this interface to come up automatically on boot - with the IP address I want assigned to it. Given this situation, will it do so? I don't know what effect systemd has on the creation of these interfaces but I suspect the boot scripts in network-scripts are deprecated.

Does anyone here know the best way to proceed to make sure this interface reappears on each startup?
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: configuring vlans

Postby doktor5000 » Oct 31st, '17, 15:04

jiml8 wrote:I have placed it in /etc/modules, which will cause it to be loaded, but I guess I am not certain that /etc/modules is not deprecated. Is there a better place to put this?

Yes that is long deprecated, I believe man modprobe.conf or man modprobe does also contain that information along with /etc/modprobe.d/ style config droplets or /etc/modprobe.preload which is partly deprecated (no .conf suffix) but works just fine.

jiml8 wrote:I manually created the file ifcfg-eth0:6 in /etc/sysconfig/network-scripts. I don't know if I needed to do that or not, but I did it.

This is basically also deprecated. See e.g. the comments from initscripts upstream (our initscripts package is largely based on the one from Fedora/RH) maintainers: https://bugzilla.redhat.com/show_bug.cgi?id=1073310#c4
I'd add that alias to your regular /etc/sysconfig/network-scripts/ifcfg-eth0 via IPADDR1, PREFIX1 stanzas. Although not sure where to put the vlan0 config itself, also I didn't quite get if you want to have this as a DHCP interface?

For the vlan part itself (at least on linux) I don't have any experience with VLANs on the client, as often PVID will be used instead of VLAN tagging and hence this is basically transparent for the clients and only relevant once for the hypervisor, which is usually not linux in my case.
My best guess would be to check some RHEL6/CentOS6 documentation. Although on a related note, as you still seem to be using the legacy interface naming as eth0 I'm not sure where to look for information on how to implement this currently in the legacy way (without systemd-networkd, networkmanager et al, only using the old initscripts SysV scripts basiscally)

Check e.g.
https://access.redhat.com/solutions/39674
https://access.redhat.com/solutions/741413
https://access.redhat.com/documentation ... faces.html
https://access.redhat.com/documentation ... gging.html
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: configuring vlans

Postby jiml8 » Nov 4th, '17, 16:11

Well, without going through all the details, after removing my home router and installing a managed switch behind the simplewan device which is the gateway to the internet, I ran into all kinds of trouble.

Now, I am one of the principal developers of the simplewan device, which is why I am using it, and my reconfiguration is to better able to let me test this device, using my own LAN as the guinea pig. My previous topology was causing a lot of difficulties in this regard, though that topology was stable and reliable.

One of my many problems ultimately resolved to "the simplewan device does not support the particular thing I want to be able to do", but this problem originally manifested to me as "I can't get PVID to work correctly", and my building a vlan on this workstation was a response to that problem.

So a week has passed, I have solved many of those problems, and the next release of the firmware for the simplewan device will support the feature I need. One of my partners commented to me: "it helps when you are using the thing, doesn't it."

I have also concluded that I should have purchased a more capable managed switch; this one doesn't support trunking which is for me a significant limitation though I can work around it. It is a Netgear GS108PE.

Having the vlan on the workstation will be useful, so I still want to sort out the details here. I did not want DHCP on vlan0, but using the network applet let me sort that out.

My messed-up networking led me to reboot the system this week, and the kernel driver was installed using the entry in modules. I will revisit that; I want to get away from deprecated configurations, but for now I am satisfied.

However, vlan0 did not start until I issued an "ip link add link eth0:6 type vlan id 6" again. And I do want to fix that.

And, yes. I have stayed with eth0. My workstation has eth0, eth1, and eth2. I do not agree with the logic that led to the change to hardware-dependent NIC names; I change hardware from time to time and such a "feature" will break just about everything in my system when I make such a change. The reality is that my workstation is 20 years old this year. Yes, its history is continuous back to 1997, and there are files on this system with datestamps that old. None of the hardware is the same; in fact I have changed all of it out at least three times by now. But I have made these changes piecemeal, and my system is continuous. I can still boot Windows NT on it, in a virtual machine, and I run Windows 2000, in a VM, continuously. I still use Wordperfect 8 for billing and invoices. :D In that time, I have reloaded the OS exactly once, and that is when I went from 32 bit Mandriva to 64 bit Mageia.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest