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
-
Navigate to the terminal ctrl + t and open
/etc/network/interfaceswith your prefered text editorThe file
/etc/network/interfacesis 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
NetworkManagerandsystemd‑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. -
-
Now we are going to add the configuration for wired connection
-
We now need to tell the
NetworkManagerthat it should manageifupdown(interfaces). Open the/etc/NetworkManager/NetworkManager.confand change the lineifupdownmanagedfromfalsetotrue -
You may need to
rebootthe system if you don't get notifications thateth0has been set. -
Once rebooted you should should have seen a popup notifcation, confirm with
ifconfig, you should something like this: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 ... -
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.
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.
-
You need to modify the `/etc/network/interfaces/ file:
-
Like step 5 above you may need to reboot the if
ip link set eth0:0 updoes not create a new entry forifconfig -
You should be able to ping again by specifying the correct interface.
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.
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!