Skip to content

Instantly share code, notes, and snippets.

@dginhoux
Created July 23, 2024 16:40
Show Gist options
  • Save dginhoux/ad5f740101133b42bbe95368569cd026 to your computer and use it in GitHub Desktop.
Save dginhoux/ad5f740101133b42bbe95368569cd026 to your computer and use it in GitHub Desktop.
mikrotik_create_eth5_outofband_remove_all_default_config
#####################################
##### FROM ether2 192.168.88.1
#####################################
## remove defconf firewall filter
/ip firewall filter remove [find dynamic=no]
/ip firewall nat remove [find]
/ip firewall raw remove [find]
/ip firewall mangle remove [find]
/ip firewall address-list remove [find]
/ip firewall layer7-protocol remove [find]
/ip firewall connection remove [find]
/ipv6 firewall filter remove [find dynamic=no]
/ipv6 firewall nat remove [find]
/ipv6 firewall raw remove [find]
/ipv6 firewall mangle remove [find]
/ipv6 firewall address-list remove [find]
# /ipv6 firewall layer7-protocol remove [find]
/ipv6 firewall connection remove [find]
## configure ether5 as out of band management
/interface bridge port remove [find interface="ether5"]
/ip address add address=192.168.99.254/24 interface=ether5 network=192.168.99.0
/ip firewall filter add action=accept chain=input comment="special dummy rule for mgmt interface ether5" in-interface=ether5
/ip firewall filter add action=accept chain=output comment="special dummy rule for mgmt interface ether5" out-interface=ether5
## remove defconf interface list
/interface/list/remove LAN
/interface/list/remove WAN
/interface/list/member/remove [find]
## remove defconf dhcp config
/ip/pool/remove default-dhcp
/ip/dhcp-server/remove defconf
/ip/dhcp-server/network/remove [find]
/ip/dhcp-client/remove ether1
## remove defconf misc config
/ip neighbor discovery-settings/set discover-interface-list=none
/ip/dns/static/remove [find]
/tool/mac-server/set allowed-interface-list=none
/tool/mac-server/mac-winbox/set allowed-interface-list=none
#####################################
##### FROM ether5 192.168.99.254
#####################################
## remove defconf lan bridge
/interface/bridge/port/remove [find]
/interface/bridge/remove bridge
/ip/address/remove [find address="192.168.88.1/24"]
/user/add name=admmikrotik group=full password="PASSWORD"
/user/remove admin
/user/add address=192.168.99.0/24,fd00:0:0:99::/64 comment="system default user" group=full name=admin password="PASSWORD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment