From e2a474e49129e0d6f2f89cbf714fa02a3bacd911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=91=D1=82=D1=80=20=D0=9A=D0=B8=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B3=D0=BB=D0=BE?= Date: Tue, 20 Jan 2026 14:47:55 +0000 Subject: [PATCH 01/10] Initial commit --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..47631a9 --- /dev/null +++ b/README.md @@ -0,0 +1,93 @@ +# net + + + +## Getting started + +To make it easy for you to get started with GitLab, here's a list of recommended next steps. + +Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! + +## Add your files + +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: + +``` +cd existing_repo +git remote add origin http://192.168.0.185/kioroglop/net.git +git branch -M main +git push -uf origin main +``` + +## Integrate with your tools + +- [ ] [Set up project integrations](http://192.168.0.185/kioroglop/net/-/settings/integrations) + +## Collaborate with your team + +- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) + +## Test and Deploy + +Use the built-in continuous integration in GitLab. + +- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + +*** + +# Editing this README + +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. + +## Suggestions for a good README + +Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +## Name +Choose a self-explaining name for your project. + +## Description +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +## Badges +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +## Visuals +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +## Installation +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +## Usage +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +## Support +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +## Roadmap +If you have ideas for releases in the future, it is a good idea to list them in the README. + +## Contributing +State if you are open to contributions and what your requirements are for accepting them. + +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. + +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. + +## Authors and acknowledgment +Show your appreciation to those who have contributed to the project. + +## License +For open source projects, say how it is licensed. + +## Project status +If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. From 0557f5af61e0c1b9304ca8410b232e295130ca78 Mon Sep 17 00:00:00 2001 From: kioroglop Date: Tue, 20 Jan 2026 15:20:27 +0500 Subject: [PATCH 02/10] Peter --- isp_module_1.sh | 233 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 isp_module_1.sh diff --git a/isp_module_1.sh b/isp_module_1.sh new file mode 100644 index 0000000..79d4470 --- /dev/null +++ b/isp_module_1.sh @@ -0,0 +1,233 @@ +#!/bin/bash + +# Скрипт настройки ISP хоста +# Проверяем, запущен ли скрипт от root +if [[ $EUID -ne 0 ]]; then + echo "Этот скрипт должен быть запущен с правами root" + exit 1 +fi + +echo "=== Настройка ISP хоста ===" + +# 1. Установка имени хоста +read -p "Введите имя хоста (например: isp.au-team.irpo): " hostname +if [[ -n "$hostname" ]]; then + echo "Устанавливаем имя хоста: $hostname" + hostnamectl set-hostname "$hostname" + exec bash +else + echo "Имя хоста не было введено, пропускаем этот шаг" +fi + +echo "" +echo "=== Настройка сетевых интерфейсов ===" + +# 2. Настройка enp0s8 +echo "Настройка интерфейса enp0s8 (HQ-RTR)" +read -p "Введите IP адрес для enp0s8 (например: 172.16.4.1/28): " ip_enp0s8 + +if [[ -n "$ip_enp0s8" ]]; then + echo "Настраиваем enp0s8 с адресом: $ip_enp0s8" + + # Создаем файл конфигурации для enp0s8 + cat > /etc/NetworkManager/system-connections/enp0s8.nmconnection << EOF +[connection] +id=enp0s8 +uuid=$(uuidgen) +type=ethernet +autoconnect-priority=-999 +interface-name=enp0s8 +timestamp=$(date +%s) + +[ethernet] + +[ipv4] +address1=$ip_enp0s8 +method=manual + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF + + chmod 600 /etc/NetworkManager/system-connections/enp0s8.nmconnection +fi + +# 3. Настройка enp0s9 +echo "" +echo "Настройка интерфейса enp0s9 (BR-RTR)" +read -p "Введите IP адрес для enp0s9 (например: 172.16.5.1/28): " ip_enp0s9 + +if [[ -n "$ip_enp0s9" ]]; then + echo "Настраиваем enp0s9 с адресом: $ip_enp0s9" + + # Создаем файл конфигурации для enp0s9 + cat > /etc/NetworkManager/system-connections/enp0s9.nmconnection << EOF +[connection] +id=enp0s9 +uuid=$(uuidgen) +type=ethernet +autoconnect-priority=-999 +interface-name=enp0s9 +timestamp=$(date +%s) + +[ethernet] + +[ipv4] +address1=$ip_enp0s9 +method=manual + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF + + chmod 600 /etc/NetworkManager/system-connections/enp0s9.nmconnection +fi + +# 4. Настройка enp0s3 (внешний интерфейс) +echo "" +echo "Настройка интерфейса enp0s3 (внешний, в интернет)" +read -p "Использовать DHCP для enp0s3? (y/n): " use_dhcp + +if [[ "$use_dhcp" == "y" || "$use_dhcp" == "Y" ]]; then + echo "Настраиваем enp0s3 на получение адреса по DHCP" + + 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] +method=auto + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF +else + read -p "Введите статический IP для enp0s3 (формат: IP/маска, шлюз, DNS): " ip_enp0s3 + if [[ -n "$ip_enp0s3" ]]; then + echo "Настраиваем enp0s3 со статическим адресом" + + # Разбираем ввод (ожидается формат: 192.168.1.2/24,192.168.1.1,8.8.8.8) + IFS=',' read -ra ADDR <<< "$ip_enp0s3" + ip_with_mask="${ADDR[0]}" + gateway="${ADDR[1]}" + dns="${ADDR[2]}" + + 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_with_mask +gateway=$gateway +dns=$dns +method=manual + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF + fi +fi + +chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection + +echo "" +echo "=== Перезапуск NetworkManager ===" +systemctl restart NetworkManager +sleep 3 + +echo "" +echo "=== Настройка iptables и маршрутизации ===" + +# 5. Включение и настройка iptables +systemctl enable --now iptables +echo "Статус iptables:" +systemctl status iptables --no-pager + +# 6. Очистка правил iptables и настройка NAT +iptables -F +iptables -t nat -F + +# Определяем подсети из введенных адресов +if [[ -n "$ip_enp0s8" ]]; then + # Извлекаем подсеть из формата IP/маска + subnet1=$(echo "$ip_enp0s8" | cut -d'/' -f1 | cut -d'.' -f1-3) + mask1=$(echo "$ip_enp0s8" | cut -d'/' -f2) + iptables -t nat -A POSTROUTING -s $subnet1.0/$mask1 -o enp0s3 -j MASQUERADE + echo "Добавлено правило NAT для подсети: $subnet1.0/$mask1" +fi + +if [[ -n "$ip_enp0s9" ]]; then + subnet2=$(echo "$ip_enp0s9" | cut -d'/' -f1 | cut -d'.' -f1-3) + mask2=$(echo "$ip_enp0s9" | cut -d'/' -f2) + iptables -t nat -A POSTROUTING -s $subnet2.0/$mask2 -o enp0s3 -j MASQUERADE + echo "Добавлено правило NAT для подсети: $subnet2.0/$mask2" +fi + +# 7. Сохранение правил iptables +service iptables save + +# 8. Включение IP forwarding +echo "Включаем IP forwarding..." +sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf +sysctl -p + +echo "" +echo "=== Проверка настроек ===" +echo "Текущие правила iptables NAT:" +iptables -t nat -L POSTROUTING -n -v + +echo "" +echo "Текущее состояние IP forwarding:" +sysctl net.ipv4.ip_forward + +echo "" +echo "=== Тестирование соединения (после перезагрузки) ===" +echo "После перезагрузки вы можете выполнить следующие команды для проверки:" +if [[ -n "$ip_enp0s8" ]]; then + ip1=$(echo "$ip_enp0s8" | cut -d'/' -f1) + echo "ping ya.ru -I $ip1" +fi +if [[ -n "$ip_enp0s9" ]]; then + ip2=$(echo "$ip_enp0s9" | cut -d'/' -f1) + echo "ping ya.ru -I $ip2" +fi + +echo "" +read -p "Выполнить перезагрузку сейчас? (y/n): " reboot_now +if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then + echo "Перезагружаем систему..." + reboot +else + echo "Настройка завершена. Перезагрузите систему для применения всех изменений." + echo "Используйте команду: reboot" +fi + + + + From 618c50677528561c05d8a56da6b3868cb81ff73a Mon Sep 17 00:00:00 2001 From: user Date: Wed, 21 Jan 2026 17:14:21 +0500 Subject: [PATCH 03/10] aiena --- isp_module_1.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/isp_module_1.sh b/isp_module_1.sh index 79d4470..2a9e2db 100644 --- a/isp_module_1.sh +++ b/isp_module_1.sh @@ -1,5 +1,6 @@ #!/bin/bash + # Скрипт настройки ISP хоста # Проверяем, запущен ли скрипт от root if [[ $EUID -ne 0 ]]; then @@ -13,8 +14,7 @@ echo "=== Настройка ISP хоста ===" read -p "Введите имя хоста (например: isp.au-team.irpo): " hostname if [[ -n "$hostname" ]]; then echo "Устанавливаем имя хоста: $hostname" - hostnamectl set-hostname "$hostname" - exec bash + hostnamectl set-hostname "$hostname"[D else echo "Имя хоста не было введено, пропускаем этот шаг" fi From 2afc76d65496cb94c35651a42112d3b5951ef0f2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 29 Jan 2026 14:01:37 +0500 Subject: [PATCH 04/10] idi nahui --- br_rtr_module_1.sh | 152 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 br_rtr_module_1.sh diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh new file mode 100644 index 0000000..b131b22 --- /dev/null +++ b/br_rtr_module_1.sh @@ -0,0 +1,152 @@ +#!/bin/bash + +# Скрипт настройки ISP хоста +# Проверяем, запущен ли скрипт от root +if [[ $EUID -ne 0 ]]; then + echo "Этот скрипт должен быть запущен с правами root" + exit 1 +fi + +echo "=== Настройка ISP хоста ===" + +# 1. Установка имени хоста +read -p "Введите имя хоста (например: br-rtr.au-team.irpo): " hostname +if [[ -n "$hostname" ]]; then + echo "Устанавливаем имя хоста: $hostname" + hostnamectl set-hostname "$hostname" + exec bash +else + echo "Имя хоста не было введено, пропускаем этот шаг" +fi + +echo "" +echo "=== Настройка сетевых интерфейсов ===" + +# 2. Настройка enp0s8 +echo "Настройка интерфейса enp0s8 (HQ-RTR)" +read -p "Введите IP адрес для enp0s8 (например: 192.168.2.1/27): " ip_enp0s8 + +if [[ -n "$ip_enp0s8" ]]; then + echo "Настраиваем enp0s8 с адресом: $ip_enp0s8" + + # Создаем файл конфигурации для enp0s8 + cat > /etc/NetworkManager/system-connections/enp0s8.nmconnection << EOF +[connection] +id=enp0s8 +uuid=$(uuidgen) +type=ethernet +autoconnect-priority=-999 +interface-name=enp0s8 +timestamp=$(date +%s) + +[ethernet] + +[ipv4] +address1=$ip_enp0s8 +method=manual + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF + + chmod 600 /etc/NetworkManager/system-connections/enp0s8.nmconnection +fi + +# 3. Настройка enp0s3 +echo "Настройка интерфейса enp0s3 (ISP)" +read -p "Введите IP адрес для enp0s8 (например: 172.16.5.1/28): " ip_enp0s3 + +if [[ -n "$ip_enp0s3" ]]; then + echo "Настраиваем enp0s8 с адресом: $ip_enp0s3" + + # Создаем файл конфигурации для enp0s8 + 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_enp0s3 +method=manual + +[ipv6] +addr-gen-mode=eui64 +method=disabled + +[proxy] +EOF + + chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection +fi + + + +# 4. Включение и настройка iptables +systemctl enable --now iptables +echo "Статус iptables:" +systemctl status iptables --no-pager + +# 5. Очистка правил iptables и настройка NAT +iptables -F +iptables -t nat -F + +# Определяем подсети из введенных адресов +if [[ -n "$ip_enp0s3" ]]; then + # Извлекаем подсеть из формата IP/маска + subnet1=$(echo "$ip_enp0s3" | cut -d'/' -f1 | cut -d'.' -f1-3) + mask1=$(echo "$ip_enp0s3" | cut -d'/' -f2) + iptables -t nat -A POSTROUTING -s $subnet1.0/$mask1 -o enp0s3 -j MASQUERADE + echo "Добавлено правило NAT для подсети: $subnet1.0/$mask1" +fi + +# 6. Сохранение правил iptables +service iptables save + +# 7. Включение IP forwarding +echo "Включаем IP forwarding..." +sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf +sysctl -p + +echo "" +echo "=== Проверка настроек ===" +echo "Текущие правила iptables NAT:" +iptables -t nat -L POSTROUTING -n -v + +echo "" +echo "Текущее состояние IP forwarding:" +sysctl net.ipv4.ip_forward + +echo "" +echo "=== Тестирование соединения (после перезагрузки) ===" +echo "После перезагрузки вы можете выполнить следующие команды для проверки:" +if [[ -n "$ip_enp0s3" ]]; then + ip1=$(echo "$ip_enp0s3" | cut -d'/' -f1) + echo "ping ya.ru -I $ip1" +fi +if [[ -n "$ip_enp0s8" ]]; then + ip2=$(echo "$ip_enp0s8" | cut -d'/' -f1) + echo "ping ya.ru -I $ip2" +fi + +echo "" +read -p "Выполнить перезагрузку сейчас? (y/n): " reboot_now +if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then + echo "Перезагружаем систему..." + reboot +else + echo "Настройка завершена. Перезагрузите систему для применения всех изменений." + echo "Используйте команду: reboot" +fi + + + + From fd4fb8de40e67da641fc2cfa41adfaaf58261caf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 29 Jan 2026 14:23:06 +0500 Subject: [PATCH 05/10] peter --- br_rtr_module_1.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh index b131b22..2faf484 100644 --- a/br_rtr_module_1.sh +++ b/br_rtr_module_1.sh @@ -52,18 +52,21 @@ method=disabled [proxy] EOF - chmod 600 /etc/NetworkManager/system-connections/enp0s8.nmconnection + chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection fi # 3. Настройка enp0s3 -echo "Настройка интерфейса enp0s3 (ISP)" -read -p "Введите IP адрес для enp0s8 (например: 172.16.5.1/28): " ip_enp0s3 - -if [[ -n "$ip_enp0s3" ]]; then - echo "Настраиваем enp0s8 с адресом: $ip_enp0s3" - - # Создаем файл конфигурации для enp0s8 - cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF +read -p "Введите статический IP для enp0s3 (формат: IP/маска, шлюз, DNS): " ip_enp0s3 + if [[ -n "$ip_enp0s3" ]]; then + echo "Настраиваем enp0s3 со статическим адресом" + + # Разбираем ввод (ожидается формат: 172.16.5.2/28,172.16.5.1,8.8.8.8) + IFS=',' read -ra ADDR <<< "$ip_enp0s3" + ip_with_mask="${ADDR[0]}" + gateway="${ADDR[1]}" + dns="${ADDR[2]}" + + cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF [connection] id=enp0s3 uuid=$(uuidgen) @@ -75,7 +78,9 @@ timestamp=$(date +%s) [ethernet] [ipv4] -address1=$ip_enp0s3 +address1=$ip_with_mask +gateway=$gateway +dns=$dns method=manual [ipv6] @@ -84,11 +89,18 @@ method=disabled [proxy] EOF - - chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection + fi fi +chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection +echo "" +echo "=== Перезапуск NetworkManager ===" +systemctl restart NetworkManager +sleep 3 + +echo "" +echo "=== Настройка iptables и маршрутизации ===" # 4. Включение и настройка iptables systemctl enable --now iptables From 38eecd373f8968b640e26884b421e0cd0313ce8d Mon Sep 17 00:00:00 2001 From: kioroglop Date: Thu, 29 Jan 2026 14:31:57 +0500 Subject: [PATCH 06/10] suka --- br_rtr_module_1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh index 2faf484..37bc49e 100644 --- a/br_rtr_module_1.sh +++ b/br_rtr_module_1.sh @@ -88,7 +88,7 @@ addr-gen-mode=eui64 method=disabled [proxy] -EOF +EOF fi fi From 6574843719dd785ab2b94b12fc7f455b2f7c9d69 Mon Sep 17 00:00:00 2001 From: kioroglop Date: Thu, 29 Jan 2026 14:46:40 +0500 Subject: [PATCH 07/10] zaebalo --- br_rtr_module_1.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh index 37bc49e..933ec64 100644 --- a/br_rtr_module_1.sh +++ b/br_rtr_module_1.sh @@ -157,8 +157,4 @@ if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then else echo "Настройка завершена. Перезагрузите систему для применения всех изменений." echo "Используйте команду: reboot" -fi - - - - +fi \ No newline at end of file From a4b2d370c5fd87ec14711214a1a2d335c0a8384d Mon Sep 17 00:00:00 2001 From: kioroglop Date: Tue, 3 Feb 2026 14:50:32 +0500 Subject: [PATCH 08/10] a --- br_rtr_module_1.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh index 933ec64..458802f 100644 --- a/br_rtr_module_1.sh +++ b/br_rtr_module_1.sh @@ -157,4 +157,5 @@ if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then else echo "Настройка завершена. Перезагрузите систему для применения всех изменений." echo "Используйте команду: reboot" -fi \ No newline at end of file +fi + EOF \ No newline at end of file From 65854cc844f13a56c7cb8e292b21db30d1878a33 Mon Sep 17 00:00:00 2001 From: kioroglo2410 Date: Fri, 6 Nov 2026 10:18:06 +0500 Subject: [PATCH 09/10] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20isp=5Fmodule=5F1.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- isp_module_1.sh | 233 ------------------------------------------------ 1 file changed, 233 deletions(-) delete mode 100644 isp_module_1.sh diff --git a/isp_module_1.sh b/isp_module_1.sh deleted file mode 100644 index 2a9e2db..0000000 --- a/isp_module_1.sh +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash - - -# Скрипт настройки ISP хоста -# Проверяем, запущен ли скрипт от root -if [[ $EUID -ne 0 ]]; then - echo "Этот скрипт должен быть запущен с правами root" - exit 1 -fi - -echo "=== Настройка ISP хоста ===" - -# 1. Установка имени хоста -read -p "Введите имя хоста (например: isp.au-team.irpo): " hostname -if [[ -n "$hostname" ]]; then - echo "Устанавливаем имя хоста: $hostname" - hostnamectl set-hostname "$hostname"[D -else - echo "Имя хоста не было введено, пропускаем этот шаг" -fi - -echo "" -echo "=== Настройка сетевых интерфейсов ===" - -# 2. Настройка enp0s8 -echo "Настройка интерфейса enp0s8 (HQ-RTR)" -read -p "Введите IP адрес для enp0s8 (например: 172.16.4.1/28): " ip_enp0s8 - -if [[ -n "$ip_enp0s8" ]]; then - echo "Настраиваем enp0s8 с адресом: $ip_enp0s8" - - # Создаем файл конфигурации для enp0s8 - cat > /etc/NetworkManager/system-connections/enp0s8.nmconnection << EOF -[connection] -id=enp0s8 -uuid=$(uuidgen) -type=ethernet -autoconnect-priority=-999 -interface-name=enp0s8 -timestamp=$(date +%s) - -[ethernet] - -[ipv4] -address1=$ip_enp0s8 -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF - - chmod 600 /etc/NetworkManager/system-connections/enp0s8.nmconnection -fi - -# 3. Настройка enp0s9 -echo "" -echo "Настройка интерфейса enp0s9 (BR-RTR)" -read -p "Введите IP адрес для enp0s9 (например: 172.16.5.1/28): " ip_enp0s9 - -if [[ -n "$ip_enp0s9" ]]; then - echo "Настраиваем enp0s9 с адресом: $ip_enp0s9" - - # Создаем файл конфигурации для enp0s9 - cat > /etc/NetworkManager/system-connections/enp0s9.nmconnection << EOF -[connection] -id=enp0s9 -uuid=$(uuidgen) -type=ethernet -autoconnect-priority=-999 -interface-name=enp0s9 -timestamp=$(date +%s) - -[ethernet] - -[ipv4] -address1=$ip_enp0s9 -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF - - chmod 600 /etc/NetworkManager/system-connections/enp0s9.nmconnection -fi - -# 4. Настройка enp0s3 (внешний интерфейс) -echo "" -echo "Настройка интерфейса enp0s3 (внешний, в интернет)" -read -p "Использовать DHCP для enp0s3? (y/n): " use_dhcp - -if [[ "$use_dhcp" == "y" || "$use_dhcp" == "Y" ]]; then - echo "Настраиваем enp0s3 на получение адреса по DHCP" - - 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] -method=auto - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF -else - read -p "Введите статический IP для enp0s3 (формат: IP/маска, шлюз, DNS): " ip_enp0s3 - if [[ -n "$ip_enp0s3" ]]; then - echo "Настраиваем enp0s3 со статическим адресом" - - # Разбираем ввод (ожидается формат: 192.168.1.2/24,192.168.1.1,8.8.8.8) - IFS=',' read -ra ADDR <<< "$ip_enp0s3" - ip_with_mask="${ADDR[0]}" - gateway="${ADDR[1]}" - dns="${ADDR[2]}" - - 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_with_mask -gateway=$gateway -dns=$dns -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF - fi -fi - -chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection - -echo "" -echo "=== Перезапуск NetworkManager ===" -systemctl restart NetworkManager -sleep 3 - -echo "" -echo "=== Настройка iptables и маршрутизации ===" - -# 5. Включение и настройка iptables -systemctl enable --now iptables -echo "Статус iptables:" -systemctl status iptables --no-pager - -# 6. Очистка правил iptables и настройка NAT -iptables -F -iptables -t nat -F - -# Определяем подсети из введенных адресов -if [[ -n "$ip_enp0s8" ]]; then - # Извлекаем подсеть из формата IP/маска - subnet1=$(echo "$ip_enp0s8" | cut -d'/' -f1 | cut -d'.' -f1-3) - mask1=$(echo "$ip_enp0s8" | cut -d'/' -f2) - iptables -t nat -A POSTROUTING -s $subnet1.0/$mask1 -o enp0s3 -j MASQUERADE - echo "Добавлено правило NAT для подсети: $subnet1.0/$mask1" -fi - -if [[ -n "$ip_enp0s9" ]]; then - subnet2=$(echo "$ip_enp0s9" | cut -d'/' -f1 | cut -d'.' -f1-3) - mask2=$(echo "$ip_enp0s9" | cut -d'/' -f2) - iptables -t nat -A POSTROUTING -s $subnet2.0/$mask2 -o enp0s3 -j MASQUERADE - echo "Добавлено правило NAT для подсети: $subnet2.0/$mask2" -fi - -# 7. Сохранение правил iptables -service iptables save - -# 8. Включение IP forwarding -echo "Включаем IP forwarding..." -sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf -sysctl -p - -echo "" -echo "=== Проверка настроек ===" -echo "Текущие правила iptables NAT:" -iptables -t nat -L POSTROUTING -n -v - -echo "" -echo "Текущее состояние IP forwarding:" -sysctl net.ipv4.ip_forward - -echo "" -echo "=== Тестирование соединения (после перезагрузки) ===" -echo "После перезагрузки вы можете выполнить следующие команды для проверки:" -if [[ -n "$ip_enp0s8" ]]; then - ip1=$(echo "$ip_enp0s8" | cut -d'/' -f1) - echo "ping ya.ru -I $ip1" -fi -if [[ -n "$ip_enp0s9" ]]; then - ip2=$(echo "$ip_enp0s9" | cut -d'/' -f1) - echo "ping ya.ru -I $ip2" -fi - -echo "" -read -p "Выполнить перезагрузку сейчас? (y/n): " reboot_now -if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then - echo "Перезагружаем систему..." - reboot -else - echo "Настройка завершена. Перезагрузите систему для применения всех изменений." - echo "Используйте команду: reboot" -fi - - - - From 9d354892b8439e6cb3d93b4b74098cd139836d66 Mon Sep 17 00:00:00 2001 From: kioroglo2410 Date: Fri, 6 Nov 2026 10:18:18 +0500 Subject: [PATCH 10/10] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20br=5Frtr=5Fmodule=5F1.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- br_rtr_module_1.sh | 161 --------------------------------------------- 1 file changed, 161 deletions(-) delete mode 100644 br_rtr_module_1.sh diff --git a/br_rtr_module_1.sh b/br_rtr_module_1.sh deleted file mode 100644 index 458802f..0000000 --- a/br_rtr_module_1.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash - -# Скрипт настройки ISP хоста -# Проверяем, запущен ли скрипт от root -if [[ $EUID -ne 0 ]]; then - echo "Этот скрипт должен быть запущен с правами root" - exit 1 -fi - -echo "=== Настройка ISP хоста ===" - -# 1. Установка имени хоста -read -p "Введите имя хоста (например: br-rtr.au-team.irpo): " hostname -if [[ -n "$hostname" ]]; then - echo "Устанавливаем имя хоста: $hostname" - hostnamectl set-hostname "$hostname" - exec bash -else - echo "Имя хоста не было введено, пропускаем этот шаг" -fi - -echo "" -echo "=== Настройка сетевых интерфейсов ===" - -# 2. Настройка enp0s8 -echo "Настройка интерфейса enp0s8 (HQ-RTR)" -read -p "Введите IP адрес для enp0s8 (например: 192.168.2.1/27): " ip_enp0s8 - -if [[ -n "$ip_enp0s8" ]]; then - echo "Настраиваем enp0s8 с адресом: $ip_enp0s8" - - # Создаем файл конфигурации для enp0s8 - cat > /etc/NetworkManager/system-connections/enp0s8.nmconnection << EOF -[connection] -id=enp0s8 -uuid=$(uuidgen) -type=ethernet -autoconnect-priority=-999 -interface-name=enp0s8 -timestamp=$(date +%s) - -[ethernet] - -[ipv4] -address1=$ip_enp0s8 -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF - - chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection -fi - -# 3. Настройка enp0s3 -read -p "Введите статический IP для enp0s3 (формат: IP/маска, шлюз, DNS): " ip_enp0s3 - if [[ -n "$ip_enp0s3" ]]; then - echo "Настраиваем enp0s3 со статическим адресом" - - # Разбираем ввод (ожидается формат: 172.16.5.2/28,172.16.5.1,8.8.8.8) - IFS=',' read -ra ADDR <<< "$ip_enp0s3" - ip_with_mask="${ADDR[0]}" - gateway="${ADDR[1]}" - dns="${ADDR[2]}" - - 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_with_mask -gateway=$gateway -dns=$dns -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=disabled - -[proxy] -EOF - fi -fi - -chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection - -echo "" -echo "=== Перезапуск NetworkManager ===" -systemctl restart NetworkManager -sleep 3 - -echo "" -echo "=== Настройка iptables и маршрутизации ===" - -# 4. Включение и настройка iptables -systemctl enable --now iptables -echo "Статус iptables:" -systemctl status iptables --no-pager - -# 5. Очистка правил iptables и настройка NAT -iptables -F -iptables -t nat -F - -# Определяем подсети из введенных адресов -if [[ -n "$ip_enp0s3" ]]; then - # Извлекаем подсеть из формата IP/маска - subnet1=$(echo "$ip_enp0s3" | cut -d'/' -f1 | cut -d'.' -f1-3) - mask1=$(echo "$ip_enp0s3" | cut -d'/' -f2) - iptables -t nat -A POSTROUTING -s $subnet1.0/$mask1 -o enp0s3 -j MASQUERADE - echo "Добавлено правило NAT для подсети: $subnet1.0/$mask1" -fi - -# 6. Сохранение правил iptables -service iptables save - -# 7. Включение IP forwarding -echo "Включаем IP forwarding..." -sysctl net.ipv4.ip_forward=1 >> /etc/sysctl.conf -sysctl -p - -echo "" -echo "=== Проверка настроек ===" -echo "Текущие правила iptables NAT:" -iptables -t nat -L POSTROUTING -n -v - -echo "" -echo "Текущее состояние IP forwarding:" -sysctl net.ipv4.ip_forward - -echo "" -echo "=== Тестирование соединения (после перезагрузки) ===" -echo "После перезагрузки вы можете выполнить следующие команды для проверки:" -if [[ -n "$ip_enp0s3" ]]; then - ip1=$(echo "$ip_enp0s3" | cut -d'/' -f1) - echo "ping ya.ru -I $ip1" -fi -if [[ -n "$ip_enp0s8" ]]; then - ip2=$(echo "$ip_enp0s8" | cut -d'/' -f1) - echo "ping ya.ru -I $ip2" -fi - -echo "" -read -p "Выполнить перезагрузку сейчас? (y/n): " reboot_now -if [[ "$reboot_now" == "y" || "$reboot_now" == "Y" ]]; then - echo "Перезагружаем систему..." - reboot -else - echo "Настройка завершена. Перезагрузите систему для применения всех изменений." - echo "Используйте команду: reboot" -fi - EOF \ No newline at end of file