-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from AnnikaH/master
Support for TCP load balancer (microLB) configuration and improvements to assignment processing
- Loading branch information
Showing
10 changed files
with
633 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Iface outside { | ||
address: 10.20.17.71, | ||
netmask: 255.255.255.0, | ||
gateway: 10.20.17.1, | ||
index: 0 | ||
} | ||
|
||
Iface inside { | ||
address: 10.20.17.72, | ||
netmask: 255.255.255.0, | ||
gateway: 10.20.17.1, | ||
index: 1 | ||
} | ||
|
||
Load_balancer lb { | ||
layer: tcp, | ||
clients: { | ||
iface: outside, | ||
port: 80, | ||
wait_queue_limit: 1000, | ||
session_limit: 1000 | ||
}, | ||
servers: { | ||
iface: inside, | ||
algorithm: round_robin, | ||
pool: [ | ||
{ | ||
address: 10.20.17.81, | ||
port: 80 | ||
}, | ||
{ | ||
address: 10.20.17.82, | ||
port: 80 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Iface uplink { | ||
address: 10.0.0.42, | ||
netmask: 255.255.255.0, | ||
gateway: 10.0.0.1, | ||
index: 0 | ||
} | ||
|
||
Iface outside { | ||
address: 10.0.0.43, | ||
netmask: 255.255.255.0, | ||
gateway: 10.0.0.1, | ||
index: 1 | ||
} | ||
|
||
Iface inside { | ||
address: 10.0.0.44, | ||
netmask: 255.255.255.0, | ||
gateway: 10.0.0.1, | ||
index: 2 | ||
} | ||
|
||
Load_balancer lb { | ||
servers: { | ||
algorithm: round_robin, | ||
pool: [ | ||
{ | ||
address: 10.0.0.1, | ||
port: 6001 | ||
}, | ||
{ | ||
address: 10.0.0.1, | ||
port: 6002 | ||
}, | ||
{ | ||
address: 10.0.0.1, | ||
port: 6003 | ||
}, | ||
{ | ||
address: 10.0.0.1, | ||
port: 6004 | ||
} | ||
] | ||
} | ||
} | ||
|
||
lb.layer: tcp | ||
lb.clients: { | ||
iface: outside, | ||
port: 80, | ||
wait_queue_limit: 1000, | ||
session_limit: 1000 | ||
} | ||
|
||
lb.servers.iface: inside |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <iostream> | ||
#include <net/inet4> | ||
#include <net/ip4/cidr.hpp> | ||
#include <plugins/nacl.hpp> | ||
#include <microLB> | ||
|
||
using namespace net; | ||
|
||
static microLB::Balancer* nacl_lb_obj = nullptr; | ||
void register_plugin_nacl() { | ||
INFO("NaCl", "Registering NaCl plugin"); | ||
|
||
auto& outside = Inet4::stack<0>(); | ||
outside.network_config(IP4::addr{10,20,17,71}, IP4::addr{255,255,255,0}, IP4::addr{10,20,17,1}); | ||
auto& inside = Inet4::stack<1>(); | ||
inside.network_config(IP4::addr{10,20,17,72}, IP4::addr{255,255,255,0}, IP4::addr{10,20,17,1}); | ||
|
||
|
||
// Load balancers | ||
|
||
inside.tcp().set_MSL(15s); | ||
nacl_lb_obj = new microLB::Balancer(outside, 80, inside); | ||
|
||
Socket socket_0{ IP4::addr{10,20,17,81}, 80 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_0, nacl_lb_obj->get_pool_signal()); | ||
|
||
Socket socket_1{ IP4::addr{10,20,17,82}, 80 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_1, nacl_lb_obj->get_pool_signal()); | ||
|
||
/* | ||
Name: lb | ||
Layer: tcp | ||
Clients iface: outside | ||
Clients port: 80 | ||
Clients wait queue limit: 1000 | ||
Clients session limit: 1000 | ||
Servers iface: inside | ||
Servers algorithm: round_robin | ||
Servers pool: | ||
Node address: IP4::addr{10,20,17,81} | ||
Node port: 80 | ||
Node address: IP4::addr{10,20,17,82} | ||
Node port: 80 | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include <iostream> | ||
#include <net/inet4> | ||
#include <net/ip4/cidr.hpp> | ||
#include <plugins/nacl.hpp> | ||
#include <microLB> | ||
|
||
using namespace net; | ||
|
||
static microLB::Balancer* nacl_lb_obj = nullptr; | ||
void register_plugin_nacl() { | ||
INFO("NaCl", "Registering NaCl plugin"); | ||
|
||
auto& inside = Inet4::stack<2>(); | ||
inside.network_config(IP4::addr{10,0,0,44}, IP4::addr{255,255,255,0}, IP4::addr{10,0,0,1}); | ||
auto& outside = Inet4::stack<1>(); | ||
outside.network_config(IP4::addr{10,0,0,43}, IP4::addr{255,255,255,0}, IP4::addr{10,0,0,1}); | ||
auto& uplink = Inet4::stack<0>(); | ||
uplink.network_config(IP4::addr{10,0,0,42}, IP4::addr{255,255,255,0}, IP4::addr{10,0,0,1}); | ||
|
||
|
||
// Load balancers | ||
|
||
inside.tcp().set_MSL(15s); | ||
nacl_lb_obj = new microLB::Balancer(outside, 80, inside); | ||
|
||
Socket socket_0{ IP4::addr{10,0,0,1}, 6001 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_0, nacl_lb_obj->get_pool_signal()); | ||
|
||
Socket socket_1{ IP4::addr{10,0,0,1}, 6002 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_1, nacl_lb_obj->get_pool_signal()); | ||
|
||
Socket socket_2{ IP4::addr{10,0,0,1}, 6003 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_2, nacl_lb_obj->get_pool_signal()); | ||
|
||
Socket socket_3{ IP4::addr{10,0,0,1}, 6004 }; | ||
nacl_lb_obj->nodes.add_node(inside, socket_3, nacl_lb_obj->get_pool_signal()); | ||
|
||
/* | ||
Name: lb | ||
Layer: tcp | ||
Clients iface: outside | ||
Clients port: 80 | ||
Clients wait queue limit: 1000 | ||
Clients session limit: 1000 | ||
Servers iface: inside | ||
Servers algorithm: round_robin | ||
Servers pool: | ||
Node address: IP4::addr{10,0,0,1} | ||
Node port: 6001 | ||
Node address: IP4::addr{10,0,0,1} | ||
Node port: 6002 | ||
Node address: IP4::addr{10,0,0,1} | ||
Node port: 6003 | ||
Node address: IP4::addr{10,0,0,1} | ||
Node port: 6004 | ||
*/ | ||
} |
Oops, something went wrong.