sonic-net / sonic-swss

SONiC Switch State Service (SwSS)
https://azure.github.io/SONiC
Other
175 stars 525 forks source link

What is the command to change the MAC address of each port? #603

Open doicom opened 6 years ago

doicom commented 6 years ago

Hi all, I'm sorry if the location of the question is wrong.

Checking the source"orchagent - m cc: 37: ab: c 8: 54: 0 c" seems to change the MAC address. With the latest SONiC binary, this command could not be used.

Equipment: AS 5712
SONiC Software Version: SONiC.HEAD.664 - c 822b 3c
Distribution: Debian 8.11
Kernel: 3.16.0-5-amd64

What other methods are available to change the MAC address of the port? The default MAC address is the same for each port, but can I change it? Can I change the setting with ifconfig? Example:sudo ifconfig Ethernet 30 hw ether cc: 37: ab: c 8: 54: 0 c

lguohan commented 6 years ago

the function is not available, can you describe the use case?

doicom commented 6 years ago

Hi,@lguohan I am sorry I forgot your reply

Thank you for your reply.

the function is not available, Thanks to you, the mystery has been resolved.

can you describe the use case? I confirmed it because it can be changed with a general switch. When I explained to someone I asked because I could not reply whether I can change the MAC address.

doicom

bluecmd commented 3 years ago

You can change the MAC address since https://github.com/Azure/sonic-swss/pull/814/files by setting the following statement in config_db:

    "INTERFACE": {
        "Ethernet92": {
            "mac_addr": "76:c0:f8:4b:c8:04"
        },
    }

This issue can probably be closed.

TafkaMax commented 4 months ago

Note: This only works for the switch ports "EthernetXX" and not for the OOB port(s).

The OOB port "eth0", "eth1", "etc2" and "Bridge" on my DCS203 are not affected by this command.