-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Creating a vlan interface with protocol other then 801.2Q #361
Comments
Should work like that (at least, it works for me): with IPRoute() as ipr:
# link to create vlan on:
idx = ipr.link_lookup(ifname="lag0")[0]
# create the vlan
ipr.link("add",
ifname="elag0.24",
kind="vlan",
vlan_id=24,
link=idx,
vlan_protocol=0x88a8) If it doesn't work, please let me know. |
Hi, |
Extending the example above: with IPRoute() as ipr:
# link to create vlan on:
idx_h = ipr.link_lookup(ifname="lag0")[0]
# create the s-vlan, 802.1ad -- 0x88a8
ipr.link("add",
ifname="elag0.24",
kind="vlan",
vlan_id=24,
link=idx_h,
vlan_protocol=0x88a8)
# look up s-vlan link index
# a race condition is possible here, as the RTNL protocol
# is asynchronous and the link("add") call exits before the
# link is created actually; to deal with it, one can use IPDB,
# but it is out of the scope of the question
idx_s = ipr.link_lookup(ifname="elag0.24")[0]
# create the c-vlan, 802.1q -- 0x8100
ipr.link("add",
ifname="elag0.24.300",
kind="vlan",
vlan_id=300,
link=idx_s,
vlan_protocol=0x8100) Thereafter two interfaces will be available: elag0.24 (802.1ad) and elag0.24.300 (802.1q) |
The task for me: add common interface-specific attributes section to the docs (vlan, vxlan, gre, …) |
I ran your example on docker container on Linux Controller 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux . ` {'__align': (), |
First, let's be clear on definitions and values
The creation/untagging scheme:
As in your example, both interfaces are created with Obviously, something went wrong — elag0.s should be 0x88a8 == 802.1ad. … On my test kernels (>= 4.10) everything goes ok: [(x.get_attr('IFLA_IFNAME'),
x.get_attr('IFLA_LINKINFO').get_attr('IFLA_INFO_DATA').get_attr('IFLA_VLAN_PROTOCOL'))
for x in ip.get_links() if x.get_attr('IFLA_IFNAME').startswith('test.')]
[('test.25', 34984), ('test.25.300', 33024)] So if it doesn't work for you, it may be a kernel issue, not the library. But to be sure I have to check it first, so give me some time to test it on Ubuntu with 4.2.0 kernel. |
Yes I am sorry, I am bit out today, you are right on the definitions. 13: elag0.24@lag0: <BROADCAST,MULTICAST> mtu 1400 qdisc noop state DOWN mode DEFAULT group default I have just checked it on a clean docker container running the latest ubuntu 14:04 I would really appreciate if you check it out, |
Yep, sure. Thanks for the feedback. I'm checking it right now, and I believe we fix it soon. I would expect no surprises as it is x86_64, but obviously something goes not as expected. Thanks again for the bug record. |
I still can not reproduce it on Ubuntu LTS 16.04 Could you please try to run the script attached (creates interfaces, requires CAP_NET_ADMIN)? It should print something like that:
|
Hi,
I have tried to create a QinQ interfaces.
I haven't found a way to control the IFLA_VLAN_PROTOCOL with the current api.
I have tried:
a.link("add", ifname="test", vlan_id=23, kind="vlan", link=4, protocol=0x88a8)
and many variations on the protocol key (vlan_protocol, proto, and more..)
The bash command that works is:
ip link add link lag0 elag0.24 type vlan proto 802.1ad id 24
Am I missing something or this feature is not supported?
The text was updated successfully, but these errors were encountered: