LinuxCommandLibrary

raw

Bind a raw character device to a block device

TLDR

Bind a raw character device to a block device

$ raw /dev/raw/raw[1] [/dev/block_device]
copy

Query an existing binding instead of setting a new one
$ raw /dev/raw/raw[1]
copy

Query all bound raw devices
$ raw [[-qa|--query --all]]
copy

SYNOPSIS

raw [-s src] [-d dest] [-i interface] [-p protocol] [-l length] [-n count] [-r rate] [-T ttl] [-6|-4] [file]

PARAMETERS

-s src
    Specifies the source MAC address. If omitted, a random MAC address is used.

-d dest
    Specifies the destination MAC address. If omitted, a random MAC address is used.

-i interface
    Specifies the network interface to use for sending packets. This is a mandatory parameter.

-p protocol
    Specifies the Ethernet protocol type (e.g., 0x0800 for IPv4, 0x86DD for IPv6). If omitted, defaults to 0x800 (IPv4).

-l length
    Specifies the payload length (in bytes) of the packet. If omitted, the payload data is taken from the input file or generated automatically.

-n count
    Specifies the number of packets to send. If omitted, only one packet is sent.

-r rate
    Specifies the rate at which packets should be sent (packets per second). Useful for simulating network traffic.

-T ttl
    Specifies the IP Time To Live (TTL) value.

-6
    Force IPv6 protocol.

-4
    Force IPv4 protocol.

file
    Specifies a file containing the payload data for the packet. If omitted, raw will generate random payload data.

DESCRIPTION

The `raw` command is a utility that allows users to send arbitrary, raw Ethernet packets directly onto a network interface. This bypasses the standard TCP/IP stack, granting direct control over packet construction and transmission. This tool is extremely useful for network diagnostics, security testing, and implementing custom network protocols.

Due to its low-level nature, `raw` requires significant understanding of network protocols and packet structures. Incorrect usage can lead to network instability or security vulnerabilities. It typically requires root privileges because writing raw packets requires direct access to network interfaces.

CAVEATS

Using raw sockets requires root privileges. Incorrect packet construction can cause network problems. Requires understanding of Ethernet packet structures.

SECURITY CONSIDERATIONS

Due to its ability to craft arbitrary packets, the `raw` command should be used with extreme caution. It can be used to perform network attacks, such as spoofing and denial-of-service attacks. Always ensure you have proper authorization before using this tool on a network.

PACKET CONSTRUCTION

When using `raw`, the user is responsible for correctly constructing the Ethernet packet, including the Ethernet header, IP header (if applicable), and any other protocol headers. Missing or incorrect header fields can lead to packets being dropped or misinterpreted by network devices.

SEE ALSO

tcpdump(1), wireshark

Copied to clipboard