我有负载均衡器应用程序,可在两台不同交换机the topology like the picture上连接的两台服务器之间取得平衡 当我从第一个域发送流量并且选择是来自第二个域的服务器时,只有syn数据包到达,然后RST从客户端发送到服务器
平衡器的代码是:
def handle_request_on_server2 (self, packet, event, server):
"Handling request on server2"
msg = of.ofp_flow_mod()
msg.idle_timeout = IDLE_TIMEOUT
msg.hard_timeout = HARD_TIMEOUT
msg.buffer_id = None
msg.priority= 500
msg.data = event.ofp # Forward the incoming packet
msg.match.in_port = event.port
print "in_port = ", event.port
msg.match.dl_src = packet.src
print "packet src mac = ", packet.src
msg.match.dl_dst = LOAD_BALANCER_MAC
msg.match.dl_type = ethernet.IP_TYPE
msg.match.nw_src = packet.next.srcip
msg.match.nw_dst = LOAD_BALANCER_IP
# Append actions
# Set the dst IP and MAC to load balancer's
# Forward the packet to server's port
msg.actions.append(of.ofp_action_nw_addr.set_dst(server.ip))
msg.actions.append(of.ofp_action_dl_addr.set_dst(server.mac))
msg.actions.append(of.ofp_action_output(port = server.port))
print "output port = ", server.port
self.connection.send(msg)
" Install reverse rule from server2 to the client in domain1 "
msg = of.ofp_flow_mod()
msg.idle_timeout = IDLE_TIMEOUT
msg.hard_timeout = HARD_TIMEOUT
msg.buffer_id = None
msg.priority = 500
msg.match.in_port = 1
msg.match.dl_src = server.mac
msg.match.dl_dst = packet.dst
msg.match.dl_type = ethernet.IP_TYPE
msg.match.nw_src = server.ip
msg.match.nw_dst = packet.next.srcip
# Append actions
# Set the src IP and MAC to load balancer's
# Forward the packet to client's port
msg.actions.append(of.ofp_action_nw_addr.set_src(LOAD_BALANCER_IP))
msg.actions.append(of.ofp_action_dl_addr.set_src(LOAD_BALANCER_MAC))
msg.actions.append(of.ofp_action_output(port = event.port))
self.connection.send(msg)
当我在两台交换机上看到流表时,我看到正确安装了流量。谁能告诉我这是什么问题?