Ip link set / `ifconfig

From HackOps
Revision as of 17:54, 17 May 2025 by Vegard (talk | contribs) (Created page with "= ip link set / ifconfig = == Introduction == The ip link set and ifconfig commands are used in Linux environments to manage network interfaces. These tools allow users to configure interface parameters, including the MAC (Media Access Control) address. On Windows systems, similar functionality can be accessed through network adapter settings or PowerShell. Changing a MAC address is commonly performed for testing, research, or evasion purposes. == What is a MAC Addres...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ip link set / ifconfig

Introduction

The ip link set and ifconfig commands are used in Linux environments to manage network interfaces. These tools allow users to configure interface parameters, including the MAC (Media Access Control) address. On Windows systems, similar functionality can be accessed through network adapter settings or PowerShell. Changing a MAC address is commonly performed for testing, research, or evasion purposes.

What is a MAC Address?

A MAC (Media Access Control) address is a unique hardware identifier assigned to a network interface card (NIC). It operates at Layer 2 of the OSI model and facilitates local network communication. MAC addresses consist of 6-byte hexadecimal values (e.g., 00:1A:2B:3C:4D:5E) and are typically assigned by the hardware manufacturer.

Why Change the MAC Address?

Altering a MAC address can serve multiple purposes:

  • Gaining access to MAC-filtered networks
  • Bypassing device tracking and fingerprinting
  • Resetting network authentication sessions
  • Simulating other devices for testing or analysis
  • Creating anonymity in public network environments

Changing MAC Using Linux

Linux systems offer full control over network interfaces through terminal commands. The two most common tools are ip and ifconfig.

Using ip

ip link set dev eth0 down
ip link set dev eth0 address 00:11:22:33:44:55
ip link set dev eth0 up

Using ifconfig

ifconfig eth0 down
ifconfig eth0 hw ether 00:11:22:33:44:55
ifconfig eth0 up

These commands temporarily assign a new MAC address until the interface or system is restarted. Permanent changes can be made through network configuration files.

Changing MAC Using Windows

On Windows, MAC addresses can be modified via:

Device Manager → Network Adapter → Properties → Advanced → "Network Address" PowerShell:

Set-NetAdapterAdvancedProperty -Name "Ethernet" -DisplayName "Network Address" -DisplayValue "001122334455"

A system reboot or adapter reset may be required for changes to take effect.

Preventing MAC Spoofing

Network administrators can take the following steps to reduce the effectiveness of MAC spoofing:

  • Implement 802.1X authentication
  • Use dynamic ARP inspection (DAI)
  • Monitor for duplicate MAC addresses or anomalies
  • Bind MAC addresses to switch ports (port security)
  • Log MAC address activity and trigger alerts on changes

Other Facts

  • Virtual machines often allow MAC customization by default
  • MAC addresses can reveal hardware vendors through the OUI (Organizationally Unique Identifier)
  • MAC changes are local and do not affect router-level or internet-wide identifiers
  • Some modern wireless networks track devices based on randomized MACs
  • Several Linux distributions include built-in support for MAC randomization at boot