Skip to content

Instantly share code, notes, and snippets.

@pfaffman
Created January 30, 2014 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfaffman/8716510 to your computer and use it in GitHub Desktop.
Save pfaffman/8716510 to your computer and use it in GitHub Desktop.
#!/bin/bash
# install stuff needed to be a server and wifi hotspot
# Make any stanford.edu address resolve to 10.10.10.1
# Jay Pfaffman <pfaffmman@relaxpc.com>
# This should be used on a stand-alone network where access to the
# actual server is unavailable.
if [ ! -f /etc/init.d/bind9 ]
then
sudo apt-get -y --force-yes install bind9
sudo service bind9 stop
fi
## always install new config files
cat <<EOF>/tmp/stanford.edu
;
; BIND data file for spoofing stanford.edu
; all stanford.edu hosts point to 10.10.10.1
;
\$TTL 604800
@ IN SOA stanford.edu. pfaffman.relaxpc.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.stanford.edu.
ns IN A 10.10.10.1
aaalab-server3 IN A 10.10.10.1
* IN CNAME ns
EOF
cat <<EOF > /tmp/named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "stanford.edu" IN {
type master;
file "/etc/bind/stanford.edu";
allow-update { none; };
};
EOF
sudo cp -f /tmp/stanford.edu /tmp/named.conf.local /etc/bind
sudo service bind9 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment