Local network tool that transparently redirects all X/Twitter traffic to xcancel.com, allowing you to browse Twitter content without directly accessing X's servers.
Guide for using the included dnsmasq DNS server to redirect X/Twitter domains.
For advanced configuration: See DNSMASQ_ADVANCED.md for multiple upstream DNS servers, domain-specific upstreams, DHCP server configuration, custom DNS records, performance tuning, and security considerations.
Use the included dnsmasq server if:
Important: dnsmasq requires macvlan networking to function properly as a DNS server.
Edit your .env file:
# Network settings
NETWORK_INTERFACE=eth0 # Your network interface
LAN_SUBNET=192.168.1.0/24 # Your subnet
LAN_GATEWAY=192.168.1.1 # Your router
NGINX_IP=192.168.1.100 # IP for nginx
DNSMASQ_IP=192.168.1.101 # IP for dnsmasq (must be free)
# Upstream DNS (dnsmasq will forward other queries here)
UPSTREAM_DNS=1.1.1.1 # Cloudflare DNS
Edit dnsmasq/dnsmasq.conf and update the IP addresses to match your nginx IP:
# Replace 192.168.1.100 with your actual NGINX_IP
address=/twitter.com/192.168.1.100
address=/x.com/192.168.1.100
address=/t.co/192.168.1.100
Also update upstream DNS servers if desired:
# Cloudflare (default)
server=1.1.1.1
server=1.0.0.1
# Or use Google DNS
# server=8.8.8.8
# server=8.8.4.4
# Or your ISP/router
# server=192.168.1.1
Edit docker-compose.yaml:
Uncomment the macvlan network:
networks:
macvlan_lan:
driver: macvlan
driver_opts:
parent: ${NETWORK_INTERFACE:-eth0}
ipam:
config:
- subnet: ${LAN_SUBNET:-192.168.1.0/24}
gateway: ${LAN_GATEWAY:-192.168.1.1}
ip_range: ${IP_RANGE:-192.168.1.64/28}
aux_addresses:
host: ${HOST_IP:-192.168.1.10}
Update nginx service to use macvlan:
Comment out ports and uncomment networks:
nginx:
# Comment out these lines:
# ports:
# - "${HTTP_PORT:-80}:80"
# - "${HTTPS_PORT:-443}:443"
# Uncomment these lines:
networks:
macvlan_lan:
ipv4_address: ${NGINX_IP:-192.168.1.100}
Uncomment the dnsmasq service:
dnsmasq:
image: jpillora/dnsmasq:latest
container_name: xcancel-dnsmasq
restart: unless-stopped
networks:
macvlan_lan:
ipv4_address: ${DNSMASQ_IP:-192.168.1.101}
volumes:
- ./dnsmasq/dnsmasq.conf:/etc/dnsmasq.conf:ro
environment:
- TZ=${TZ:-America/New_York}
cap_add:
- NET_ADMIN
# Start both nginx and dnsmasq
docker compose up -d
# Check status
docker compose ps
# Check logs
docker compose logs -f dnsmasq
Now you need to point devices to use your dnsmasq server as their DNS.
macOS:
192.168.1.101)Windows:
192.168.1.101Linux:
# Edit /etc/resolv.conf
sudo vim /etc/resolv.conf
# Add at the top
nameserver 192.168.1.101
Or use NetworkManager/systemd-resolved configuration.
iOS/Android:
192.168.1.101If you want all devices on your network to use dnsmasq:
192.168.1.101)1.1.1.1 (fallback)New DHCP leases will automatically use dnsmasq. Existing devices may need to:
# Should return your nginx IP
nslookup twitter.com 192.168.1.101
nslookup x.com 192.168.1.101
# Expected output:
# Server: 192.168.1.101
# Address: 192.168.1.101#53
#
# Name: twitter.com
# Address: 192.168.1.100
# Should return real IP via upstream DNS
nslookup google.com 192.168.1.101
docker compose logs dnsmasq
# Should show queries like:
# dnsmasq[1]: query[A] twitter.com from 192.168.1.50
# dnsmasq[1]: config twitter.com is 192.168.1.100
To see all DNS queries for debugging:
Edit dnsmasq/dnsmasq.conf and uncomment:
log-queries
Restart:
docker compose restart dnsmasq
docker compose logs -f dnsmasq
You’ll see every DNS query. Disable after debugging to reduce log volume.
Check IP isn’t already in use:
ping 192.168.1.101
# Should get "no route to host" or timeout
Check macvlan configuration:
# Verify network interface exists
ip link show
# Check docker network
docker network ls
docker network inspect xcancel-forwarder_macvlan_lan
Check logs:
docker compose logs dnsmasq
Common errors:
From Docker host, you cannot reach macvlan IPs directly. This is a Docker limitation. Test from another device on your network.
Firewall blocking port 53:
# On the Docker host
sudo iptables -L -n | grep 53
If using firewalld/ufw, allow DNS:
# UFW
sudo ufw allow 53/udp
sudo ufw allow 53/tcp
# Firewalld
sudo firewall-cmd --add-service=dns --permanent
sudo firewall-cmd --reload
Check dnsmasq is listening:
docker compose exec dnsmasq netstat -ulnp
# Should show process listening on 0.0.0.0:53
Test with dig:
# From another device
dig @192.168.1.101 twitter.com
# Should return answer with your nginx IP
If redirected domains work but other domains don’t resolve:
docker compose exec dnsmasq ping -c 3 1.1.1.1
dnsmasq.conf:server=8.8.8.8
To stop using dnsmasq:
Reconfigure clients to use original DNS (router, ISP, or 1.1.1.1)
Stop the container:
docker compose stop dnsmasq
# Or comment out dnsmasq service in docker-compose.yaml
docker compose up -d
Use dnsmasq if:
Use Pi-hole if:
You can also use both - Pi-hole can use dnsmasq as an upstream DNS server.
For advanced dnsmasq features, see: