Get Mac Address first interface

Dear all,
I’m new with RouterOS script and I have some problem need help. How can I get mac-address the first interface on my router.

Thanks for your support

:put [/interface ethernet get [/interface ethernet find default-name=ether1] mac-address ]

Very nice. Thanks for your support

Hi,

I need help with my code. I get mac adress from microtik wifi client to do some actions but I need to know mac adress from my ISP router. I have conected this router to ether1 and I´ve tried your code but doesn´t work. Can you help me?

My code is the following:

{
:local iPhone [/int wire reg find mac-address=“38:71:DE:E4:F8:FB”];

:if ($iPhone!=“”) do={
/tool fetch url=“http:///scada-remote” http-data=“m=json&r=grp&fn=write&alias=33/1/45&value=1” http-method=post;
} else={
/tool fetch url=“http:///scada-remote” http-data=“m=json&r=grp&fn=write&alias=33/1/45&value=0” http-method=post;
}
}

I’m trying to add your code to search both routers but it does not work

Can anyone help me?

Thanks

Hi,

I need help with my code…

I get the MAC from the Wifi devices of the Microtic but I need the ones from the ISP router. I’m trying with your code but it does not work for me. Somebody could help me?

This is my code:

{
:local iPhone [/int wire reg find mac-address=“38:71:DE:E4:F8:FB”];

:if ($iPhone!=“”) do={
/tool fetch url=“http:///scada-remote” http-data=“m=json&r=grp&fn=write&alias=33/1/45&value=1” http-method=post;
} else={
/tool fetch url=“http://remote:AAaa1111@192.168.1.205:4080/scada-remote” http-data=“m=json&r=grp&fn=write&alias=33/1/45&value=0” http-method=post;
}
}

thx a lot bro
awesome

:put [/interface ethernet get 0 mac-address ]

works too , but much shorter to type.

or

:put [/interface ethernet get <current interface name> mac-address ]

But it’s also bullshit because numbers and ids shouldn’t be used.
You could have saved yourself from necroposting with that shit.

The apparently correct one:

:put [/interface ethernet get [find where default-name=ether1] mac-address]

The apparently correct until someone not change the interface name

:put [/interface ethernet get ether1 mac-address]

The apparently correct shortest possible (until MikroTik do not add ambiguos values)

:put [/in et g [f default-name=ether1] ma]

The apparently correct short, but more readable (until MikroTik do not add ambiguos values)

:put [/int eth get [find default-name=ether1] mac]

But the only correct answer from the OP “Get Mac Address first interface” is:

:put [/int get ([find]->0) mac-address]

So literally is “put on the CLI what is obtained from Get the Mac Address from the first interface found”