This commit is contained in:
root 2026-02-16 15:01:26 +05:00
parent 1fd8106662
commit fba9494f74
3 changed files with 175 additions and 0 deletions

22
dhcp Executable file
View file

@ -0,0 +1,22 @@
#!/bin/nash
cat > /etc/dhcp/dhcpd.conf << EOF
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.4.0 netmask 255.255.255.248 {
range 192.168.4.2 192.168.4.6;
option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.248;
option routers 192.168.4.1;
}
EOF
chmod 600 /etc/dhcp/dhcpd.conf
cat > /etc/sysconfig/dhcpd << EOF
DHCPDARGS="enp0s9"
EOF
systemctl enable dhcp
systemctl start dhcp

139
int Executable file
View file

@ -0,0 +1,139 @@
#!bin/bash
a=1
while a==1
do
echo ""
echo "Enter number"
echo ""
echo "1. Hostname"
echo "2. Calculate the mask"
echo "3. IP"
echo "4. Forward and masquerade"
echo "5. Reboot"
echo "6. Account"
echo "0. Exit"
echo ""
read num
echo ""
if (( $num == 0 )); then
break
elif (( $num == 1 )); then
echo "______________________Hostname_____________________"
read -p "Enter name(isp.au-team.irpo): " name
hostnamectl set-hostname $name
exec bash
elif (( $num == 3)); then
echo "_____________________Enp0s3_______________________"
read -p "Enter ip or skip for DHCP: " ip_s3
if [[ -n $ip_s3 ]]; then
read -p "Enter gateway: " gt_s3
cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF
[connection]
id=enp0s3
uuid=$(uuidgen)
type=ethernet
autoconnect-priority=-999
interface-name=enp0s3
timestamp=$(date +%s)
[ethernet]
[ipv4]
address1=$ip_s3
dns=8.8.8.8
gateway=$gt_s3
method=manual
[ipv6]
addr-gen-mode=eui64
method=disabled
[proxy]
EOF
chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection
systemctl restart NetworkManager
fi
echo ""
echo "________________________Enp0s8_________________________"
read -p "Enter ip or skip: " ip_s8
if [[ -n $ip_s8 ]]; then
nmcli connection modify enp0s8 ipv4.method manual ipv4.addresses $ip_s8 ipv6.method disabled
systemctl restart NetworkManager
fi
echo ""
echo "____________________________Enp0s9____________________________"
read -p "Enter ip or skip: " ip_s9
if [[ -n $ip_s9 ]]; then
nmcli connection modify enp0s9 ipv4.method manual ipv4.addresses $ip_s9 ipv6.method disabled
systemctl restart NetworkManager
fi
echo ""
echo "___________________________Enp0s10___________________________"
read -p "Enter ip or skip: " ip_s10
if [[ -n $ip_s10 ]]; then
nmcli connection modify enp0s10 ipv4.method manual ipv4.addresses $ip_s10 ipv6.method disabled
systemctl restart NetworkManager
fi
systemctl restart NetworkManager
elif (( $num == 4 )); then
echo ""
echo "_____________________________Forward and Masquerade__________________________"
sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf
systemctl enable --now iptables
iptables -F
read -p "Enter ip for Masquerade: " a
if (( $a == 2 )); then
if [[ -n $ip_s8 || $ip_s9 ]]; then
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $ip_s9 -o enp0s3 -j MASQUERADE
else
read -p "Enter ip for enp0s8(192.168.0.0/30): " ip_s8
read -p "Enter ip for enp0s9(192.168.0.0/30): " ip_s9
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $ip_s9 -o enp0s3 -j MASQUERADE
fi
elif (( $a == 1)); then
if [[ -n $ip_s8 ]]; then
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
else
read -p "Enter ip for enp0s8: " ip_s8
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
fi
fi
iptables-save --file /etc/sysconfig/iptables
elif (( $num == 5)); then
read -p "Reboot?: " r
if (( $r == n || $r == N)); then
echo "123"
else
reboot
fi
elif (( $num == 2)); then
echo ""
echo "____________________________Calc____________________________"
read -p "Enter amount PC: " mask
mask=$(echo "sqrt($mask)" | bc)
mask=$((32 - $mask))
echo $mask
echo""
elif (( $num == 6)); then
echo "________________________Account_________________________"
read -p "Yes or no?: " acc
if [[ -n $acc ]]; then
read -p "Enter name acc: " acc_n
cat >> /etc/sudoers << EOF
$acc_n ALL=(ALL)NOPASSWD:ALL
EOF
chmod 600 /etc/sudoers
fi
fi
done

14
tunel Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
read -p "Enter local ip(172.16.0.2): " l_ip
read -p "Enter remote ip(172.16.0.2): " r_ip
read -p "Enter tun ip(192.168.9.1/30)" t_ip
read -p "Enter name tunnel: " name
ip link delete gre1 2>/dev/null
ip tunnel add $name mode gre local $l_ip remote $r_ip ttl 64 dev enp0s3
ip addr add $t_ip dev $name
ip link set $name up
echo "Enter nmcli connection modify gre1 ip-tunnel.ttl 64"
systemctl restart NetworkManager