Community discussions

MikroTik App
 
Josephny
Long time Member
Long time Member
Topic Author
Posts: 665
Joined: Tue Sep 20, 2022 12:11 am

List for interface type

Sat Aug 24, 2024 12:04 pm

Is there a way to add all eoip interfaces to a bridge without specifying each interface name? That is, is there a way to add an interfaces to a bridge by type?

I have multiple eoip interfaces, and would like to add them to a bridge and add them to an interface list.

This is what I have now:
/interface eoip
add allow-fast-path=no mac-address=02:81:zz:zz:zz:zz name=eoip-tunnel-to-212 remote-address=\
    xxxxx.sn.mynetname.net tunnel-id=355
add allow-fast-path=no mac-address=02:46:dd:dd:dd:dd name=eoip-tunnel-to-371 remote-address=\
    ggggggggg.sn.mynetname.net tunnel-id=37135

/interface list member
add interface=eoip-tunnel-to-371 list=DHCPdisabled
add interface=eoip-tunnel-to-212 list=DHCPdisabled

/interface bridge port
add bridge=bridge interface=eoip-tunnel-to-212 unknown-unicast-flood=no
add bridge=bridge interface=eoip-tunnel-to-371

/interface bridge filter
add action=drop chain=forward comment="DHCP Drop " dst-port=67-68 in-interface-list=DHCPdisabled ip-protocol=udp log=yes mac-protocol=ip

But, before going to each MT device and adding all eoip interfaces, I was hope there is a way to make the configs more portable.


This is what I would like:
/interface eoip
add allow-fast-path=no mac-address=02:81:zz:zz:zz:zz name=eoip-tunnel-to-212 remote-address=\
    xxxxx.sn.mynetname.net tunnel-id=355
add allow-fast-path=no mac-address=02:46:dd:dd:dd:dd name=eoip-tunnel-to-371 remote-address=\
    ggggggggg.sn.mynetname.net tunnel-id=37135


/interface list member
add <ALL-EOIP-INTERFACES> [or ALL-INTERFACES-IN-'EOIP-IFACE-LIST'] list=DHCPdisabled


/interface bridge port
add bridge=bridge [ALL-EOIP-INTERFACES] or [ALL-INTERFACES-IN-'EOIP-IFACE-LIST'] or [interface-list=DHCPdisabled]


/interface bridge filter
add action=drop chain=forward comment="DHCP Drop " dst-port=67-68 in-interface-list=DHCPdisabled ip-protocol=udp log=yes mac-protocol=ip

Thank you.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 10837
Joined: Mon Dec 04, 2017 9:19 pm

Re: List for interface type

Sat Aug 24, 2024 1:22 pm

You can add a whole interface list as a bridge member port rather than a single individual interface; if you do that, the interface list is a static member port of the bridge (so shown by export) and the member interfaces of the list are added as dynamic member ports (so only shown by print). You can try someting like this:
/interface/list/add name=all-eoip
/interface/bridge/port/add bridge=bridge interface=all-eoip
:foreach i in=[/interface/eoip/find] do={/interface/list/member/add list=all-eoip interface=$i}

From this point on, you still have to add each new eoip interface to the list manually, or make the oneliner more complex so that it would update the list rather than expect it to be empty.

If it does not work the way above (the second row fails), just swap the order of execution of the 2nd and 3rd one.
 
Josephny
Long time Member
Long time Member
Topic Author
Posts: 665
Joined: Tue Sep 20, 2022 12:11 am

Re: List for interface type

Sat Aug 24, 2024 3:16 pm

Wow, that is powerful.

I'm still struggling with the DHCP ROGUE server detected, so I need to put this on the back burner for now.

You are, as always, a generous fountain of help.

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 30 guests