load balance mikrotik

22
andrew zheng edcwifi co limited Understanding Load Balance and Policy Route 1

Upload: dlookung

Post on 18-Feb-2016

45 views

Category:

Documents


1 download

DESCRIPTION

Configuracion

TRANSCRIPT

Page 1: Load Balance Mikrotik

andrew zheng!edcwifi co limited

Understanding Load Balance and Policy

Route1

Page 2: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

About Me

Mikrotik Trainer No. 75!

Certificate: MTCNA, MTCWE, MTCRE, MTCTCE, MTCUME, MTCINE, UBWA, UEWA

2

Page 3: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

About EDCwifi

Mikrotik Distributor with stock point at Hongkong, Shenzhen and Beijing.!

Mikrotik Authorized Training partner.!

Customizing partner for MfM (made for Mikrotik) product.!

www.edcwifi.com & www.edcwifi.com.cn

3

Page 4: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Made for Mikrotik

Face off your device

4

RB750series

RB450series

Page 5: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

SOHO customers mostly requires:

Automatic Fail Over!

Reliable Load Balance!

Policy Route

5

Page 6: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Topology

LAN Router

ISP1

ISP2

VPN!Server

VPN!Server!

ISP192.168.0.1

ether1!192.168.0.1

10.1.1.88

10.2.2.88

Policy route to VPN

local IP 192.168.12.99!remote IP 192.168.12.165

6

Page 7: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Sample configuration

Get IP address from ISP

7

Page 8: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Dial VPN connection (optional for policy route)

8

Page 9: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules!All packets with gateway router IP as destination should be accept

Skipping PCC rules for packets with !router gateway IP as its destination!

to their gateway router.!(for correcting DNS request and!

other services)

0 1 2

9

Page 10: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules!Make sure all packets coming from WAN interface going out from the same WAN interface

3 4 5

10

Page 11: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules and Address list!VPN policy route

Address list example

6Add all IP addresses that !

planned to go !through VPN connection

mark connection of every packets with !IP destination address listed in !

VPN address list11

Page 12: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules!Connection Mark base on PCC

7 8

12

Page 13: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules!Route Mark for PCC

11109

13

Page 14: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Mangle Rules!Route Mark for Output Chain

12 1413

14

Page 15: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

IP Route Rules!Add Default Gateway for our Routing Mark

15

Page 16: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

IP Route Rules!Fail Over

By adding default gateway!that not booked for routing mark!

we already create fail over system.!Just adjust the distance for !

priority purpose

16

Page 17: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

NAT

17

Page 18: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Checking PCC Result

18

Page 19: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Checking Policy routes Result

19

Page 20: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Packet Flow with mangle chain simple explanation

Input interface!eq: ether1,

ether2,ether3, etc

Mangle pre-

routing

DST-NAT

Routing Decision

Local Process

Mangle input

Mangle output

Mangle forward

Mangle post-

routing

SRC-NAT

Output interface!eq: ether1,

ether2,ether3, etc

Routing Adjustment

packet A, going into ether1 with src add: 192.168.0.2 and dst add: 222.111.222.111

packet A!src:192.168.0.2!

dst: 222.111.222.111!in int: ether1!

no mark

packet A!src:192.168.0.2!

dst: 222.111.222.111!in int: ether1!

no mark

connection tracking

connection tracking

add mangle 1-conn!and 1-route

packet A!src:192.168.0.2!

dst: 222.111.222.111!1-conn!1-route!

in int: ether1

packet A!src:192.168.0.2!

dst: 222.111.222.111!1-conn!1-route!

in int: ether1

checking DST-NAT!rules

packet A!src:192.168.0.2!

dst: 222.111.222.111!1-conn!1-route!

in int: ether1!out int: ISP1

checking DST-IP!to local or forward-!

output interface

packet A!src:192.168.0.2!

dst: 222.111.222.111!1-conn!1-route!

in int: ether1!out int ISP1

checking mangle forward-!filter forward

Filter!Forward

packet A!src:192.168.0.2!

dst: 222.111.222.111!1-conn!1-route!

out int ISP1

checking mangle !post routing

packet A!src:10.1.1.97!

dst: 222.111.222.111!1-conn!1-route!

out int ISP1

Change SRC IP

packet A!src:10.1.1.97!

dst: 222.111.222.111!

Recording !conn track

20

Page 21: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Packet Flow with mangle chain simple explanation

Input interface!eq: ether1,

ether2,ether3, etc

Mangle pre-

routing

DST-NAT

Routing Decision

Local Process

Mangle input

Mangle output

Mangle forward

Mangle post-

routing

SRC-NAT

Output interface!eq: ether1,

ether2,ether3, etc

Routing Adjustment

replied packet A (A-1), going into ISP1 interface with src add: 222.111.222.111 and dst add: 10.1.1.97

packet A-1!src: 222.111.222.111!

dst: 10.1.1.97!in int: ISP1

packet A-1!src: 222.111.222.111!

dst: 10.1.1.97!in int: ISP1!

recognize this packet is one connection with A

connection tracking

connection tracking

Check mangle pre-routing,!adding mark !

1-conn

packet A-1!src: 222.111.222.111!

dst: 10.1.1.97!1-conn!

in int: ISP1

packet A-1!src: 222.111.222.111!

dst: 192.168.0.2!1-conn!

in int: ISP1

checking DST-NAT!rules packet A-1!

src: 222.111.222.111!dst: 192.168.0.2!

1-conn!in int: ISP1!goto Ether1

checking DST-IP!to local or forward-!

output interface

packet A-1!src: 222.111.222.111!

dst: 192.168.0.2!1-conn!

in int: ISP1!out int ether1

checking mangle forward-!filter forward

Filter!Forward

packet A-1!src: 222.111.222.111!

dst: 192.168.0.2!1-conn!

out int ether1

checking mangle !post routing

packet A-1!src: 222.111.222.111!

dst: 192.168.0.2!1-conn!

out int ether1

Change SRC IP

packet A-1!src: 222.111.222.111!

dst: 192.168.0.2!

check and update!conn-track

21

Page 22: Load Balance Mikrotik

EDCwifi - Andrew Zheng 2015, April 17 - Vietnam MUM

Any Question?

Thank you!

For Goods Inquiry: [email protected]!

For Training Inquiry: [email protected]!

See you again

22