| 
									
										
										
										
											2016-03-23 15:57:48 +00:00
										 |  |  | # loadbalance
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | ## Name
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 11:41:13 -07:00
										 |  |  | *loadbalance* - randomizes the order of A, AAAA and MX records. | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ## Description
 | 
					
						
							| 
									
										
										
										
											2018-07-06 11:27:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 11:41:13 -07:00
										 |  |  | The *loadbalance* will act as a round-robin DNS load balancer by randomizing the order of A, AAAA, | 
					
						
							| 
									
										
										
										
											2018-07-06 22:49:21 +01:00
										 |  |  | and MX records in the answer. | 
					
						
							| 
									
										
										
										
											2018-07-09 13:08:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 11:41:13 -07:00
										 |  |  | See [Wikipedia](https://en.wikipedia.org/wiki/Round-robin_DNS) about the pros and cons of this | 
					
						
							| 
									
										
										
										
											2018-07-06 11:27:40 +01:00
										 |  |  | setup. It will take care to sort any CNAMEs before any address records, because some stub resolver | 
					
						
							|  |  |  | implementations (like glibc) are particular about that. | 
					
						
							| 
									
										
										
										
											2016-03-26 09:53:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-23 15:57:48 +00:00
										 |  |  | ## Syntax
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ~~~ | 
					
						
							| 
									
										
										
										
											2016-10-10 20:13:22 +01:00
										 |  |  | loadbalance [POLICY] | 
					
						
							| 
									
										
										
										
											2016-03-23 15:57:48 +00:00
										 |  |  | ~~~ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 11:41:13 -07:00
										 |  |  | * **POLICY** is how to balance. The default, and only option, is "round_robin". | 
					
						
							| 
									
										
										
										
											2016-03-23 15:57:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ## Examples
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-10 09:39:35 +02:00
										 |  |  | Load balance replies coming back from Google Public DNS: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ~~~ corefile | 
					
						
							|  |  |  | . { | 
					
						
							|  |  |  |     loadbalance round_robin | 
					
						
							| 
									
										
										
										
											2018-07-06 11:27:40 +01:00
										 |  |  |     forward . 8.8.8.8 8.8.4.4 | 
					
						
							| 
									
										
										
										
											2017-10-10 09:39:35 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-03-23 15:57:48 +00:00
										 |  |  | ~~~ |