Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Ability to configure a VLAN id on a given interface #278

Open
gjcampbell777 opened this issue Apr 27, 2021 · 1 comment

Comments

@gjcampbell777
Copy link

cc: @aadavids

I have managed to set up code that manually configures a vlan tagged interface with eth0 through vintage_net.
I'm posting my documentation here in hopes that it can help with the creation of a built in module within vintage_net.

Commands used to get VLAN id started:

Creates VLAN interface:

VintageNet.Command.cmd("ip", ["link", "add", "link", "eth0", "name", "eth0." <> vlan_id, "type", "vlan", "id", vlan_id])

Configure static IP to VLAN interface:

VintageNet.configure("eth0." <> vlan_id, %{type: VintageNetEthernet, ipv4: %{method: :static, address: static_ip, prefix_length: 24, gateway: gateway_ip <> ".1", name_servers: ["1.1.1.1"]}}, persist: false)

Gets interface up:

VintageNet.Command.cmd("ip", ["link", "set", "dev", "eth0." <> vlan_id, "up"])

Other commands for debugging/testing:
Take interface down:

VintageNet.Command.cmd("ip", ["link", "set", "dev", "eth0." <> vlan_id, "down"])

Get info on interface:

VintageNet.Command.cmd("ip", ["-d", "link", "show", "eth0." <> vlan_id])

Delete interface:

VintageNet.Command.cmd("ip", ["link", "delete", "eth0." <> vlan_id"])

Linux Kernel Flags Required:

CONFIG_IP_NF_IPTABLES=y

CONFIG_IP_NF_FILTER=y

CONFIG_VLAN_8021Q=y

CONFIG_VLAN_8021Q_GVRP=y

CONFIG_VLAN_8021Q_MVRP=y

CONFIG_NETLINK_DIAG=y
@fhunleth
Copy link
Member

Thank you for sharing this! I make passes on VintageNet updates about once a month. This is really interesting to me, and I think you may have filled in a couple key details and this might not be so much work to add. I'll have to think about it more. This is going to look like it's not getting any attention, but rest assured it's in the back of my mind for my next pass on VintageNet. Obviously, if I'm too slow, I love getting PRs and would brainstorm designs in the interim if someone was going to put in the time to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants