# Layer 2 Config and Analysis

## Basics

See and analyze information from the interfaces

```bash
ip addr show     # List all IPs for all interfaces
ip route show    # Show all known routes
ip link set eth0 down    # Disable eth0 interface
ip link set eth0 up      # Enable eth0 interface
ip neigh         # List the ARP table
```

Make changes to the interfaces

```bash
ip addr add 192.168.1.1/24 dev eth0     # Configures an IP
ip route add default via 192.168.1.1    # Configure default route
```

## Layer 2 Scanning

Try to find other devices on the local network using ARP scanning and other neat tricks. These generally require `sudo` permissions because it is frame crafting.

```bash
sudo arp-scan -I eth0 192.168.0.0/24
sudo netdiscover -r 192.168.0.0/24
sudo nmap -sn 192.168.0.0/24

nbtscan -r 192.168.0.0/24     # Scanning with NetBIOS, more useful inside a domain

alive6 eth0            # Send IPv6 ICMP out an interface

```

Scapy is another great tool to craft frames on the wire :) 👷‍♂️


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.m4lwhere.org/offensive/recon/layer-2-config-and-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
