This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
настройка_сети_в_linux [2023/06/07 09:02] val [Общие файлы конфигурации] |
настройка_сети_в_linux [2025/10/24 08:50] (current) val [Файлы конфигурации ifupdown (Debian/Ubuntu<18)] |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| * [[https://wiki.debian.org/ru/NetworkConfiguration]] | * [[https://wiki.debian.org/ru/NetworkConfiguration]] | ||
| * [[http://help.ubuntu.ru/wiki/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B5%D1%82%D0%B8_%D0%B2%D1%80%D1%83%D1%87%D0%BD%D1%83%D1%8E|Настройка сети вручную]] | * [[http://help.ubuntu.ru/wiki/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B5%D1%82%D0%B8_%D0%B2%D1%80%D1%83%D1%87%D0%BD%D1%83%D1%8E|Настройка сети вручную]] | ||
| + | * [[https://it-lux.ru/tcp-queue-syn-flooding/|Ошибка в логах ядра. request_sock_TCP: Possible SYN flooding]] | ||
| ===== Команды для настройки ===== | ===== Команды для настройки ===== | ||
| Line 78: | Line 79: | ||
| # ss -anptu | # ss -anptu | ||
| + | # ss -lnp | grep ':80' | ||
| + | |||
| + | # количество подключений с каждого адреса (https://serverfault.com/questions/421310/check-the-number-of-active-connections-on-port-80) | ||
| + | # ss -tn src :80 or src :443 | tr -s ' ' | cut -d ' ' -f5 | cut -d ':' -f1 | sort | uniq -c | sort -n | ||
| + | |||
| + | # отправка UDP пакета | ||
| + | # echo -n "hello" >/dev/udp/195.19.40.152/5060 | ||
| </code> | </code> | ||
| Line 183: | Line 191: | ||
| client1# dhclient eth0 | client1# dhclient eth0 | ||
| - | client1# cat /etc/hostname | + | client1# hostnamectl hostname client1 |
| - | </code><code> | + | |
| - | client1 | + | |
| - | </code><code> | + | |
| client1# :> /etc/resolv.conf | client1# :> /etc/resolv.conf | ||
| </code> | </code> | ||
| Line 225: | Line 231: | ||
| * [[https://www.linuxtechi.com/assign-static-ip-address-ubuntu-20-04-lts/|How to Assign Static IP Address on Ubuntu 20.04 LTS]] | * [[https://www.linuxtechi.com/assign-static-ip-address-ubuntu-20-04-lts/|How to Assign Static IP Address on Ubuntu 20.04 LTS]] | ||
| * [[https://unix.stackexchange.com/questions/588658/override-ubuntu-20-04-dns-using-systemd-resolved|Override Ubuntu 20.04 DNS using systemd-resolved]] | * [[https://unix.stackexchange.com/questions/588658/override-ubuntu-20-04-dns-using-systemd-resolved|Override Ubuntu 20.04 DNS using systemd-resolved]] | ||
| + | |||
| + | === Использование cloud-init === | ||
| + | |||
| + | * [[https://cloudinit.readthedocs.io/en/latest/tutorial/qemu.html|Core tutorial with QEMU]] | ||
| === Отключение cloud-init === | === Отключение cloud-init === | ||
| Line 231: | Line 241: | ||
| </code> | </code> | ||
| - | === netplan === | + | === Отключение ifupdown === |
| + | <code> | ||
| + | apt purge ifupdown | ||
| + | </code> | ||
| + | |||
| + | === Настройка Netplan === | ||
| * [[Формат YAML]] | * [[Формат YAML]] | ||
| Line 238: | Line 253: | ||
| <code> | <code> | ||
| + | # netplan status --all | ||
| + | |||
| # cat /etc/netplan/01-netcfg.yaml | # cat /etc/netplan/01-netcfg.yaml | ||
| </code><code> | </code><code> | ||
| Line 258: | Line 275: | ||
| # netplan apply | # netplan apply | ||
| </code> | </code> | ||
| - | === systemd-resolved === | + | |
| + | === Отключение Netpaln === | ||
| + | |||
| + | * [[https://linuxconfig.org/how-to-switch-back-networking-to-etc-network-interfaces-on-ubuntu-20-04-focal-fossa-linux|How to switch back networking to /etc/network/interfaces on Ubuntu 20.04 Focal Fossa Linux]] | ||
| + | |||
| + | <code> | ||
| + | # apt install ifupdown net-tools | ||
| + | |||
| + | ubuntu20/22# rm /etc/netplan/00-installer-config.yaml | ||
| + | |||
| + | ubuntu24# rm /etc/netplan/50-cloud-init.yaml | ||
| + | </code> | ||
| + | |||
| + | === Настройка systemd-resolved === | ||
| * [[https://wiki.archlinux.org/title/Systemd-resolved_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)|archlinux systemd-resolved (Русский)]] | * [[https://wiki.archlinux.org/title/Systemd-resolved_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)|archlinux systemd-resolved (Русский)]] | ||
| Line 280: | Line 310: | ||
| </code> | </code> | ||
| - | === Без Netpaln === | + | === Отключение systemd-resolved === |
| - | * [[https://linuxconfig.org/how-to-switch-back-networking-to-etc-network-interfaces-on-ubuntu-20-04-focal-fossa-linux|How to switch back networking to /etc/network/interfaces on Ubuntu 20.04 Focal Fossa Linux]] | + | * [[https://gist.github.com/zoilomora/f7d264cefbb589f3f1b1fc2cea2c844c|How to disable systemd-resolved in Ubuntu]] |
| <code> | <code> | ||
| - | # apt install ifupdown net-tools | + | # systemctl disable systemd-resolved |
| - | # echo 'network: {config: disabled}' > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg | ||
| - | |||
| - | ubuntu18# rm /etc/netplan/50-cloud-init.yaml | ||
| - | |||
| - | ubuntu20# rm /etc/netplan/00-installer-config.yaml | ||
| - | </code> | ||
| - | |||
| - | === Без systemd-resolved === | ||
| - | * [[https://gist.github.com/zoilomora/f7d264cefbb589f3f1b1fc2cea2c844c|How to disable systemd-resolved in Ubuntu]] | ||
| - | |||
| - | <code> | ||
| - | # systemctl disable systemd-resolved.service | ||
| # systemctl stop systemd-resolved | # systemctl stop systemd-resolved | ||
| # rm /etc/resolv.conf # this is link | # rm /etc/resolv.conf # this is link | ||
| </code> | </code> | ||
| + | |||
| ==== Файлы конфигурации CentOS/SL/RHEL ==== | ==== Файлы конфигурации CentOS/SL/RHEL ==== | ||
| Line 353: | Line 372: | ||
| # ifup enp0s3 | # ifup enp0s3 | ||
| </code> | </code> | ||
| + | |||
| + | ==== Файлы конфигурации Alma Linux ==== | ||
| + | |||
| + | * [[https://serverspace.ru/support/help/nastrojka-seti-dlya-alma-linux/|Настройка сети для Alma Linux]] | ||
| ==== Файлы конфигурации Gentoo ==== | ==== Файлы конфигурации Gentoo ==== | ||
| Line 401: | Line 424: | ||
| # cat /etc/network/interfaces | # cat /etc/network/interfaces | ||
| </code><code> | </code><code> | ||
| - | ... | + | auto lo |
| + | iface lo inet loopback | ||
| iface eth0 inet manual | iface eth0 inet manual | ||