This commit is contained in:
root 2026-03-18 08:40:27 +05:00
parent eda42e9c71
commit 574c8122bf
6 changed files with 70 additions and 65 deletions

13
dhcp
View file

@ -5,9 +5,9 @@ default-lease-time 600;
max-lease-time 7200; max-lease-time 7200;
authoritative; authoritative;
subnet 192.168.3.0 netmask 255.255.255.248 { subnet 192.168.4.0 netmask 255.255.255.248 {
range 192.168.3.1 192.168.3.6; range 192.168.4.2 192.168.4.6;
option domain-name-servers 8.8.8.8, 8.8.4.4; option domain-name-servers 192.168.3.2, 8.8.4.4;
option subnet-mask 255.255.255.248; option subnet-mask 255.255.255.248;
option routers 172.16.4.1; option routers 172.16.4.1;
} }
@ -23,8 +23,9 @@ EOF
chmod 600 /etc/dhcp/dhcpd.conf chmod 600 /etc/dhcp/dhcpd.conf
cat > /etc/sysconfig/dhcpd << EOF cat > /etc/sysconfig/dhcpd << EOF
DHCPDARGS="enp0s8" DHCPDARGS="enp0s9"
EOF EOF
systemctl enable dhcp echo "_________________Перезагрузка и старт dncpd________________________"
systemctl start dhcp systemctl restart dhcpd
systemctl start dhcpd

90
dns
View file

@ -1,52 +1,58 @@
#!/bit/bash #!/bit/bash
#cat > /etc/named.conf << EOF cat > /etc/named.conf << EOF
#options { options {
# listen-on port 53 { 127.0.0.1; 192.168.2.2; }; listen-on port 53 { 127.0.0.1; 192.168.3.2; };
# listen-on-v6 port 53 { none; }; listen-on-v6 port 53 { none; };
# directory "/var/named"; directory "/var/named";
# dump-file "/var/named/data/cache_dump.db"; dump-file "/var/named/data/cache_dump.db";
# statistics-file "/var/named/data/named_stats.txt"; statistics-file "/var/named/data/named_stats.txt";
# memstatistics-file "/var/named/data/named_mem_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt";
# secroots-file "/var/named/data.named/data/named.secroots"; secroots-file "/var/named/data.named/data/named.secroots";
# recursing-file "/var/named/data/named.recursing"; recursing-file "/var/named/data/named.recursing";
# allow-query { any; }; allow-query { any; };
# forward first; forward first;
# forwarders { 8.8.8.8; }; forwarders { 8.8.8.8; };
#}; };
#
#zone "." IN { logging {
# type hint; channel default_debug {
# file "var/named/named.ca"; file "data/named.run";
#}; severity dynamic;
# };
#include "/etc/named.rfcq912.zones"; };
#include "/etc/named.root.key"; zone "." IN {
# type hint;
#zone "team.irpo" { file "named.ca";
#type master; };
#file "master/team.irpo";
#}; include "/etc/named.rfc1912.zones";
# include "/etc/named.root.key";
#zone "3.168.192.in-addr.arpa" {
#type master; zone "au-team.irpo" {
#file "master/3.168.192.in-addr.arpa"; type master;
#}; file "master/au-team.irpo";
# };
#zone "4.168.192.in-addr.arpa" {
#type master; zone "3.168.192.in-addr.arpa" {
#file "master/4.168.192.in-addr.arpa"; type master;
#}; file "master/3.168.192.in-addr.arpa";
# };
zone "4.168.192.in-addr.arpa" {
type master;
file "master/4.168.192.in-addr.arpa";
};
#zone "4.16.172.in-addr.arpa" { #zone "4.16.172.in-addr.arpa" {
#type master; #type master;
#file "4.16.172.in-addr.arpa"; #file "4.16.172.in-addr.arpa";
#}; #};
#EOF EOF
mkdir /var/named/master mkdir /var/named/master
cat > /var/named/master/team.irpo << EOF cat > /var/named/master/au-team.irpo << EOF
\$TTL 604800 ; \$TTL 604800 ;
au-team.irpo. IN SOA ns01.au-team.irpo. root.au-team.irpo. ( au-team.irpo. IN SOA ns01.au-team.irpo. root.au-team.irpo. (
1 ; Serial 1 ; Serial
@ -100,7 +106,7 @@ cat > /var/named/master/4.168.192.in-addr.arpa << EOF
EOF EOF
# Zone for HQ-RTR # Zone for HQ-RTR
cat > /var/named/master/4.16.172.in-addr.arpo << EOF cat > /var/named/master/4.16.172.in-addr.arpa << EOF
\$TTL 604800 ; \$TTL 604800 ;
@ IN SOA ns01.au-team.irpo. root.au-team.irpo.( @ IN SOA ns01.au-team.irpo. root.au-team.irpo.(
20060204 ; Serial 20060204 ; Serial
@ -119,5 +125,5 @@ if [[ -n $res ]]; then
chmod 0640 /var/named/master/* chmod 0640 /var/named/master/*
fi fi
echo "" echo ""
echo "_______________________Restart______________________" echo "_______________________Перезагрузка named______________________"
systemctl restart named systemctl restart named

21
int
View file

@ -11,7 +11,7 @@ while a==1
echo "3. IP-адрес" echo "3. IP-адрес"
echo "4. Forward и masquerade" echo "4. Forward и masquerade"
echo "5. Перезагрузить машину" echo "5. Перезагрузить машину"
echo "6. Аккаунты" echo "6. Time zone"
echo "0. Выход" echo "0. Выход"
echo "" echo ""
read num read num
@ -30,7 +30,7 @@ while a==1
echo "_____________________Enp0s3_______________________" echo "_____________________Enp0s3_______________________"
read -p "Введите ip-адрес или пропустите для DHCP: " ip_s3 read -p "Введите ip-адрес или пропустите для DHCP: " ip_s3
if [[ -n $ip_s3 ]]; then if [[ -n $ip_s3 ]]; then
read -p "Введите шлюз: " gt_s3 read -p "Введите шлюз или пропустите: " gt_s3
cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF
[connection] [connection]
id=enp0s3 id=enp0s3
@ -73,7 +73,7 @@ EOF
fi fi
echo "" echo ""
echo "___________________________Enp0s10___________________________" echo "___________________________Enp0s10___________________________"
read -p "Enter ip or skip: " ip_s10 read -p "Введите ip-адрес или пропустите: " ip_s10
if [[ -n $ip_s10 ]]; then if [[ -n $ip_s10 ]]; then
nmcli connection modify enp0s10 ipv4.method manual ipv4.addresses $ip_s10 ipv6.method disabled nmcli connection modify enp0s10 ipv4.method manual ipv4.addresses $ip_s10 ipv6.method disabled
systemctl restart NetworkManager systemctl restart NetworkManager
@ -86,11 +86,12 @@ EOF
sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf
systemctl enable --now iptables systemctl enable --now iptables
iptables -F iptables -F
read -p "Введите количество ip-адресов для Masquerade: " a read -p "Введите количество ip-адресов для которых необходимо задать Masquerade: " a
if (( $a == 2 )); then if (( $a == 2 )); then
if [[ -n $ip_s8 || $ip_s9 ]]; 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_s8 -o enp0s3 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $ip_s9 -o enp0s3 -j MASQUERADE iptables -t nat -A POSTROUTING -s $ip_s9 -o enp0s3 -j MASQUERADE
echo "Готово"
else else
read -p "Введите ip-адрес для enp0s8(192.168.0.0/30): " ip_s8 read -p "Введите ip-адрес для enp0s8(192.168.0.0/30): " ip_s8
read -p "Введите ip-адрес для enp0s9(192.168.0.0/30): " ip_s9 read -p "Введите ip-адрес для enp0s9(192.168.0.0/30): " ip_s9
@ -100,6 +101,7 @@ EOF
elif (( $a == 1)); then elif (( $a == 1)); then
if [[ -n $ip_s8 ]]; then if [[ -n $ip_s8 ]]; then
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
echo "Готово"
else else
read -p "Введите ip для enp0s8: " ip_s8 read -p "Введите ip для enp0s8: " ip_s8
iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE iptables -t nat -A POSTROUTING -s $ip_s8 -o enp0s3 -j MASQUERADE
@ -126,14 +128,9 @@ EOF
echo"" echo""
elif (( $num == 6)); then elif (( $num == 6)); then
echo "________________________Аккаунт_________________________" echo "For watch time zone inter: timedatectl list-timezones"
read -p "Yes or no?: " acc echo "Inter timedatectl set-timezone 'timezone' "
if [[ -n $acc ]]; then
read -p "Введите имя аккаунта: " acc_n
cat >> /etc/sudoers << EOF
$acc_n ALL=(ALL)NOPASSWD:ALL
EOF
chmod 600 /etc/sudoers chmod 600 /etc/sudoers
fi fi
fi
done done

View file

@ -1,8 +1,8 @@
#!bin/bash #!bin/bash
read -p "Введите id роутера(1.1.1.1): " r_id read -p "Введите id роутера(1.1.1.1): " r_id
read -p "Введите подсеть для enp0s3 (172.16.4.0/28): " ip_s3 read -p "Введите подсеть для enp0s3 (172.16.5.0/28): " ip_s3
read -p "Введите подсеть для enp0s8(192.168.3.0/26): " ip_s8 read -p "Введите подсеть для enp0s8(192.168.2.0/26): " ip_s8
read -p "Введите подсеть для туннеля(192.168.9.0/30): " ip_tun read -p "Введите подсеть для туннеля(192.168.9.0/30): " ip_tun
read -p "Введите имя(BR-RTR): " name read -p "Введите имя(BR-RTR): " name
cat > /etc/frr/daemons << EOF cat > /etc/frr/daemons << EOF

View file

@ -1,4 +1,5 @@
#!/bin/bash #!bin/bash
read -p "Введите имя(HQ-RTR): " name read -p "Введите имя(HQ-RTR): " name
read -p "Введите id роутера(2.2.2.2): " r_id read -p "Введите id роутера(2.2.2.2): " r_id
read -p "Введите подсеть для enp0s3(172.16.4.0/28): " ip_s3 read -p "Введите подсеть для enp0s3(172.16.4.0/28): " ip_s3

4
tunel
View file

@ -2,7 +2,7 @@
read -p "Введите локальный ip-адрес для тунеля(172.16.0.2): " l_ip read -p "Введите локальный ip-адрес для тунеля(172.16.0.2): " l_ip
read -p "Введите удаленный ip-адрес для туннеля(172.16.0.2): " r_ip read -p "Введите удаленный ip-адрес для туннеля(172.16.0.2): " r_ip
read -p "Введите ip-адрес туннеля(192.168.9.1/30)" t_ip read -p "Введите ip-адрес туннеля(192.168.9.1/30)" t_ip
read -p "Введите имя туннеля: " name read -p "Введите имя туннеля(gre1): " name
ip link delete gre1 2>/dev/null ip link delete gre1 2>/dev/null
@ -10,5 +10,5 @@ ip tunnel add $name mode gre local $l_ip remote $r_ip ttl 64 dev enp0s3
ip addr add $t_ip dev $name ip addr add $t_ip dev $name
ip link set $name up ip link set $name up
echo "Введите nmcli connection modify gre1 ip-tunnel.ttl 64" echo "Введите nmcli connection modify "$name" ip-tunnel.ttl 64"
systemctl restart NetworkManager systemctl restart NetworkManager