Skip to content

Instantly share code, notes, and snippets.

@azrdev
Created January 6, 2016 19:01
Show Gist options
  • Save azrdev/e7a8a75b25fb7f96ae4c to your computer and use it in GitHub Desktop.
Save azrdev/e7a8a75b25fb7f96ae4c to your computer and use it in GitHub Desktop.
# /etc/dnsmasq.d/gateway
address=/larsa/10.0.0.1
dhcp-range=eth0,10.0.0.100,10.0.0.200,1h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/srv/tftp
#!/bin/bash
test "$2" == "" && exit 1
if_inet=$1
if_local=$2
systemctl stop dhcpcd@$if_local
ip -stats addr flush dev $if_local
ip -stats addr add 10.0.0.1/24 dev $if_local
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o $if_inet -j MASQUERADE
dnsmasq -C /etc/dnsmasq.d/gateway -i $if_local -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment