/ IoT

Get local DJMax Technika 3 back online!

As DJMax Technika 3 enthusiasts, we've put a lot of effort in making our local DMT3 machine online, due to some limitations of our local arcade (we're a small group and didn't attract enough attention), we were not able to get Ethernet connection from the arcade. To solve this, I made a solution that doesn't require Ethernet from the arcade and any modification of the host file in DMT3 machine.

How it works?

The mechanism behind this is DNS spoofing. I made a small IoT device that acts as a wifi-to-ethernet-router and has fake DNS records on it. The router connects to the WiFi Hotspot shared by my phone then shares the network via Ethernet connection. Since every DMT3 machine uses Dynamic Host Configuration Protocol (DHCP) to obtain LAN IP address as well as DNS servers, our IoT device will return itself as the DNS server to do the magic.
Things happen when the DMT3 machine is connecting to the DJMax server, the machine will try to resolve conduct3.djmaxcrew.com domain first, at this moment, our *router* leads the machine to another place by intercepting and returning a pre-configured IP address.


For hardware I chose Orange PI Zero which is the cheapest (about $15) and the smallest (48mm × 46mm) IoT hardware that has both Ethernet port and WiFi chipset I can buy in my country. It loaded with ALLwinner H2+ SoC (Quad-core Cortex-A7) and 256MB RAM, so it's good enough for our requirements. If Orange PI Zero is not available in your country, a Raspberry Model 3B will also be good. After that, I flashed Raspbian to it.


First, install software that we're going to use.
We will use dnsmasq package for this purpose because it is combined DHCP and DNS server and also easy to configure.

sudo apt install dnsmasq iptables-persistent

Configure the eth0 interface to serve a small LAN network.

sudo nano /etc/network/interfaces.d/eth0

Paste the following snippet and save the file

allow-hotplug eth0  
iface eth0 inet static  

Next, we will configure dnsmasq. The default config file contains a lot of information on how to use it. So, I will advise to move it and create a new one.

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.origin
sudo nano /etc/dnsmasq.conf

Paste the following into the new file

interface=eth0      # Use interface eth0  
listen-address= # listen on  
# Bind to the interface to make sure we aren't sending things 
# elsewhere  
server=       # Forward DNS requests to Google DNS  
domain-needed        # Don't forward short names  
# Never forward addresses in the non-routed address spaces.
# Assign IP addresses between and with a
# 12 hour lease time
addn-hosts=/etc/spoof.hosts   # DNS Spoofing

Edit /etc/spoof.hosts file to add fake DNS records

sudo nano /etc/spoof.hosts

Edit the file like this

<your-server-ip> conduct3.djmaxcrew.com

Then we will edit the /etc/sysctl.conf file to enable packet forwarding

sudo nano /etc/sysctl.conf

Remove the # from the beginning of the line containing net.ipv4.ip_forward=1, This will enable packet forwarding on next reboot.
Configure a NAT between eth0 and wlan0 (Note: replace wlan0 if your WiFi interface is different)

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE  
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT

Persist the iptables rules

sudo iptables-save > /etc/iptables/rules.v4