我有负载平衡器应用程序,用于平衡连接在两个不同交换机上的两台服务器之间的拓扑结构, 当我从第一个域发送流量并且选择是来自第二个域的服务器时,只有 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)
当我看到两个交换机上的流表时,我看到流安装正确。谁能告诉我有什么问题?