How to PING between two hosts connected to same SONiC switch

153 views
Skip to first unread message

刘宏岩

unread,
Mar 18, 2021, 4:55:00 AM3/18/21
to sonicproject
Hello everyone, 

I want to test the switching function of a VM Sonic switch. I create a KVM to run the Sonic switch and attach two hosts to it, but PING doesn't work between two hosts.

 Here are some details:

1. I use this command to create the Sonic VM (network configuration only):

     sudo /usr/bin/kvm
    -device e1000,netdev=onienet0 \
    -netdev user,id=onienet0,hostfwd=tcp:0.0.0.0:3040-:22 \
    -device e1000,netdev=onienet1 \
    -netdev tap,id=onienet1,ifname=tap1 \
    -device e1000,netdev=onienet2 \
    -netdev tap,id=onienet2,ifname=tap2 \

With the above command, the Sonic VM has three ports. `eth0` is the Sonic management port, `eth1` with `tap1` as its backend, and `eth2` with `tap2` as its backend.

2. Creating virtual hosts by using Linux network namespace:

ip netns add h1
ip netns add h2
ip link add name h1-backend type veth peer name h1-eth0
ip link add name h2-backend type veth peer name h2-eth0
ip link set h1-eth0 netns h1
ip link set h2-eth0 netns h2
ip netns exec h1 ip link set h1-eth0 up
ip netns exec h2 ip link set h2-eth0 up
ip netns exec h1 ip link set lo up
ip netns exec h2 ip link set lo up
ip netns exec h1 ip addr add 192.168.10.10/24 dev h1-eth0
ip netns exec h2 ip addr add 192.168.10.20/24 dev h2-eth0

3. I creat two ovs-switches to connect `h1-backend` and `tap1`, `h2-backend` and `tap2`.

4. Unfortunately,  the PING test from h1 to h2 failed.

5. Topology:

image.png

6. Questions:

i. The reason for the PING failure.
ii. Does packets received by `eth1` in Sonic VM will be processed by the Sonic network stack (i.e., containers in Sonic)?

Thanks.
Reply all
Reply to author
Forward
0 new messages