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

pod create doesn't set static mac address for shared network #8385

Closed
ericzolf opened this issue Nov 18, 2020 · 8 comments · Fixed by #8467
Closed

pod create doesn't set static mac address for shared network #8385

ericzolf opened this issue Nov 18, 2020 · 8 comments · Fixed by #8467
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@ericzolf
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

The pod create command doesn't apply the static MAC address to the infrastructure container, even though it properly applies a static IP address, and does seem to store the MAC address.

Steps to reproduce the issue:

  1. podman pod create --name mypod --network podnw [--ip 10.89.0.222] --mac-address 42:43:44:00:00:01 (with or without static IP doesn't make a difference)
  2. podman run --rm --pod mypod --name nginx nginx
  3. podman inspect xxx-infra

Describe the results you received:

The MacAddress is random.

Describe the results you expected:

The output shows the static mac-address as described by the man page podman-pod-create.

Additional information you deem important (e.g. issue happens only occasionally):

The command podman pod inspect mypod shows the following output, which shows that some static mac address is stored, but apparently never used (the static IP address indeed works):

    "InfraConfig": {
        "PortBindings": {},
        "HostNetwork": false,
        "StaticIP": "10.89.0.222",
        "StaticMAC": "QkNEAAAB",
        "NoManageResolvConf": false,
        "DNSServer": null,
        "DNSSearch": null,
        "DNSOption": null,
        "NoManageHosts": false,
        "HostAdd": null,
        "Networks": [
            "podnw"
        ]
    },

(not sure about the MAC address but it looks like it)

Output of podman version:

podman version 2.1.1

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.21-3.fc33.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.21, commit: 0f53fb68333bdead5fe4dc5175703e22cf9882ab'
  cpus: 1
  distribution:
    distribution: fedora
    version: "33"
  eventLogger: journald
  hostname: newfedo.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.8.18-300.fc33.x86_64
  linkmode: dynamic
  memFree: 1423671296
  memTotal: 2076008448
  ociRuntime:
    name: crun
    package: crun-0.15.1-1.fc33.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.15.1
      commit: eb0145e5ad4d8207e84a327248af76663d4e50dd
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 0
  swapTotal: 0
  uptime: 48m 6.59s
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 3
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 1602087680
  BuiltTime: Wed Oct  7 16:21:20 2020
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.1.1-12.fc33.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Vagrant VM as created with https://gitlab.com/EricPublic/miscericlaneous/-/tree/master/podman_playground (access is free, you just need a GitLab account).

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 18, 2020
@zhangguanzhang
Copy link
Collaborator

zhangguanzhang commented Nov 18, 2020

if not with --network, it will be set to correct

$ podman pod create --name mypod  --mac-address 42:43:44:00:00:01
a5e9fc3aa4bfd859c99e524126bb40d2140cb0eb87707773ba2a98f1038b0d78
$ podman run --rm -d --name test2 --pod mypod $IMG top
ac8e0e389d0b9826a4d296850249e112b23e56a61d4c4bd41d3ec69543eb0c01
$  podman exec test2 ip a s eth0
3: eth0@if46: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP 
    link/ether 42:43:44:00:00:01 brd ff:ff:ff:ff:ff:ff  
    inet 10.88.0.111/16 brd 10.88.255.255 scope global eth0
......
$ podman pod inspect mypod | grep MAC
          "StaticMAC": "QkNEAAAB",

and it had another problem, it will disaply wrong value, fix this in #8386

$ ./bin/podman pod inspect mypod | grep MAC
          "StaticMAC": "42:43:44:00:00:01",

@vrothberg vrothberg added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Nov 18, 2020
@zhangguanzhang
Copy link
Collaborator

@baude PTAL

@mheon
Copy link
Member

mheon commented Nov 18, 2020

@zhangguanzhang Good to close since #8386 is merged?

@zhangguanzhang
Copy link
Collaborator

@zhangguanzhang Good to close since #8386 is merged?

The code I submitted is only to fix the display problem. After joining the network, the mac setting fails. I debugged it and did not find the problem.

@mheon
Copy link
Member

mheon commented Nov 19, 2020

OK - thanks for the update.

@mheon mheon removed the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Nov 19, 2020
@Luap99 Luap99 assigned Luap99 and unassigned baude Nov 24, 2020
@Luap99 Luap99 added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Nov 24, 2020
Luap99 added a commit to Luap99/libpod that referenced this issue Nov 24, 2020
The cni plugin `tuning` is required to set a custom mac address.
This plugin is configured in the default cni config file which is
packaged with podman but was not included the generated config form
`podman network create`.

Fixes containers#8385

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
@Luap99
Copy link
Member

Luap99 commented Nov 24, 2020

@ericzolf I found the problem.

The tuning plugin is missing in the config file. You should be able to add { "type": "tuning" }, under the plugins section in /etc/cni/net.d/<netname>.conflist. After that you should be able to set a static mac with this network.

I opened #8467 to include this by default in the future.

@ericzolf
Copy link
Author

I can open a separate issue but: is there somewhere a documentation of the network plugins? I noticed that tuning was missing but I always thought it was something specific to the default network.

@Luap99
Copy link
Member

Luap99 commented Nov 26, 2020

Networking is handled by cni. Documentation is available here: https://www.cni.dev/docs/

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants