Skip to content

Azure Linux App Service Network Test Tools

renhanli edited this page Dec 29, 2020 · 4 revisions

Azure Linux App Service Network Test Tools

TCP ping test

  1. Install tcpping tool:

    • Debian Linux:

      # apt update
      # apt install tcptraceroute
      # wget http://www.vdberg.org/~richard/tcpping -O /usr/bin/tcpping
      # chmod 755 /usr/bin/tcpping
    • Alpine Linux:

      # apk update
      # apk add tcptraceroute
      # wget http://www.vdberg.org/~richard/tcpping -O /usr/bin/tcpping
      # chmod 755 /usr/bin/tcpping
  2. Usage

tcpping [-d] [-c] [-C] [-w sec] [-q num] [-x count] ipaddress/url [port]
    -d   print timestamp before every result
    -c   print a columned result line
    -C   print in the same format as fping's -C option
    -w   wait time in seconds (defaults to 3)
    -r   repeat every n seconds (defaults to 1)
    -x   repeat n times (defaults to unlimited)
  1. Example
# tcpping -d -x 5 www.google.com 443

Mon Dec 28 05:40:50 UTC 2020
seq 0: tcp response from hkg12s18-in-f4.1e100.net (172.217.163.228) [open]  2.270 ms
Mon Dec 28 05:40:51 UTC 2020
seq 1: tcp response from hkg12s11-in-f4.1e100.net (216.58.200.4) [open]  2.166 ms
Mon Dec 28 05:40:52 UTC 2020
seq 2: tcp response from hkg07s34-in-f4.1e100.net (172.217.174.196) [open]  1.708 ms
Mon Dec 28 05:40:53 UTC 2020
seq 3: tcp response from hkg12s18-in-f4.1e100.net (172.217.163.228) [open]  2.162 ms
Mon Dec 28 05:40:54 UTC 2020
seq 4: tcp response from hkg07s37-in-f4.1e100.net (142.250.199.68) [open]  1.436 ms

TCP dump

  1. Install TCP dump

    • Debian Linux:

      # apt update
      # apt install tcpdump
    • Alpine Linux:

      # apk update
      # apk add tcpdump
  2. Usage

tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ]
        [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
        [ -i interface ] [ -j tstamptype ] [ -M secret ] [ --number ]
        [ -Q in|out|inout ]
        [ -r file ] [ -s snaplen ] [ --time-stamp-precision precision ]
        [ --immediate-mode ] [ -T type ] [ --version ] [ -V file ]
        [ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ]
        [ -Z user ] [ expression ]
  1. Example
  • Display all traffic to or from an IP address

    # tcpdump -s0 host 204.79.197.200
  • Display all HTTPS traffic to or from a host name over eth0

    # tcpdump -ni eth0 host bing.com and tcp port 443
  • Capture TCP dump and write to .pcap file

    # tcpdump -ni eth0 -w /home/dump01.pcap host bing.com
  • Rotate TCP dump to multiple files

    # tcpdump -w /home/tcp.pcap -s0 -C 1 -W 5
    -w: write to file
    -s0:save the whole packet
    -C: swith to next file when size bigger then xMB
    -W: generate x files 

DNS test

  1. Install "dig"

    • Debian Linux:

      # apt install dnsutils
    • Alping Linux:

      # apk add bind-tools
  2. Usage

    dig [@global-server] [domain] [q-type] [q-class] {q-opt}
                {global-d-opt} host [@local-server] {local-d-opt}
                [ host [@local-server] {local-d-opt} [...]]
  3. Examples

    • Display host IP mapping in short form of answer

      # dig cnn.com +short
      151.101.129.67
      151.101.1.67
      151.101.65.67
      151.101.193.67
    • Display detailed DNS mapping report

      # dig cnn.com
      
      ; <<>> DiG 9.10.3-P4-Debian <<>> cnn.com
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34223
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 1280
      ;; QUESTION SECTION:
      ;cnn.com.                       IN      A
      
      ;; ANSWER SECTION:
      cnn.com.                60      IN      A       151.101.193.67
      cnn.com.                60      IN      A       151.101.1.67
      cnn.com.                60      IN      A       151.101.65.67
      cnn.com.                60      IN      A       151.101.129.67
      
      ;; Query time: 5 msec
      ;; SERVER: 127.0.0.11#53(127.0.0.11)
      ;; WHEN: Tue Dec 29 02:36:28 UTC 2020
      ;; MSG SIZE  rcvd: 100
    • dig record with your specified DNS server

      # dig @8.8.8.8 cnn.com
      
      ; <<>> DiG 9.10.3-P4-Debian <<>> @8.8.8.8 cnn.com
      ; (1 server found)
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58364
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 512
      ;; QUESTION SECTION:
      ;cnn.com.                       IN      A
      
      ;; ANSWER SECTION:
      cnn.com.                38      IN      A       151.101.129.67
      cnn.com.                38      IN      A       151.101.193.67
      cnn.com.                38      IN      A       151.101.1.67
      cnn.com.                38      IN      A       151.101.65.67
      
      ;; Query time: 3 msec
      ;; SERVER: 8.8.8.8#53(8.8.8.8)
      ;; WHEN: Tue Dec 29 02:37:51 UTC 2020
      ;; MSG SIZE  rcvd: 100

FAQs

  • How to check the Linux distribution of your Docker container?

    Check /etc/os-release

    Examples:

    # cat /etc/os-release
    
      PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
      NAME="Debian GNU/Linux"
      VERSION_ID="9"
      VERSION="9 (stretch)"
      VERSION_CODENAME=stretch
      ID=debian
      HOME_URL="https://www.debian.org/"
      SUPPORT_URL="https://www.debian.org/support"
      BUG_REPORT_URL="https://bugs.debian.org/"
    # cat /etc/os-release
    NAME="Alpine Linux"
    ID=alpine
    VERSION_ID=3.11.2
    PRETTY_NAME="Alpine Linux v3.11"
    HOME_URL="https://alpinelinux.org/"
    BUG_REPORT_URL="https://bugs.alpinelinux.org/"