sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
739 stars 1.43k forks source link

Not Detecting Traffic In docker-sonic-vs image #18498

Open ThePerfectComputer opened 7 months ago

ThePerfectComputer commented 7 months ago

Description

I followed the tutorial here. I then was able to successfully send pings between two network namespaces as is done in the tutorial. But when I open tcpdump in either of the two namespaces, none of the traffic shows up!

Oddly enough, opening tcpdump in the container instance of the docker-sonic-vs image, I'm able to see all the ping requests and replies.

Steps to reproduce the issue:

  1. Download the docker-sonic-vs.gz image from https://sonic.software
  2. sudo docker load < docker-sonic-vs
  3. Follow the rest of the instructions from the Github tutorial
  4. Set the following variables:
    NS0='sudo ip netns exec sw-srv0'
    NS1='sudo ip netns exec sw-srv1'

Here is where the weirdness begins:

Terminal 1

# drop into SONiC container
$ sudo docker exec -it vs bash
root@b089c99e1934:/# tcpdump

Now we switch over to "Terminal 2" Terminal 2

user$ NS0='sudo ip netns exec sw-srv0'
user$ NS1='sudo ip netns exec sw-srv1'
user$ $NS1 ip a | grep "inet .* eth0"
    inet 10.0.0.3/31 brd 10.255.255.255 scope global eth0
# note our IP address is "10.0.0.3"
user$ $NS1 tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes

And switch over to "Terminal 3" Terminal 3

user$ $NS0 ip a | grep "inet .* eth"
    inet 10.0.0.1/31 brd 10.255.255.255 scope global eth0

# note namespace0(NS0) has an IP address of 10.0.0.1
user$ $NS0 ping 10.0.0.3
PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
64 bytes from 10.0.0.3: icmp_seq=1 ttl=63 time=0.087 ms
64 bytes from 10.0.0.3: icmp_seq=2 ttl=63 time=0.139 ms
64 bytes from 10.0.0.3: icmp_seq=3 ttl=63 time=0.173 ms
^C
--- 10.0.0.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2049ms
rtt min/avg/max/mdev = 0.087/0.133/0.173/0.035 ms

Above seems good, we're getting a response, so now let's check on "Terminal 1"

Terminal 1 Again

root@b089c99e1934:/# tcpdump 
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on Ethernet0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
18:09:13.961722 IP 10.0.0.1 > 10.0.0.3: ICMP echo request, id 10254, seq 1, length 64
18:09:13.961778 IP 10.0.0.3 > 10.0.0.1: ICMP echo reply, id 10254, seq 1, length 64
18:09:14.990805 IP 10.0.0.1 > 10.0.0.3: ICMP echo request, id 10254, seq 2, length 64
18:09:14.990908 IP 10.0.0.3 > 10.0.0.1: ICMP echo reply, id 10254, seq 2, length 64
18:09:16.010871 IP 10.0.0.1 > 10.0.0.3: ICMP echo request, id 10254, seq 3, length 64
18:09:16.010941 IP 10.0.0.3 > 10.0.0.1: ICMP echo reply, id 10254, seq 3, length 64

Also looks good. What about "Terminal 2"?

Terminal 2 Again

user$ $NS1 tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes

Very strange, no traffic to report. I'm wondering if I somehow need to put SONiC in a switch mode.

Describe the results you received:

I able to see ping traffic from show up in the container instance of the docker-sonic-vs image from the sw-srv0 namespace to the sw-srv1 namespace when invoking tcpdump in the docker container. But I'm not able to see the ping traffic when invoking tcpdump in either of the sw-srv0 or sw-srv1 namespaces.

Describe the results you expected:

I expect to see the ping traffic when invoking tcpdump in either of the sw-srv0 or sw-srv1 namespaces.

Output of show version:

root@b089c99e1934:/# show version
/bin/sh: 1: sudo: not found

SONiC Software Version: SONiC.
SONiC OS Version: 12
Traceback (most recent call last):
  File "/usr/local/bin/show", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/show/main.py", line 1329, in version
    click.echo("Distribution: Debian {}".format(version_info['debian_version']))
KeyError: 'debian_version'

Output of show techsupport:

This command takes quite some time to run and spits out a lot of content and errors... I don't think the errors are my fault as I've only run a handful of basic commands since instantiating the docker-sonic-vs image.

Additional information you deem important (e.g. issue happens only occasionally):

forrestchu commented 7 months ago

on Terminal 2, will "tcpdump -i any" work?

judyjoseph commented 7 months ago

@ThePerfectComputer please share more details of the test you do, Are you trying mulit-asic vs ?