Files
scripts/initrouter.sh

26 lines
729 B
Bash

#!/bin/bash
case $1 in
asor)
read -p "Qual o nome do server? " SERVER
sysctl net.ipv4.ip_forward=1
dhclient enp0s3
apt update && apt upgrade -y
apt install bash-completion ca-certificates vim wget curl git -y
hostnamectl set-hostname $SERVER
if grep -q '^127.0.1.1' /etc/hosts; then
sed -i "s/^127.0.1.1.*/127.0.1.1\t$SERVER/" /etc/hosts
else
echo -e "127.0.1.1\t$SERVER" >> /etc/hosts
fi
ip address add 172.17.0.1/24 dev enp0s8
ip address add 192.168.56.10/24 dev enp0s9
nft add table ip nat
nft add chain ip nat postrouting { type nat hook postrouting priority 100 \; }
nft add rule ip nat postrouting oifname "enp0s3" masquerade
;;
*)
echo "Use: $0 asor|grc|ssorii|pisrc"
;;
esac