luigirizzo / netmap

Automatically exported from code.google.com/p/netmap
BSD 2-Clause "Simplified" License
1.86k stars 537 forks source link

look for monitor interface setup guide #813

Open missyoyo opened 3 years ago

missyoyo commented 3 years ago

Hi: I see netmap support "netmap monitors can be used to do monitoring of network traffic on another adapter, when the latter adapter is working in netmap mode" If I want monitor eth1 inout packet,how can I set up monitor interface,I can not find any guide about this.Thank you.

giuseppelettieri commented 3 years ago

You need to pass the NR_MONITOR_TX and/or the NR_MONITOR_RX flag when you register the port that you want to monitor. If you are using nm_open() or nmport_open(), just open the eth1/rt port and the functions will set the flags for you.

missyoyo commented 3 years ago

@giuseppelettieri I am sorry I did not make it clearly,I mean some untils can create monitor interface like vale-ctl -n mon:eth1 I am try to add eth1 and eth2 to vale0 by: vale-ctl -a vale0:eth1 vale-ctl -a vale0:th2 After that both eth1 and th2 can send packet to each other,but seems I can not monitor eth1 or eth2. When I add eth1 and eth2 to vale0. pkt-gen -i eth1 -f rx will not work. THS

giuseppelettieri commented 3 years ago

Just add /rt to the port name in pkt-gen:

pkt-gen -i eth1/rt -f rx
missyoyo commented 3 years ago

Thank you. Seems eht1/rx do not like other vale interface, it can not add to other sofware like open-vswitch.

missyoyo commented 3 years ago

@giuseppelettieri Hello,I have do more test about monitor use,I have 2 interface with 10Gbps(eth0 and eth1),when I add both eth0 and th1 to open-vswitch br0, then send packet from eth0 to eth1.I got 1.42Mpps from eth2(I got 2 cpu core 100%) When I add eth0 and eth1 to vale0 and then add them(eth0 and the1) to open-vswitch witch the same config,I got 2.91Mpps form eth2(I got 1 cpu core 91% use). So it seem I get better performance when add NIC to vale.But there is a problem, When I add eth0 and eth1 to vale0, they can send packet to each other.As I only want monitor packet. So packet from eth1->eth0 is not should allowed at this time. With open-vswitch I can drop all packet eth1>eth0,but with vale0, How can drop packet from eth1>eth0.Thank you for your help.

missyoyo commented 3 years ago

@giuseppelettieri Hi: Sorry, I just do more test about vale, I think vale0 should like a switch. But I have try to add eth0 and eth1 to vale0, And conntect two PC witch same LAN ip address, Seems PC1 can not ping or connect to PC2.That is good for my monitor use. So I think nothing should be done for filter out packet from eth1 to eth0.That is perfect for me. So if two phy NIC add to same vale should not communicate like a bridge as vale designed, Please do not change it.Thank you.