新安装的XenServer6默认为Open vSwitch,XenServer5.6默认为网桥模式,查看当前网络模式:
cat /etc/xensource/network.conf
openvswitch
更改网络为虚拟交换机Open vSwitch模式:
#https://www.haiyun.me
xe-switch-network-backend openvswitch
切换回网桥bridge模式:
xe-switch-network-backend bridge
配置虚拟交换机输出NetFlow数据到分析端,可参考:Linux下Nfsen和Nfdump配置Netflow分析端。
ovs-vsctl -- --id=@netflow create netflow targe=\"192.168.1.5:9995\" active_timeout=30 \
-- set bridge xenbr0 netflow=@netflow
输出sFlow数据:
ovs-vsctl -- --id=@sflow create sflow agent=eth1 targe=\"192.168.1.5:9995\" header=128 sampling=512 polling=30 \
-- set bridge xenbr0 sflow=@sflow
查看是否有NetFlow数据输出:
tcpdump -nn port 9995
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
18:12:16.535132 IP 192.168.1.15.55104 > 192.168.1.3.9995: UDP, length 600
18:12:17.544569 IP 192.168.1.15.55104 > 192.168.1.3.9995: UDP, length 216
更改Netflow或sFlow参数:
ovs-vsctl set NetFlow xenbr0 targe=\"192.168.1.3:9995\"
ovs-vsctl list netflow/sflow
删除Netflow/sFlow:
ovs-vsctl remove bridge xenbr0 netflow/sflow <uuid>