Datasheet
RouterOS PHP class
174
$parser->update($conn); // perform update
?>
# load predefined global OSPF configuration
require ospf.cfg
# set device name, clock and ntp-client
section identity /system/identity value
section clock /system/clock value
section ntp-client /system/ntp/client value
set identity name=%name%
set clock time-zone-name=Europe/Warsaw
set ntp-client enabled=true mode=unicast primary-ntp=192.168.10.5 secondary-ntp=192.168.10.6
# of course in later part of configuration you can change configuration
set ntp-client enabled=false
# custom commands
add firewall-filter in-interface=ether1 out-interface=ether2 chain=forward action=drop
# allow forward for a few clients
allow-forward 192.168.1.1 192.168.10.5
allow-forward 192.168.1.5 192.168.10.5
allow-forward 192.168.1.10 192.168.10.5
# define your own function
function allow-interface $interface
if(!$interface)
$parser->error("interface not specified");
$parser->config("firewall-filter", "in-interface=$interface chain=forward action=accept");
$parser->config("firewall-filter", "out-interface=$interface chain=forward action=accept");
endfunction
allow-interface ether1
allow-interface ether2
# check RouterOS version and configure differently
if %version% ~= 3.*
section ospf /routing/ospf value
set ospf distribute-default=never
redistribute-connected=as-type-2 redistribute-static=as-type-2
redistribute-rip=no redistribute-bgp=no metric-default=2
metric-connected=2 metric-static=1 metric-rip=1 metric-bgp=1
else
section ospf-instance /routing/ospf/instance addset name
add ospf-instance name=default distribute-default=never
redistribute-connected=as-type-2 redistribute-static=as-type-2










