Linux – Linux GRE: ip tunnel vs ip link

iproutelinuxlinux-networkingtunneling

Can someone please explain the difference between linux ip tunnel and ip link command when it comes to configuring tunnels (such as GRE, IPIP, or VXLAN)?

I can see that I can configure a GRE tunnel, for example, in two ways:

  1. ip link add name gre1 type gre …
  2. ip tunnel add gre1 mode gre …

Is there any difference between the two when it comes to the Linux resources created, performance etc.? Is one of the ways old fashined?

Cheers.

Best Answer

Both iproute2's commands interact with the same kernel, they don't implement anything except this communication only, effectively meaning you should expect no difference in terms of performance.

As can be seen from a relevant commit ip link uses more fresh kernel interface — rtnl_link, compared to ip tunnel: "…

This is accessed through the "ip link" command. The previous tunnel configuration interface "ip tunnel" remains as it is and should be retained for compatibility with old kernels. …

…"