formatting

This commit is contained in:
Cyberes 2023-06-13 16:20:22 -06:00
parent 8892be1736
commit 8b148fad11
Signed by: cyberes
GPG Key ID: 6B4A33836A9500FE
3 changed files with 8 additions and 8 deletions

View File

@ -156,7 +156,7 @@ Name=$WLAN_IFACE
IPForward=yes IPForward=yes
DHCP=yes DHCP=yes
EOF EOF
echo "Created network config: $WLAN_IFACE" echo "Created network config for the $WLAN_IFACE WiFi interface."
echo -e "Finishing systemd-networkd install...\n" echo -e "Finishing systemd-networkd install...\n"
apt-get install $NON_INTERACTIVE_APT libnss-resolve apt-get install $NON_INTERACTIVE_APT libnss-resolve
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

View File

@ -80,20 +80,20 @@ iptables -X
iptables -F iptables -F
iptables -t nat -X iptables -t nat -X
iptables -t nat -F iptables -t nat -F
echo "Reset iptables" echo "Reset iptables."
# Route/forward traffic between nets # Route/forward traffic between nets
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -I POSTROUTING -o $WLAN_IFACE -j MASQUERADE iptables -t nat -I POSTROUTING -o $WLAN_IFACE -j MASQUERADE
echo "Created iptables to route traffic between nets" echo "Created iptables to route traffic between nets."
# Exclude the SSH port from forwarding so we can still administer the router # Exclude the SSH port from forwarding so we can still administer the router
iptables -t nat -A PREROUTING -i $WLAN_IFACE -p tcp --dport $ROUTER_SSH_PORT -j RETURN iptables -t nat -A PREROUTING -i $WLAN_IFACE -p tcp --dport $ROUTER_SSH_PORT -j RETURN
# Forward all other ports to the single wired device # Forward all other ports to the single wired device
iptables -t nat -A PREROUTING -i $WLAN_IFACE -j DNAT --to-destination $BRIDGED_CLIENT_IP iptables -t nat -A PREROUTING -i $WLAN_IFACE -j DNAT --to-destination $BRIDGED_CLIENT_IP
iptables -t nat -A POSTROUTING -o $ETH_IFACE -j MASQUERADE iptables -t nat -A POSTROUTING -o $ETH_IFACE -j MASQUERADE
echo "Redirected the router's ports to the single bridged client" echo "Redirected the router's ports to the single bridged client."
echo -en "\nRestarting dnsmasq..." echo -en "\nRestarting dnsmasq..."
systemctl stop systemd-resolved systemctl stop systemd-resolved

View File

@ -30,13 +30,13 @@ iptables -X
iptables -F iptables -F
iptables -t nat -X iptables -t nat -X
iptables -t nat -F iptables -t nat -F
echo "Cleared iptables" echo "Cleared iptables."
# Restore MAC address to WLAN interface # Restore MAC address to WLAN interface
ifconfig $WLAN_IFACE down ifconfig $WLAN_IFACE down
ifconfig $WLAN_IFACE hw ether "$(ethtool -P $WLAN_IFACE | awk '{print $3}')" ifconfig $WLAN_IFACE hw ether "$(ethtool -P $WLAN_IFACE | awk '{print $3}')"
ifconfig $WLAN_IFACE up ifconfig $WLAN_IFACE up
echo "Reset $WLAN_IFACE" echo "Reset the $WLAN_IFACE WiFi interface."
while true; do while true; do
WLAN_IFACE_IP=$(ip -4 -br addr show $WLAN_IFACE | grep -Po "\\d+\\.\\d+\\.\\d+\\.\\d+") WLAN_IFACE_IP=$(ip -4 -br addr show $WLAN_IFACE | grep -Po "\\d+\\.\\d+\\.\\d+\\.\\d+")
@ -50,7 +50,7 @@ done
systemctl start systemd-resolved systemctl start systemd-resolved
systemctl stop dnsmasq systemctl stop dnsmasq
echo "Reset DNS services" echo "Reset DNS services."
echo -e "\nConnecting to WiFi..." echo -e "\nConnecting to WiFi..."
@ -89,7 +89,7 @@ Name=$WLAN_IFACE
IPForward=yes IPForward=yes
DHCP=yes DHCP=yes
EOF EOF
echo "Created network config: $WLAN_IFACE" echo "Created network config for the $WLAN_IFACE WiFi interface."
echo "Restarting systemd-networkd..." echo "Restarting systemd-networkd..."
systemctl restart systemd-networkd.service systemctl restart systemd-networkd.service