> For the complete documentation index, see [llms.txt](https://www.xtormin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.xtormin.com/pentesting-en-infraestructuras/redes-wi-fi/comandos-esenciales.md).

# Comandos esenciales

## General

Para mostrar información sobre las interfaces de red y wifi:

```bash
ip a
ip link show
iwconfig
```

<figure><img src="/files/nq2OBGBh7nb4tBcrDrBe" alt=""><figcaption></figcaption></figure>

## Cambio del modo de la interfaz

### Modo monitor

{% hint style="warning" %}
Para la gran mayoría de las pruebas, es **necesario tener la interfaz de red en modo monitor** y para ello será necesario **utilizar una tarjeta wifi compatible** con ello.
{% endhint %}

El modo monitor permite **capturar paquetes**, de esta forma, es posible obtener información de los puntos de acceso y clientes conectados, entre otros detalles.

{% hint style="warning" %}
Para realizar la captura de paquetes, es necesario cambiar la interfaz a modo *monitor* (o modo promiscu&#x6F;*)*. Por defecto, se suele encontrar en modo *managed*.
{% endhint %}

Para cambiar el modo de una interfaz, por ejemplo, la **wlan0** a **modo monitor**, se realizarán las siguientes acciones:

1. Tomar como variable **IFACE** el nombre de la interfaz de red que se quiera modificar. (ej: wlan0)
2. Deshabilitar la interfaz de red.
3. Cerrar (mata 🔪🔪🔪) los procesos de red (sí, te vas a quedar sin internet 🕯️ asegurate de haber instalado antes las herramientas que necesitarás).
4. Cambiar la interfaz a modo *monitor*.
5. Habilitar la interfaz de red.
6. Mostar información de las interfaces de red inalámbricas.

{% hint style="info" %}
Por ejemplo, si las redes o SSIDs se encuentran en bandas de 2,4Ghz o 5Ghz, deberemos modificar la configuración de nuestra tarjeta para que trabaje con esa banda y canales correspondientes.
{% endhint %}

A continuación, se detallan los comandos de acuerdo a las bandas con las que se desee trabajar:

**2,4Ghz**

{% tabs %}
{% tab title="ip" %}

```bash
IFACE=wlan0
ip link set $IFACE down
airmon-ng check kill
iw $IFACE set monitor none
iw dev $IFACE set txpower fixed 3000
ip link set $IFACE up
iw dev
```

{% endtab %}

{% tab title="ifconfig" %}

```bash
IFACE=wlan0
ifconfig $IFACE down
airmon-ng check kill
iwconfig $IFACE mode monitor
ifconfig $IFACE up
iwconfig
```

{% endtab %}
{% endtabs %}

**5Ghz**

{% tabs %}
{% tab title="ip" %}

```bash
IFACE=wlan0
ip link set $IFACE down
airmon-ng check kill
iw $IFACE set monitor none
iw dev $IFACE set txpower fixed 3000
iw dev $IFACE set freq 5180
ip link set $IFACE up
iw dev
```

{% endtab %}

{% tab title="ifconfig" %}

```bash
IFACE=wlan0
CH=108
ifconfig $IFACE down
airmon-ng check kill
iwconfig $IFACE mode monitor
iwconfig $IFACE channel $CH
ifconfig $IFACE up
iwconfig
```

{% endtab %}
{% endtabs %}

### Modo managed

{% tabs %}
{% tab title="ip" %}

```bash
IFACE=wlan0
ip link set $IFACE down
iw $IFACE set type managed
ip link set $IFACE up
iw dev
```

{% endtab %}

{% tab title="ifconfig" %}

```bash
IFACE=wlan0
service network-manager start
ifconfig $IFACE down
iwconfig $IFACE mode managed
ifconfig $IFACE up
iwconfig
```

{% endtab %}
{% endtabs %}

## Cambio de MAC por la del AP objetivo

Aunque es algo opcional, se recomienda hacerlo:

{% code overflow="wrap" %}

```bash
IFACE="wlan0"
systemctl stop network-manager
ip link set $IFACE down
macchanger -m <BSSID del AP objetivo> $IFACE
ip link set $IFACE up
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://www.xtormin.com/pentesting-en-infraestructuras/redes-wi-fi/comandos-esenciales.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.
