luigirizzo / netmap

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

bridge in app, cannot use -i to specify VALE interface #708

Open xiaojin2630 opened 4 years ago

xiaojin2630 commented 4 years ago

I saw in bridge.8, -i can also specify the vale interface name, but I tried it and it will report an error.

== bridge.8 == ... -i port Name of the netmap port. It can be supplied up to two times to identify the ports that must be bridged. Any netmap port type (physical interface, VALE switch, pipe, monitor port...) can be used. If the option is supplied only once, then it must be for a physical interface and, in that case, bridge will bridge the port and the host stack.

...

The environment is as follows: nm_dev [~ ]# /data/vale-ctl 186.259216 bdg_ctl [149] bridge:0 port:0 vale0:eth2 186.259231 bdg_ctl [149] bridge:0 port:1 vale0:eth3

Situation 1: nm_dev [~ ]# ./bridge -i netmap:eth0 -i vale0:eth2 ./bridge built Jun 11 2020 09:38:16

200.927768 nm_open [950] NIOCREGIF failed: Device or resource busy vale0:eth2 200.927998 main [351] cannot open vale0:eth2

Situation 2: nm_dev [~ ]# ./bridge -i netmap:eth0 -i vale0 ./bridge built Jun 11 2020 09:38:16

209.324412 nm_open [950] missing':' in vale name vale0 209.324657 main [351] cannot open vale0

giuseppelettieri commented 3 years ago

vale0:eth2 and vale0:eth3 are special syntax for the connection of the exiting interfaces eth2 and eth3 to a VALE switch. They only make sense in vale-ctrl -a or vale-ctl -h. Think of them as ports of the vale0 bridge that are connected to those NICs: you cannot connect them to something else. What you want is probably to connect another port of VALE switch vale0 to bridge, e.g.:

./bridge -i netmap:eth0 -i vale0:0

(where 0 can be any string that is not the name of an existing network interface).

xiaojin2630 commented 3 years ago

Hello, thank you for your reply, I just saw it today.

I tested it as you said, but it didn't work.

The environment is as follows:

commit: 42270fc

pc1[eth3] ---[eth4]nm_dev[eth1] ---- [g4/0/18]switch

pc1 eth3: 192.168.50.82 switch: 192.168.50.96

When eth1 is added to vale0, it can be pinged.

nm_dev [data ]# /data/vale-ctl 625.245797 bdg_ctl [149] bridge:0 port:0 vale0:eth3 625.246083 bdg_ctl [149] bridge:0 port:1 vale0:eth4 625.246306 bdg_ctl [149] bridge:0 port:2 vale0:eth5 625.246569 bdg_ctl [149] bridge:0 port:3 vale0:eth1

64 bytes from 192.168.50.96: seq=1877 ttl=255 time=1.596 ms

64 bytes from 192.168.50.96: seq=1878 ttl=255 time=1.548 ms 64 bytes from 192.168.50.96: seq=1879 ttl=255 time=1.552 ms 64 bytes from 192.168.50.96: seq=1880 ttl=255 time=1.652 ms

When eth1 is deleted from vale0, the ping fails.

Okay, now try your method: nm_dev [data ]# /data/vale-ctl -d vale0:eth1

nm_dev [data ]# /data/vale-ctl 565.368052 bdg_ctl [149] bridge:0 port:0 vale0:eth3 565.368068 bdg_ctl [149] bridge:0 port:1 vale0:eth4 565.368078 bdg_ctl [149] bridge:0 port:2 vale0:eth5

Start bridge nm_dev [data ]# ./bridge -i netmap:eth1 -i vale0:0 ./bridge built Aug 20 2020 11:43:55

706.884066 main [356] ------- zerocopy NOT supported 706.884312 main [363] Wait 4 secs for link to come up... 710.884583 main [367] Ready to go, eth1 0x0/1 <-> vale0:0 0x0/1.

It is found that the information is always like this, and ping 192.168.50.96 fails.