Mikrotik

From wiki.N4VX.net
Jump to navigation Jump to search

Mikrotik Router DHCP Server Configuration with VLAN

IP address Configuration:

/ip address add address=103.7.248.206/29  network=103.7.248.200 broadcast=103.7.248.207 interface=WAN

VLAN Configuration on Mikrotik Router:

/interface vlan
add name=100-RED  interface=LOCAL  vlan-id=100
add name=200-GREEN  interface=LOCAL  vlan-id=200
add name=300-BLACK  interface=LOCAL  vlan-id=300
/ip address
add address=10.10.10.1/24 interface=100-RED
add address=172.16.1.1/24 interface=200-GREEN
add address=192.168.1.1/24 interface=300-BLACK

Create an IP address pool:

/ip pool add name=100-RED  ranges=10.10.10.1-10.10.10.254
/ip pool add name=200-GREEN  ranges=172.16.1.1-172.16.1.254
/ip pool add name=300-BLACK  ranges=192.168.1.1-192.168.1.254

DNS Configuration:

/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp- servers=4.4.4.4,8,8.8.8.8packet-size=512

DHCP Server Configuration for VLAN:

/ip dhcp-server enable 0
/ip dhcp-server add interface = LOCAL address-pool = 100-RED
/ip dhcp-server add interface = LOCAL address-pool = 200-GREEN
/ip dhcp-server add interface = LOCAL address-pool = 300-BLACK
/ip dhcp-server  network add address = 10.10.10.0/24 gateway = 10.10.10.1 dns-server = 8.8.8.8 comment=”100-RED”
/ip dhcp-server  network add address = 172.16.1.0/24 gateway = 172.16.1.1 dns-server = 8.8.8.8 comment=”200-GREEN”
/ip dhcp-server network add address = 192.168.1.0/24 gateway = 192.168.1.1 dns-server = 8.8.8.8 comment=”300-BLACK”

NAT Configuration:

/ip firewall nat
add chain=srcnat action=masquerade src-address=192.168.1.0/24 out-interface=WAN
add chain=srcnat action=masquerade src-address=172.16.1.0/24 out-interface=WAN
add chain=srcnat action=masquerade src-address=10.10.10.0/24 out-interface=WAN

Default Gateway Setup:

/ip route add dst-address=0.0.0.0/0  gateway=103.7.248.201