new
This commit is contained in:
parent
24162ff7f4
commit
8d320c6f45
18
adm
Executable file
18
adm
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Задание 3, Модуль 1 (HQ-RTR / BR-RTR)
|
||||||
|
|
||||||
|
[ $EUID -ne 0 ] && echo "Требуется root" && exit 1
|
||||||
|
|
||||||
|
# Пользователь net_admin (маршрутизаторы)
|
||||||
|
USER="net_admin"
|
||||||
|
PASS="admin"
|
||||||
|
|
||||||
|
# Создание пользователя
|
||||||
|
useradd -m -s /bin/bash "$USER" 2>/dev/null
|
||||||
|
echo "$USER:$PASS" | chpasswd
|
||||||
|
|
||||||
|
# Sudo без пароля
|
||||||
|
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||||
|
chmod 440 /etc/sudoers
|
||||||
|
|
||||||
|
echo "Готово"
|
||||||
30
dhcp
Executable file
30
dhcp
Executable file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/nash
|
||||||
|
|
||||||
|
cat > /etc/dhcp/dhcpd.conf << EOF
|
||||||
|
default-lease-time 600;
|
||||||
|
max-lease-time 7200;
|
||||||
|
authoritative;
|
||||||
|
|
||||||
|
subnet 192.168.3.0 netmask 255.255.255.248 {
|
||||||
|
range 192.168.3.1 192.168.3.6;
|
||||||
|
option domain-name-servers 8.8.8.8, 8.8.4.4;
|
||||||
|
option subnet-mask 255.255.255.248;
|
||||||
|
option routers 172.16.4.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
host hq-cli {
|
||||||
|
hardware ethernet
|
||||||
|
08:00:27:c7:82:fa;
|
||||||
|
fixed-address
|
||||||
|
192.168.4.2;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
chmod 600 /etc/dhcp/dhcpd.conf
|
||||||
|
|
||||||
|
cat > /etc/sysconfig/dhcpd << EOF
|
||||||
|
DHCPDARGS="enp0s8"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl enable dhcp
|
||||||
|
systemctl start dhcp
|
||||||
123
dns
Executable file
123
dns
Executable file
|
|
@ -0,0 +1,123 @@
|
||||||
|
#!/bit/bash
|
||||||
|
#cat > /etc/named.conf << EOF
|
||||||
|
#options {
|
||||||
|
# listen-on port 53 { 127.0.0.1; 192.168.2.2; };
|
||||||
|
# listen-on-v6 port 53 { none; };
|
||||||
|
# directory "/var/named";
|
||||||
|
# dump-file "/var/named/data/cache_dump.db";
|
||||||
|
# statistics-file "/var/named/data/named_stats.txt";
|
||||||
|
# memstatistics-file "/var/named/data/named_mem_stats.txt";
|
||||||
|
# secroots-file "/var/named/data.named/data/named.secroots";
|
||||||
|
# recursing-file "/var/named/data/named.recursing";
|
||||||
|
# allow-query { any; };
|
||||||
|
# forward first;
|
||||||
|
# forwarders { 8.8.8.8; };
|
||||||
|
#};
|
||||||
|
#
|
||||||
|
#zone "." IN {
|
||||||
|
# type hint;
|
||||||
|
# file "var/named/named.ca";
|
||||||
|
#};
|
||||||
|
#
|
||||||
|
#include "/etc/named.rfcq912.zones";
|
||||||
|
#include "/etc/named.root.key";
|
||||||
|
#
|
||||||
|
#zone "team.irpo" {
|
||||||
|
#type master;
|
||||||
|
#file "master/team.irpo";
|
||||||
|
#};
|
||||||
|
#
|
||||||
|
#zone "3.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" {
|
||||||
|
#type master;
|
||||||
|
#file "4.16.172.in-addr.arpa";
|
||||||
|
#};
|
||||||
|
#EOF
|
||||||
|
|
||||||
|
|
||||||
|
mkdir /var/named/master
|
||||||
|
|
||||||
|
cat > /var/named/master/team.irpo << EOF
|
||||||
|
\$TTL 604800 ;
|
||||||
|
au-team.irpo. IN SOA ns01.au-team.irpo. root.au-team.irpo. (
|
||||||
|
1 ; Serial
|
||||||
|
600 ; Refresh
|
||||||
|
3600 ; Retry
|
||||||
|
1w ; Expire
|
||||||
|
360 ; Minimum TTL
|
||||||
|
)
|
||||||
|
IN NS br-srv.au-team.irpo.
|
||||||
|
IN NS hq-rtr.au-team.irpo.
|
||||||
|
IN NS br-rtr.au-team.irpo.
|
||||||
|
IN NS hq-srv.au-team.irpo.
|
||||||
|
IN NS hq-cli.au-team.irpo.
|
||||||
|
IN NS docker.au-team.irpo.
|
||||||
|
IN NS web.au-team.irpo.
|
||||||
|
br-srv IN A 192.168.2.2
|
||||||
|
hq-rtr IN A 172.16.4.2
|
||||||
|
br-rtr IN A 172.16.5.2
|
||||||
|
hq-srv IN A 192.168.3.2
|
||||||
|
hq-cli IN A 192.168.4.2
|
||||||
|
docker IN A 172.16.4.1
|
||||||
|
web IN A 172.16.5.1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Zone for HQ-SRV
|
||||||
|
cat > /var/named/master/3.168.192.in-addr.arpa << EOF
|
||||||
|
\$TTL 604800 ;
|
||||||
|
@ IN SOA ns01.au-team.irpo. root.au-team.irpo. (
|
||||||
|
20060204 ; Serial
|
||||||
|
3600 ; Refresh
|
||||||
|
900 ; Retry
|
||||||
|
3600000 ; Expire
|
||||||
|
3600 ; Minimum
|
||||||
|
)
|
||||||
|
@ IN NS au-team.irpo.
|
||||||
|
2 IN PTR hq-srv.au-team.irpo.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Zone for HQ-CLI
|
||||||
|
cat > /var/named/master/4.168.192.in-addr.arpa << EOF
|
||||||
|
\$TTL 604800 ;
|
||||||
|
@ IN SOA ns01.au-team.irpo. root.au-team.irpo. (
|
||||||
|
20060204 ; Serial
|
||||||
|
3600 ; Refresh
|
||||||
|
900 ; Retry
|
||||||
|
3600000 ; Expire
|
||||||
|
3600 ; Minimum
|
||||||
|
)
|
||||||
|
@ IN NS au-team.irpo.
|
||||||
|
2 IN PTR hq-cli.au-team.irpo.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Zone for HQ-RTR
|
||||||
|
cat > /var/named/master/4.16.172.in-addr.arpo << EOF
|
||||||
|
\$TTL 604800 ;
|
||||||
|
@ IN SOA ns01.au-team.irpo. root.au-team.irpo.(
|
||||||
|
20060204 ; Serial
|
||||||
|
3600 ; Refresh
|
||||||
|
900 ; Retry
|
||||||
|
3600000 ; Expire
|
||||||
|
3600 ; Minimum
|
||||||
|
)
|
||||||
|
@ IN NS au-team.irpo.
|
||||||
|
2 IN PTR hq-rtr.au-team.irpo.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
read -p "Resolution?: " res
|
||||||
|
if [[ -n $res ]]; then
|
||||||
|
chown -R root:named /var/named/master
|
||||||
|
chmod 0640 /var/named/master/*
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "_______________________Restart______________________"
|
||||||
|
systemctl restart named
|
||||||
74
hqs
Executable file
74
hqs
Executable file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "hostname"
|
||||||
|
read -p "enter name" name
|
||||||
|
if [[ -n $name ]]; then
|
||||||
|
hostnamectl set-hostname $name
|
||||||
|
exec bash
|
||||||
|
fi
|
||||||
|
echo "enter enp0s3"
|
||||||
|
read enp0s3
|
||||||
|
if [[ -n $enp0s3 ]]; then
|
||||||
|
read -p "enter gateway" gat
|
||||||
|
read -p "enter dns" dns
|
||||||
|
cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF
|
||||||
|
[connnection]
|
||||||
|
id=enp0s3
|
||||||
|
uuid=$(uuidgen)
|
||||||
|
tipe=ethernet
|
||||||
|
autoconnect-priority=-999
|
||||||
|
interface-name=enp0s3
|
||||||
|
timestamp=$(date +%s)
|
||||||
|
|
||||||
|
[ethernet]
|
||||||
|
|
||||||
|
|
||||||
|
[ipv4]
|
||||||
|
address1=$enp0s3
|
||||||
|
dns=$dns
|
||||||
|
gateway=$gat
|
||||||
|
method=manual
|
||||||
|
|
||||||
|
[ipv6]
|
||||||
|
addr-gen-mode=eui64
|
||||||
|
method=disabled
|
||||||
|
|
||||||
|
[proxy]
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection
|
||||||
|
fi
|
||||||
|
read -p "Reboot?" o
|
||||||
|
if [[ -n $o ]]; then
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "enter accaunt"
|
||||||
|
read -p "continue: " can
|
||||||
|
if [[ -n $can ]]; then
|
||||||
|
useradd -u 2026 remote_user
|
||||||
|
passwd remote_user
|
||||||
|
cat >> /etc/sudoers << EOF
|
||||||
|
remote_user ALL=(ALL)NOPASSWD:ALL
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "ftp?: " ftp
|
||||||
|
read -p "enter ip: " ip
|
||||||
|
if [[ -n $ftp ]]; then
|
||||||
|
iptables -I INPUT -p tcp --match multiport --dports 21,22,20000:25000 -j ACCEPT
|
||||||
|
iptables -t nat -A POSTROUTING -p tcp -d $ip --dport 21 -j MASQUERADE
|
||||||
|
iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 21 -j DNAT --to-destination $ip:21
|
||||||
|
service iptables save
|
||||||
|
|
||||||
|
cat >> /etc/vsftpd/vsftpd.conf << EOF
|
||||||
|
pasv_min_port=20000
|
||||||
|
pasv_max_port=25000
|
||||||
|
pasv_enable=YES
|
||||||
|
|
||||||
|
EOF
|
||||||
|
chmod 600 /etc/vsftpd/vsftpd.conf
|
||||||
|
fi
|
||||||
|
|
||||||
139
int
Executable file
139
int
Executable file
|
|
@ -0,0 +1,139 @@
|
||||||
|
#!bin/bash
|
||||||
|
|
||||||
|
a=1
|
||||||
|
while a==1
|
||||||
|
do
|
||||||
|
echo ""
|
||||||
|
echo "Выберите параметр"
|
||||||
|
echo ""
|
||||||
|
echo "1. Имя"
|
||||||
|
echo "2. Калькулятор маски"
|
||||||
|
echo "3. IP-адрес"
|
||||||
|
echo "4. Forward и masquerade"
|
||||||
|
echo "5. Перезагрузить машину"
|
||||||
|
echo "6. Аккаунты"
|
||||||
|
echo "0. Выход"
|
||||||
|
echo ""
|
||||||
|
read num
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
if (( $num == 0 )); then
|
||||||
|
break
|
||||||
|
|
||||||
|
elif (( $num == 1 )); then
|
||||||
|
echo "______________________Имя_____________________"
|
||||||
|
read -p "Введите имя(isp.au-team.irpo): " name
|
||||||
|
hostnamectl set-hostname $name
|
||||||
|
exec bash
|
||||||
|
elif (( $num == 3)); then
|
||||||
|
echo "_____________________Enp0s3_______________________"
|
||||||
|
read -p "Введите ip-адрес или пропустите для DHCP: " ip_s3
|
||||||
|
if [[ -n $ip_s3 ]]; then
|
||||||
|
read -p "Введите шлюз: " 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 "Введите ip-адрес или пропустите: " 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 "Введите ip-адрес или пропустите: " 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 и Masquerade__________________________"
|
||||||
|
sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf
|
||||||
|
systemctl enable --now iptables
|
||||||
|
iptables -F
|
||||||
|
read -p "Введите количество ip-адресов для 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 "Введите ip-адрес для enp0s8(192.168.0.0/30): " ip_s8
|
||||||
|
read -p "Введите ip-адрес для 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 "Введите ip для 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 "Перезвгрузить?: " r
|
||||||
|
if (( $r == n || $r == N)); then
|
||||||
|
echo "No"
|
||||||
|
else
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif (( $num == 2)); then
|
||||||
|
echo ""
|
||||||
|
echo "____________________________Калькулятор____________________________"
|
||||||
|
read -p "Введите количество PC: " mask
|
||||||
|
mask=$(echo "sqrt($mask)" | bc)
|
||||||
|
mask=$((32 - $mask))
|
||||||
|
echo $mask
|
||||||
|
echo""
|
||||||
|
|
||||||
|
elif (( $num == 6)); then
|
||||||
|
echo "________________________Аккаунт_________________________"
|
||||||
|
read -p "Yes or no?: " acc
|
||||||
|
if [[ -n $acc ]]; then
|
||||||
|
read -p "Введите имя аккаунта: " acc_n
|
||||||
|
cat >> /etc/sudoers << EOF
|
||||||
|
$acc_n ALL=(ALL)NOPASSWD:ALL
|
||||||
|
EOF
|
||||||
|
chmod 600 /etc/sudoers
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
14
net_3b]
Executable file
14
net_3b]
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
read -p "Введите локальный ip-адрес для тунеля(172.16.0.2): " l_ip
|
||||||
|
read -p "Введите удаленный ip-адрес для туннеля(172.16.0.2): " r_ip
|
||||||
|
read -p "Введите ip-адрес туннеля(192.168.9.1/30)" t_ip
|
||||||
|
read -p "Введите имя туннеля: " 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 "Введите nmcli connection modify gre1 ip-tunnel.ttl 64"
|
||||||
|
systemctl restart NetworkManager
|
||||||
71
ospf_brr
Executable file
71
ospf_brr
Executable file
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!bin/bash
|
||||||
|
|
||||||
|
read -p "Введите id роутера(1.1.1.1): " r_id
|
||||||
|
read -p "Введите подсеть для enp0s3 (172.16.4.0/28): " ip_s3
|
||||||
|
read -p "Введите подсеть для enp0s8(192.168.3.0/26): " ip_s8
|
||||||
|
read -p "Введите подсеть для туннеля(192.168.9.0/30): " ip_tun
|
||||||
|
read -p "Введите имя(BR-RTR): " name
|
||||||
|
cat > /etc/frr/daemons << EOF
|
||||||
|
bgpd=no
|
||||||
|
ospfd=yes
|
||||||
|
ospf6d=no
|
||||||
|
ripd=no
|
||||||
|
ripngd=no
|
||||||
|
isisd=no
|
||||||
|
pimd=no
|
||||||
|
pim6d=no
|
||||||
|
nhrpd=no
|
||||||
|
eigrpd=no
|
||||||
|
babeld=no
|
||||||
|
sharpd=no
|
||||||
|
pbrd=no
|
||||||
|
bfdd=no
|
||||||
|
fabricd=no
|
||||||
|
vrrpd=no
|
||||||
|
pathd=no
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > /etc/frr/frr.conf << EOF
|
||||||
|
frr version 10.1.2
|
||||||
|
frr defaults traditional
|
||||||
|
hostname $name
|
||||||
|
no ipv6 forwarding
|
||||||
|
!
|
||||||
|
interface gre1
|
||||||
|
no ip ospf passive
|
||||||
|
exit
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
ospf router-id $r_id
|
||||||
|
area 0 authentication message-digest
|
||||||
|
passive-interface default
|
||||||
|
network $ip_s3 area 0
|
||||||
|
network $ip_s8 area 0
|
||||||
|
network $ip_tun area 0
|
||||||
|
exit
|
||||||
|
!
|
||||||
|
interface gre1
|
||||||
|
ip ospf network point-to-point
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
interface enp0s8
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 600 /etc/frr/frr.conf
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "__________________________Начало и перезагузка frr_____________________________"
|
||||||
|
systemctl restart frr
|
||||||
|
systemctl enable frr
|
||||||
|
systemctl start frr
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "_______________________________Проверка_______________________________"
|
||||||
|
systemctl status frr
|
||||||
|
ip route show
|
||||||
79
ospf_hqr
Executable file
79
ospf_hqr
Executable file
|
|
@ -0,0 +1,79 @@
|
||||||
|
#!/bin/bash
|
||||||
|
read -p "Введите имя(HQ-RTR): " name
|
||||||
|
read -p "Введите id роутера(2.2.2.2): " r_id
|
||||||
|
read -p "Введите подсеть для enp0s3(172.16.4.0/28): " ip_s3
|
||||||
|
read -p "Введите подсеть для enp0s8(192.168.3.0/26): " ip_s8
|
||||||
|
read -p "Введите подсеть туннеля(192.168.9.0/30): " ip_tun
|
||||||
|
cat > /etc/frr/daemons << EOF
|
||||||
|
bgpd=no
|
||||||
|
ospfd=yes
|
||||||
|
ospf6d=no
|
||||||
|
ripd=no
|
||||||
|
ripngd=no
|
||||||
|
isisd=no
|
||||||
|
pimd=no
|
||||||
|
pim6d=no
|
||||||
|
nhrpd=no
|
||||||
|
eigrpd=no
|
||||||
|
babeld=no
|
||||||
|
sharpd=no
|
||||||
|
pbrd=no
|
||||||
|
bfdd=no
|
||||||
|
fabricd=no
|
||||||
|
vrrpd=no
|
||||||
|
pathd=no
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > /etc/frr/frr.conf << EOF
|
||||||
|
frr version 10.1.2
|
||||||
|
frr defaults traditional
|
||||||
|
hostname $name
|
||||||
|
no ipv6 forwarding
|
||||||
|
!
|
||||||
|
interface gre1
|
||||||
|
no ip ospf passive
|
||||||
|
exit
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
ospf router-id $r_id
|
||||||
|
area 0 authentication message-digest
|
||||||
|
passive-interface default
|
||||||
|
network $ip_s3 area 0
|
||||||
|
network $ip_s8 area 0
|
||||||
|
network $ip_tun area 0
|
||||||
|
exit
|
||||||
|
!
|
||||||
|
interface gre1
|
||||||
|
ip ospf network point-to-point
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
interface enp0s8
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
interface enp0s9
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
interface enp0s10
|
||||||
|
ip ospf authentication message-digest
|
||||||
|
ip ospf message-digest-key 1 md5 1
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
chmod 600 /etc/frr/frr.conf
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "__________________________Старт и перезагрузка frr_____________________________"
|
||||||
|
systemctl restart frr
|
||||||
|
systemctl enable frr
|
||||||
|
systemctl start frr
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "_______________________________Проверка_______________________________"
|
||||||
|
systemctl status frr
|
||||||
|
ip route show
|
||||||
17
usr
Executable file
17
usr
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Задание 3, Модуль 1 (HQ-SRV / BR-SRV)
|
||||||
|
|
||||||
|
[ $EUID -ne 0 ] && echo "Требуется root" && exit 1
|
||||||
|
|
||||||
|
# 1. Пользователь remote_user
|
||||||
|
useradd -m remote_user 2>/dev/null
|
||||||
|
|
||||||
|
# 2. Пользователь sshuser (UID 2026, пароль P@ssw0rd)
|
||||||
|
useradd -u 2026 -m sshuser 2>/dev/null
|
||||||
|
echo "sshuser:user" | chpasswd
|
||||||
|
|
||||||
|
# 3. Sudo без пароля для sshuser
|
||||||
|
echo "sshuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||||
|
chmod 440 /etc/sudoers
|
||||||
|
|
||||||
|
echo "Готово"
|
||||||
Loading…
Reference in a new issue