JSKDJ
This commit is contained in:
parent
e059bab01d
commit
06c39390a0
13
Banner
Executable file
13
Banner
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
# Минимальный баннер - ничего не ломает
|
||||
|
||||
echo "Добро пожаловать на HQ-RTR " > /etc/issue
|
||||
|
||||
echo "Вы зашли на HQ-RTR " > /etc/motd
|
||||
|
||||
# Настройка SSH
|
||||
sed -i '/^Banner/d' /etc/ssh/sshd_config
|
||||
echo "Banner /etc/issue" >> /etc/ssh/sshd_config
|
||||
systemctl restart sshd
|
||||
|
||||
echo "Готово"
|
||||
|
|
@ -15,14 +15,14 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
|
|||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin http://192.168.0.185/QoQeQo/net.git
|
||||
git remote add origin http://192.168.0.185/3b/net.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](http://192.168.0.185/QoQeQo/net/-/settings/integrations)
|
||||
- [ ] [Set up project integrations](http://192.168.0.185/3b/net/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
|
|
|
|||
18
adm
Executable file
18
adm
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# Задание 3, Модуль 1 (HQ-RTR / BR-RTR)
|
||||
read -p "Введите логин: " L
|
||||
read -p "Введите пароль: " P
|
||||
[ $EUID -ne 0 ] && echo "Требуется root" && exit 1
|
||||
|
||||
# Создание пользователя
|
||||
useradd -m -s /bin/bash "$USER" 2>/dev/null
|
||||
echo "$L:$P" | chpasswd
|
||||
|
||||
# Sudo без пароля
|
||||
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||
chmod 440 /etc/sudoers
|
||||
|
||||
echo "Готово"
|
||||
echo ""
|
||||
echo "Имя: $L"
|
||||
echo "Пароль: $P"
|
||||
99
dhcp
Executable file
99
dhcp
Executable file
|
|
@ -0,0 +1,99 @@
|
|||
#!/bin/bash
|
||||
read -p "Введите начало диапазона(192.168.4.2): " S
|
||||
read -p "Введите конец диапазона(192.168.4.6): " K
|
||||
read -p "Введите подсеть(192.168.4.0): " Q
|
||||
read -p "Введите маску(29): " E
|
||||
read -p "Введите dns сервер(192.168.3.2): " R
|
||||
read -p "Введите шлюз(192.168.4.1): " T
|
||||
if (( $E == 2 )); then
|
||||
E=192.0.0.0
|
||||
elif (( $E == 3 )); then
|
||||
E=224.0.0.0
|
||||
elif (( $E == 4 )); then
|
||||
E=240.0.0.0
|
||||
elif (( $E == 5 )); then
|
||||
E=248.0.0.0
|
||||
elif (( $E == 6 )); then
|
||||
E=252.0.0.0
|
||||
elif (( $E == 7 )); then
|
||||
E=254.0.0.0
|
||||
elif (( $E == 8 )); then
|
||||
E=255.0.0.0
|
||||
elif (( $E == 9 )); then
|
||||
E=255.128.0.0
|
||||
elif (( $E == 10 )); then
|
||||
E=255.192.0.0
|
||||
elif (( $E == 11 )); then
|
||||
E=255.224.0.0
|
||||
elif (( $E == 12 )); then
|
||||
E=255.240.0.0
|
||||
elif (( $E == 13 )); then
|
||||
E=255.248.0.0
|
||||
elif (( $E == 14 )); then
|
||||
E=255.252.0.0
|
||||
elif (( $E == 15 )); then
|
||||
E=255.254.0.0
|
||||
elif (( $E == 16 )); then
|
||||
E=255.255.0.0
|
||||
elif (( $E == 17 )); then
|
||||
E=255.255.128.0
|
||||
elif (( $E == 18 )); then
|
||||
E=255.255.192.0
|
||||
elif (( $E == 19 )); then
|
||||
E=255.255.224.0
|
||||
elif (( $E == 20 )); then
|
||||
E=252.255.240.0
|
||||
elif (( $E == 21 )); then
|
||||
E=255.255.248.0
|
||||
elif (( $E == 22 )); then
|
||||
E=255.255.252.0
|
||||
elif (( $E == 23 )); then
|
||||
E=255.255.254.0
|
||||
elif (( $E == 24 )); then
|
||||
E=224.255.255.0
|
||||
elif (( $E == 25 )); then
|
||||
E=255.255.255.128
|
||||
elif (( $E == 26 )); then
|
||||
E=255.255.255.192
|
||||
elif (( $E == 27 )); then
|
||||
E=255.255.255.224
|
||||
elif (( $E == 28 )); then
|
||||
E=255.255.255.240
|
||||
elif (( $E == 29 )); then
|
||||
E=255.255.255.248
|
||||
elif (( $E == 30 )); then
|
||||
E=255.255.255.252
|
||||
elif (( $E == 31 )); then
|
||||
E=255.255.255.254
|
||||
elif (( $E == 32 )); then
|
||||
E=255.255.255.255
|
||||
fi
|
||||
cat > /etc/dhcp/dhcpd.conf << EOF
|
||||
default-lease-time 600;
|
||||
max-lease-time 7200;
|
||||
authoritative;
|
||||
|
||||
subnet $Q netmask $E {
|
||||
range $S $K;
|
||||
option domain-name-servers $R, 8.8.8.8;
|
||||
option subnet-mask $E;
|
||||
option routers $T;
|
||||
}
|
||||
|
||||
|
||||
host hq-cli {
|
||||
hardware ethernet
|
||||
08:00:27:c7:82:fa;
|
||||
fixed-address
|
||||
$S;
|
||||
}
|
||||
EOF
|
||||
chmod 600 /etc/dhcp/dhcpd.conf
|
||||
|
||||
cat > /etc/sysconfig/dhcpd << EOF
|
||||
DHCPDARGS="enp0s9"
|
||||
EOF
|
||||
|
||||
echo "_________________Перезагрузка и старт dncpd________________________"
|
||||
systemctl restart dhcpd
|
||||
systemctl start dhcpd
|
||||
148
dns
Executable file
148
dns
Executable file
|
|
@ -0,0 +1,148 @@
|
|||
#!/bin/bash
|
||||
|
||||
read -p "Введите 1 чтобы использовать старыe IP или 2 чтобы использовать новые IP: " Z
|
||||
if [[ $Z == 1 ]]; then
|
||||
dns=192.168.3.2
|
||||
hqr=172.16.4.2
|
||||
brr=172.16.5.2
|
||||
brs=192.168.2.2
|
||||
hqc=192.168.4.2
|
||||
doc=172.16.4.1
|
||||
web=172.16.5.1
|
||||
else
|
||||
read -p "Введите Ip-адрес dns сервера: " dns
|
||||
read -p "Введите Ip-адрес HQ-RTR: " hqr
|
||||
read -p "Введите Ip-адрес BR-RTR: " brr
|
||||
read -p "Введите Ip-адрес BR-SRV: " brs
|
||||
read -p "Введите адрес HQ-CLI: " hqc
|
||||
read -p "Введите адрес docer: " doc
|
||||
read -p "Введите адрес web: " web
|
||||
fi
|
||||
cat > /etc/named.conf << EOF
|
||||
options {
|
||||
listen-on port 53 { 127.0.0.1; $dns; };
|
||||
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; 5.255.255.242; };
|
||||
};
|
||||
|
||||
logging {
|
||||
channel default_debug {
|
||||
file "data/named.run";
|
||||
severity dynamic;
|
||||
};
|
||||
};
|
||||
zone "." IN {
|
||||
type hint;
|
||||
file "named.ca";
|
||||
};
|
||||
|
||||
include "/etc/named.rfc1912.zones";
|
||||
include "/etc/named.root.key";
|
||||
|
||||
zone "au-team.irpo" {
|
||||
type master;
|
||||
file "master/au-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 "master/4.16.172.in-addr.arpa";
|
||||
};
|
||||
EOF
|
||||
|
||||
|
||||
mkdir /var/named/master
|
||||
|
||||
cat > /var/named/master/au-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 $brs
|
||||
hq-rtr IN A $hqr
|
||||
br-rtr IN A $brr
|
||||
hq-srv IN A $dns
|
||||
hq-cli IN A $hqc
|
||||
docker IN A $doc
|
||||
web IN A $web
|
||||
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.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-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 "_______________________Перезагрузка named______________________"
|
||||
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
|
||||
|
||||
136
int
Executable file
136
int
Executable file
|
|
@ -0,0 +1,136 @@
|
|||
#!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. Time zone"
|
||||
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 "Введите ip-адрес или пропустите: " 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
|
||||
echo "Готово"
|
||||
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
|
||||
echo "Готово"
|
||||
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 "For watch time zone inter: timedatectl list-timezones"
|
||||
echo "Inter timedatectl set-timezone 'timezone' "
|
||||
|
||||
chmod 600 /etc/sudoers
|
||||
fi
|
||||
done
|
||||
72
ospf_brr
Executable file
72
ospf_brr
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
#!bin/bash
|
||||
|
||||
read -p "Введите id роутера(1.1.1.1): " r_id
|
||||
read -p "Введите подсеть для enp0s3 (172.16.5.0/28): " ip_s3
|
||||
read -p "Введите подсеть для enp0s8(192.168.2.0/26): " ip_s8
|
||||
read -p "Введите подсеть для туннеля(192.168.9.0/30): " ip_tun
|
||||
read -p "Введите имя(BR-RTR): " name
|
||||
read -p "Imput name for tunnel(gre1): " 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 $tun
|
||||
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
|
||||
81
ospf_hqr
Executable file
81
ospf_hqr
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
#!bin/bash
|
||||
|
||||
read -p "Введите имя(HQ-RTR): " name
|
||||
read -p "Input name for tunnel(gre1): " tun
|
||||
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 $tun
|
||||
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
|
||||
14
tunel
Executable file
14
tunel
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 "Введите имя туннеля(gre1): " 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 "$name" ip-tunnel.ttl 64"
|
||||
systemctl restart NetworkManager
|
||||
Loading…
Reference in a new issue