Last modified: 2022-01-01


Network Connection



# -t: tcp, -u: udp, -l: listen, -p: programs, -n: don't resolve names
netstat -lnptu
# -r: route
netstat -rn

Connectivity of Hosts

ping <target-ip>

# Stop after 5 times
ping -c 5 <target-ip>

# No DNS resolution
ping -n 3 <target-ip>

Trace Route Path Between Two Nodes

traceroute <target-ip>

Investigate Packets/Traffic

  • ICMP

    Check the status of network connections between nodes.

    1. Start Tcpdump

      To start analyzing, start tcpdump. Here we use eth0 interface.

      sudo tcpdump -i eth0 icmp
      # For Wireshark
      sudo tcpdump -i eth0 icmp -w /tmp/tcpdump.pcap
    2. Send Packets to Target

      For example, send 5 packets to target.

      sudo ping -c 5 <target-ip>
    3. Check Results of Tcpdump

      To check the details, use Wireshark.

      wireshark /tmp/tcpdump.pcap

DNS Resolver

Check the condition of the name resolution


If you cannot ping the target website, the DNS resolver is not working.
To change the DNS resolver, update the original nameserver to the new one in /etc/resolv.conf.
For example:

# nameserver x.x.x.x

Below are some representative DNS servers.

  • Google - &
  • Quad9 - &
  • OpenDNS - &
  • Cloudflare - &

After updating /etc/resolv.conf, restart the name resolution service.

sudo systemctl restart systemd-resolved.service

Send Packet with MAC/IP Spoofing

  1. IP Spoofing

    sudo ./run_scapy
    >>> spoof_example = IP(src='', dst='')
    >>> send(spoof_example)
  2. MAC and IP Spoofing

    sudo ./run_scapy
    >>> spoofed_MAC_and_IP = Ether(src='00:0c:29:1a:2b:3c', dst='00:0c:29:bd:da:cf', type=0x0800)/IP(src='', dst='')