#!/bin/bash

echo "adding bridge IP to the PASSLIST"
sudo /sbin/iptables -t nat -I CAPTIVE_PASSLIST 1 -s 192.168.1.1 -j ACCEPT

echo "stop conflicting services (dns, dhcp)"
sudo systemctl disable dnsmasq
sudo systemctl stop NetworkManager dnsmasq
sudo killall dhclient

echo "display current routing table"
ip route show

echo "removing default gateway (qemu)"
sudo ip route del 0/0 dev eth1

echo "configuring static IP"
sudo ip addr add 192.168.1.3 dev eth0
sudo ip link set dev eth0 up
sudo ip route add 192.168.1.0/24 dev eth0

echo "adding default gateway through bridge"
sudo ip route add default via 192.168.1.1 dev eth0

echo "display current configuration"
ip addr show eth0 && ip route show
