Simple setup to create a Linux gateway on Ubuntu 18.04 that provides WPAD settings via DHCP option 252.
systemctl disable systemd-resolved.service
systemctl stop systemd-resolved
apt update
apt install dnsmasq
unlink /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
systemctl restart dnsmasq
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --table nat --append POSTROUTING --out-interface enp0s3 -j MASQUERADE
iptables --append FORWARD --in-interface enp0s8 -j ACCEPT
/etc/dnsmasq.conf
interface=enp0s8
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world
# requests to them, but the paranoid might like to close them and let the
# kernel handle them:
bind-interfaces
# Optionally set a domain name
domain=testnet.local
# Set default gateway
dhcp-option=3,10.0.0.1
# Set DNS servers to announce
dhcp-option=6,8.8.8.8
dhcp-option=252,http://example.com/proxy.pac
# Dynamic range of IPs to make available to LAN PC and the lease time.
# Ideally set the lease time to 5m only at first to test everything works okay before you set long-lasting records.
dhcp-range=10.0.0.50,10.0.0.100,12h
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
enp0s8:
dhcp4: no
addresses: [10.0.0.1/24]
nameservers:
addresses: [8.8.8.8]
proxy.pac
function FindProxyForURL(url, host) {
return "PROXY example.com:8080";
}