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

Inconsistent behavior for custom MAC address of VETH interfaces #453

Closed
troglobit opened this issue May 16, 2024 · 0 comments · Fixed by #456
Closed

Inconsistent behavior for custom MAC address of VETH interfaces #453

troglobit opened this issue May 16, 2024 · 0 comments · Fixed by #456
Assignees
Labels
bug Something isn't working
Milestone

Comments

@troglobit
Copy link
Contributor

troglobit commented May 16, 2024

Current Behavior

When setting up VETH pair between host and a container the default behavior of the kernel is to pick a random MAC address. The idea is to be able to use set phys-address ... for a custom MAC.

However, this only works with containers if the veth pair, and custom MAC, is created first, with a leave between, and then adding one end of the pair to a container, with a second leave.

Expected Behavior

Expected the custom MAC to be set on the interface.

Steps To Reproduce

admin@example:/> configure 
admin@example:/config/> edit interface veth1a 
admin@example:/config/interface/veth1a/> set veth peer veth1b
admin@example:/config/interface/veth1a/> end
admin@example:/config/> edit interface veth1b
admin@example:/config/interface/veth1b/> set phys-address 00:c0:ff:ee:00:01
admin@example:/config/interface/veth1b/> set ipv4 address 10.10.0.200 prefix-length 24
admin@example:/config/interface/veth1b/> set container-network 
admin@example:/config/interface/veth1b/> end
admin@example:/config/> edit container test 
admin@example:/config/container/test/> set network interface veth1b
admin@example:/config/container/test/> leave
admin@example:/> show interfaces 
INTERFACE       PROTOCOL   STATE       DATA                                     
e1              ethernet   UP          02:00:00:00:00:01                        
                ipv6                   fec0::ff:fe00:1/64 (link-layer)
                ipv6                   fe80::ff:fe00:1/64 (link-layer)
lo              ethernet   UP          00:00:00:00:00:00                        
                ipv4                   127.0.0.1/8 (static)
                ipv6                   ::1/128 (static)
veth0a          ethernet               00:1a:33:01:02:03                        
                ipv4                   192.168.2.200/24 
veth0b          ethernet   UP          2a:81:c2:ec:b8:b5                        
veth1a          ethernet   UP          6a:14:d0:9d:29:50                        
veth1b          ethernet               00:c0:ff:ee:00:01      # <-------                        
                ipv4                   10.10.0.200/24 
admin@example:/> show container 
CONTAINER ID  IMAGE                                   COMMAND               CREATED        STATUS        PORTS       NAMES
d05ee2b5d301  localhost/curios-httpd-v24.03.0:latest  /usr/sbin/httpd -...  4 seconds ago  Up 4 seconds              test
admin@example:/> container shell test 
$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 5A:F8:22:09:F7:52       # <-------
          inet addr:192.168.2.200  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::58f8:22ff:fe09:f752/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1592 (1.5 KiB)

eth1      Link encap:Ethernet  HWaddr DA:28:BD:75:F2:26       # <-------  
          inet addr:10.10.0.200  Bcast:10.10.0.255  Mask:255.255.255.0
          inet6 addr: fe80::d828:bdff:fe75:f226/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:586 (586.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$

Additional information

No response

@troglobit troglobit added bug Something isn't working triage Pending investigation & classification (CCB) labels May 16, 2024
@troglobit troglobit added this to the Infix v24.05 milestone May 16, 2024
@troglobit troglobit removed the triage Pending investigation & classification (CCB) label May 16, 2024
@troglobit troglobit self-assigned this May 16, 2024
troglobit added a commit that referenced this issue May 16, 2024
This patch adds support for setting the mac address already when
creating veth interfaces.  Necessary to cooperate with containers.

Fixes #453

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit troglobit linked a pull request May 16, 2024 that will close this issue
13 tasks
troglobit added a commit that referenced this issue May 16, 2024
This patch adds support for setting the mac address already when
creating veth interfaces.  Necessary to cooperate with containers.

Fixes #453

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@wkz wkz closed this as completed in #456 May 18, 2024
wkz pushed a commit that referenced this issue May 18, 2024
This patch adds support for setting the mac address already when
creating veth interfaces.  Necessary to cooperate with containers.

Fixes #453

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant