Skip to content

Network

Helpful Network Commands

Add a Virtual Interface

  • : Can be anything you like like ap0 if you wanted to create a Virtual Access Point.
  • : One of the following
    • __ap: Access Point mode.
    • ibss: Independent Basic Service Set or Ad-Hoc (Group of devices talk to eachother).
    • monitor: Passive monitoring mode where packets are handed to OS unfiltered
    • mp: Mesh Point or a device in a mesh network.
    • station
      1
      2
      3
      # iw dev wlan0 interface add <name> type <type>
      iw dev wlan0 interface ap0 type __ap
      # You may also need to assign ap0 its own MAC Address, see "Change Device MAC Address"
      

Change Device MAC Address

1
2
# ip link set dev <dev-name> address <new-mac-address>
ip link set dev ap0 address 00:12:34:56:78:9c

Extra Steps for AP Mode

  • Either set up and configure hostapd as AP daemon or use nmcli to set up an AP with NetworkManager and pick ap0 as the interface.
  • For both configurations dnsmasq is used to assign the connecting clients on the ap0 interface IP addresses via DHCP.
    • With hostapd you likely will need to configure /etc/dnsmasq/dnsmasq.conf. NetworkManger does this part for you.
  • Use iptables to set up ip masquerading
  • Enable IPv4 forwarding in kernel via /etc/sysctl