Network Connection

Status

netstat

# -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

        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 ```

3. **Check Results of Tcpdump**

    To check the details, use Wireshark.

wireshark /tmp/tcpdump.pcap

DNS Resolver

Check the condition of the name resolution

ping example.com

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
nameserver 8.8.8.8
...

Below are some representative DNS servers.

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='172.1.1.20', dst='172.1.1.40')
    >>> send(spoof_example)
  1. 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='172.1.1.24', dst='172.1.1.40')