What does the "distance" in routing mean and how/when to use

I’ve configure 3 wan pcc load balancing according the tutorial I saw online. My config can be seen here: http://forum.mikrotik.com/t/port-forward-not-working-with-pcc-load-balancing/66054/1

I was just wondering about distance in routing and was hoping that someone could explain it to me. In the config I have:

/ip route
add dst-address=0.0.0.0/0 gateway=10.1.1.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.2.2.1 routing-mark=to_WAN2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.3.3.1 routing-mark=to_WAN3 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=10.1.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.2.2.1 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.3.3.1 distance=3 check-gateway=ping

I was wondering why the distance increments with each wan gateway. Shouldn’t they all be set to 1?

Distance is the administrative distance. If you have multiple routes to the same destination network, the route with the lowest distance will be used.

Thanks for the reply. So if I am understanding you correctly,in my load balance config, the bulk of the data will be routed through WAN1. If I set the distance for WAN2 and WAN3 to 1 as well, will the data be routed more equally?

There is an additional explanation at PCC load balancing example.

To enable failover, it is necessary to have routes that will jump in as soon as others will become inactive on gateway failure. (and that will happen only if check-gateway option is active).

1,2,3 distance is made to enable failover, when first gateway is not responding, then second gateway will be used, and so on.