Sunday, 3 January 2016

Mikrotik Router DHCP Server Configuration using VLAN

Mikrotik Router DHCP Server Configuration using 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


Basic VLAN Configuration Using Cisco Switch:

CISCO>enable
CISCO#configuration terminal
CISCO(config)#interface fastethernet 0/1
CISCO(config-if)#switchport mode trunk
CISCO(config-if)#switchport trunk allowed vlan all
CISCO(config-if)#switchport nonegotiate
CISCO(config)#vlan 100
CISCO(config-vlan)#name RED
CISCO(config)#vlan 200
CISCO(config-vlan)#name GREEN
CISCO(config)#vlan 300
CISCO(config-vlan)#name BLACK
CISCO(config)#interface fastethernet 0/2
CISCO(config-if)#switchport mode access
CISCO(config-if)#switchport access vlan 100
CISCO(config)#interface fastethernet 0/3
CISCO(config-if)#switchport mode access
CISCO(config-if)#switchport access vlan 200
CISCO(config)#interface fastethernet 0/4
CISCO(config-if)#switchport mode access
CISCO(config-if)#switchport access vlan 300
CISCO#wr