Wednesday, May 4, 2016

DHCP SERVER

/interface ethernet
set [find default-name=ether1 ] name=ether1
set [find default-name=ether2 ] name=ether2
set [find default-name=ether3 ] name=ether3
set [find default-name=ether4 ] name=ether4
set [find default-name=ether5 ] name=ether5
set [ find default-name=ether2 ] master-port=ether5
set [ find default-name=ether3 ] master-port=ether5
set [ find default-name=ether4 ] master-port=ether5
set [ find default-name=ether1 ] comment="WAN NETWORK"
set [ find default-name=ether5 ] comment="DHCP SERVER"
/ip address
add address=192.168.1.10/24 comment="WAN NETWORK" interface=ether1 \
    network=192.168.1.0
add address=192.168.10.1/24 comment="DHCP SERVER NETWORK" interface=ether5 \
    network=192.168.10.0
/ip route
add distance=1 gateway=192.168.1.1
/ip dns
set servers=192.168.1.1,8.8.4.4
/ip pool
add name=dhcp_pool2 ranges=192.168.10.2-192.168.10.254
/ip dhcp-server
add address-pool=dhcp_pool2 disabled=no interface=ether5 name=dhcp3
/ip dhcp-server network
add address=192.168.10.0/24 gateway=192.168.10.1
/ip firewall nat
add action=masquerade chain=srcnat comment="DHCP SERVER MASQUERADE" \
    src-address=192.168.10.2-192.168.10.254 to-addresses=0.0.0.0

DOWNLOAD FULL SCRIPTS

2 comments: