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
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 address 192.168.2.1 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255
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=192.168.2.1 # listen on # Bind to the interface to make sure we aren't sending things # elsewhere bind-interfaces server=188.8.131.52 # Forward DNS requests to Google DNS domain-needed # Don't forward short names # Never forward addresses in the non-routed address spaces. bogus-priv # Assign IP addresses between 192.168.2.2 and 192.168.2.100 with a # 12 hour lease time dhcp-range=192.168.2.2,192.168.2.100,12h addn-hosts=/etc/spoof.hosts # DNS Spoofing
/etc/spoof.hosts file to add fake DNS records
sudo nano /etc/spoof.hosts
Edit the file like this
Then we will edit the
/etc/sysctl.conf file to enable packet forwarding
sudo nano /etc/sysctl.conf
# from the beginning of the line containing
net.ipv4.ip_forward=1, This will enable packet forwarding on next reboot.
Configure a NAT between
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
sudo iptables-save > /etc/iptables/rules.v4