Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Last updated: Monday 16 February 2026 @ 13:50:43

AD-Hoc

An ad‑hoc network is a network formed spontaneously between devices without requiring a central router, switch, or access point. Each node in an ad‑hoc topology participates in forwarding traffic, effectively acting as both a host and a router.

2. Wired Ad‑Hoc (Point‑to‑Point or Link‑Local)

For wired networks, “ad‑hoc” usually refers to direct links between hosts, such as:

  • Back‑to‑back Ethernet connections (using auto‑MDI/MDIX NICs)
  • Temporary lab networks without DHCP
  • Link‑local IPv4 addressing (169.254.x.x)

These connections bypass centralized network control and allow hosts to communicate directly.

3. Adhoc Ethernet setup

  1. Navigate to the terminal ctrl + t and open /etc/network/interfaces with your prefered text editor

    Terminal

    sudo vim /etc/networks/interfaces 
    

    Note

    The file /etc/network/interfaces is a traditional Debian‑style network configuration file. It exists to provide a persistent, declarative configuration for network interfaces without depending on graphical tools or dynamic managers.

    It allows administrators to define:

    • Interface names (eth0, wlan0, br0, etc.)

    • IP addressing (static, DHCP, manual)

    • Wireless settings (SSID, mode, channel)

    • Special modes like ad‑hoc, monitor, or bridge

    • Auto‑start behaviour at boot

    Before the rise of NetworkManager and systemd‑networkd, this was the primary method for configuring networking on Debian-based systems—and it remains widely used in lab and headless server environments because of its simplicity and reliability.

  2. Now we are going to add the configuration for wired connection

    Code

    auto lo
    iface lo inet loopback 
    
    auto eth0
    allow-hotplug eth0
    iface eth0 inet static
        address 192.168.1.10
        network 255.255.255.0
    
  3. We now need to tell the NetworkManager that it should manage ifupdown (interfaces). Open the /etc/NetworkManager/NetworkManager.conf and change the line ifupdown managed from false to true

    Terminal

    sudo vim /etc/NetworkManager/NetworkManager.conf
    

    Code

    [main]
    plugins=ifupdown,keyfile
    
    [ifupdown]
    managed=true
    
    [device]
    wifi.scan-rand-mac-address=no
    
  4. You may need to reboot the system if you don't get notifications that eth0 has been set.

  5. Once rebooted you should should have seen a popup notifcation, confirm with ifconfig, you should something like this:

    Output

    eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
        ether d8:3a:dd:cf:4e:b2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    ...
    
  6. You should be able to reach one anyone the same network as you, use ping and target a particular iface, incase you have wlan0 connected.

    Terminal

    ping -c 4 -I eth0 192.168.1.#
    

    Where # is the IP [0-255] you want to ping assuming there is a host there.

4. Alias/virutal interface

It's common practice to assign two or more IP addresses to a single network interface. There are all sorts of uses for that, like running two web servers on the same machine.

  1. You need to modify the `/etc/network/interfaces/ file:

    Code

    auto eth0:0
    allow-hotplug eth0:0
    iface eth0:0 inet static
        address 192.168.55.55
        network 255.255.255.0
    
  2. Like step 5 above you may need to reboot the if ip link set eth0:0 up does not create a new entry for ifconfig

  3. You should be able to ping again by specifying the correct interface.

    Terminal

    ping -c 4 -I eth0:0 192.168.55.#
    

    Where # is the IP [0-255] you want to ping assuming there is a host there.

    Error

    What you can't do yet is ping 192.168.1.# as it is not the same network.

4. Wireless Ad‑Hoc (802.11 IBSS)

In wireless networks, “ad‑hoc mode” (also known as IBSS—Independent Basic Service Set) allows Wi‑Fi interfaces to communicate directly with one another. This is useful when:

  • No wireless access point is available

  • A quick, temporary mesh is needed for experiments

  • Devices need peer‑to‑peer connectivity with minimal infrastructure

Wireless ad‑hoc networks are common in research labs, disaster‑recovery communication setups, and sensor networks

SUCCESS! We will look at Access Points next!