Community discussions

MikroTik App
 
nofdak
just joined
Topic Author
Posts: 12
Joined: Thu May 28, 2020 3:10 am

Manually Specify Container MAC or IPv6 Address

Mon Dec 12, 2022 3:16 pm

I'd like to use IPv6 with my containers and I'm running into an issue with non-deterministic IPv6 addresses. If I add an IPv6 prefix to my containers bridge and advertise it, my containers properly use SLAAC to get an IPv6 address, and I can then use that address for container communication.

The issue is that if I ever have to recreate the veth interface, the container ends up with a new MAC address, and thus a new SLAAC address. I'd like it to be deterministic if at all possible.

So my question is either 1) Is there a way to set a static IPv6 address on a veth outside of the container (no as far as I can tell) or 2) Is there a way to manually specify a MAC address so the SLAAC address is always the same.

I know I can probably do it my creating my own Dockerfile/image, but I'd rather not do that for every one of my containers I want IPv6 connectivity for.
 
tangent
Forum Guru
Forum Guru
Posts: 1329
Joined: Thu Jul 01, 2021 3:15 pm
Contact:

Re: Manually Specify Container MAC or IPv6 Address

Tue Dec 13, 2022 3:52 am

the container ends up with a new MAC address

You should never count on a container to have a fixed internal address. It meant to be dynamic, since a container runtime cannot generically predict what order the containers will come up in, nor how many there will be. In the specific case of RouterOS, you have the ability to specify the veth address at container creation time, but what should remain fixed is the NAT address on the outside, not the MAC on the inside.

The real feature request, therefore, is for a way to put a static IPv6 address on a veth. There's no reason that shouldn't be allowed, other than that someone needs to get around to writing the code for it. The underlying kernel can handle it.

I can probably do it my creating my own Dockerfile/image

Nope. It's set at container creation time, not baked into the image.
 
nofdak
just joined
Topic Author
Posts: 12
Joined: Thu May 28, 2020 3:10 am

Re: Manually Specify Container MAC or IPv6 Address

Tue Dec 13, 2022 6:12 pm

I can probably do it my creating my own Dockerfile/image

Nope. It's set at container creation time, not baked into the image.
I should've been more clear. I meant adding an IPv6 Address, not selecting a MAC address. That's what I do now, as soon as my container is first created, I add my manual IPv6 address, which then remains as long as the container exists, but needs to be re-added if the container is recreated
 
yuhuan417
just joined
Posts: 3
Joined: Thu Apr 20, 2023 9:01 am

Re: Manually Specify Container MAC or IPv6 Address

Thu Apr 27, 2023 6:31 pm

Just manually specify it, add this before your real CMD:
/sbin/ip -6 addr add aaaa:bbbb:cccc:dddd::/64 dev eth0
Last edited by yuhuan417 on Sat Apr 29, 2023 7:53 am, edited 1 time in total.
 
ConradPino
Member
Member
Posts: 337
Joined: Sat Jan 21, 2023 12:44 pm
Contact:

Re: Manually Specify Container MAC or IPv6 Address

Fri Sep 01, 2023 1:27 pm

RouterOS CHR 7.11.1 veth interface has new MAC Address after every reboot and container virtual interface does same.

Who is online

Users browsing this forum: Rhydu and 3 guests