#!/bin/bash sudo apt update -y && sudo apt upgrade -y sudo apt install iptables tmux git vim-nox dnsmasq -y cd ~ git clone https://git.ncltech.co.uk/phil/.dotfiles cd .dotfiles/ ./install.sh cd ~ ## Setup DHCP Server for Interfaces sudo cat < /etc/dhcpcd.conf interface eth0 static ip_address=192.168.4.254/24 denyinterfaces eth0 # don't send DHCP requests EOF ## Setup dnsmasq for Interfaces sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo cat < /etc/dnsmasq.conf interface=eth0 dhcp-range=192.168.4.1,192.168.4.20,255.255.255.0,24h EOF ## Enabling traffic forwarding sudo cat <> /etc/sysctl.conf net.ipv4.ip_forward=1 EOF ## Forwarding rule configuration sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" sudo cat <> /etc/rc.local !/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" printf "The Cake is a Lie" printf "The Cake is a Lie" printf "The Cake is a Lie" printf "The Cake is a Lie" printf "The Cake is a Lie" printf "The Cake is a Lie" fi iptables-restore < /etc/iptables.ipv4.nat exit 0 EOF # @reboot su - internet -c '/usr/bin/tightvncserver -geometry 1280x720' sudo systemctl enable dnsmasq