Is it possible to name/rename veth interface names?

networking

(Peter Gloor) #1

Is there a way to name/rename veth network device names like it was possible for privileged containers in LXC with lxc.network.veth.pair? I would rather prefer to use something like veth-c-001 instead of those cryptic names like vethV9NWGM.

If it’s not possible, just let me know, so I don’t have to do further research. I can live without it, but in case it’s possible it would be nice to know.


(Stéphane Graber) #2
lxc config device add c1 eth0 nic nictype=bridged parent=lxdbr0 name=eth0 host_name=veth-c1

(Andreas Cordes) #3

Hi, so this per container, right?
Is it also possible to use variables in the default profile to avoid specific “per container” configs?

kind regards
Andreas


(Peter Gloor) #4

Yes the example here was per container. And no, it’s not possible to use variables in the default profile.

However, today I make use of profiles with user.user-data containing cloud-config data for cloud-init. This is a great thing, as it allows me to launch containers that will be completely configured according to a typical user groups need.

  user.user-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
  - ssh
  - sudo
  - git
  - tmux
  - build-essential
locale: de_CH.UTF-8
timezone: Europe/Zurich
runcmd:
  - apt autoremove -y
  - touch /var/log/setup_completed
  - reboot now

The limits are your imagination :wink: