1

Расширение диапазона портов

Тема: Расширение диапазона портов

В связи с увеличением количества поддерживаемого оборудования возникла необходимость расширить диапазон открытых портов на серверах с Wialon Local.
Для этого откройте порты с 20100 до 30000 (ранее стандартный диапазон портов - с 20100 до 21999) в правилах iptables.

Если используете стандартную конфигурацию iptables, то в файле /etc/iptables/rules.v4 замените строки:

-A INPUT -p udp -m state --state NEW -m udp --dport 20100:21999 -m comment --comment "HW ports" -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20100:21999 -m comment --comment "HW ports" -j ACCEPT

на строки:

-A INPUT -p udp -m state --state NEW -m udp --dport 20100:30000 -m comment --comment "HW ports" -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20100:30000 -m comment --comment "HW ports" -j ACCEPT

То же можно сделать одной командой:

sed -i 's/21999/30000/' /etc/iptables/rules.v4

Далее выполните:

iptables-restore < /etc/iptables/rules.v4
Wialon Local Expert
2

Расширение диапазона портов

(16/06/2020 13:05:34 отредактировано overseer)

Re: Расширение диапазона портов

Для nftables (кто уже перешел):

> nano /etc/nftables.conf

ct state new udp dport 20100-30000 counter accept comment "HW ports"
ct state new tcp dport 20100-30000 counter accept comment "HW ports"

> nft -f /etc/nftables.conf

С уважением, команда Overseer.
Киев, Черкассы, Винница.
http://overseer.ua
3

Расширение диапазона портов

Re: Расширение диапазона портов

Может кто-нибудь выложить полный /etc/nftables.conf, пожалуйста.
На днях апгрейдил систему до 10, nftables так же установился. Но, вышеуказанный конфиг следующего вида:

#!/usr/sbin/nft -f

flush ruleset

table inet filter {
        chain input {
                type filter hook input priority 0;
        }
        chain forward {
                type filter hook forward priority 0;
        }
        chain output {
                type filter hook output priority 0;
        }
}

, т.е., по факту дефолтный.
Однако, nft list table ip filter выдает список

table ip filter {
        chain INPUT {
                type filter hook input priority 0; policy accept;
                meta l4proto tcp tcp dport 22 counter packets 42588 bytes 4655600 jump f2b-sshd
                meta l4proto udp ct state new udp dport 20100-22999 counter packets 19 bytes 4974 accept
                meta l4proto tcp ct state new tcp dport 20100-22999 counter packets 884038 bytes 51756799 accept
                meta l4proto tcp ct state new tcp dport 80 counter packets 231694 bytes 13143522 accept
                meta l4proto tcp ct state new tcp dport 8080 counter packets 854 bytes 46700 accept
                ct state related,established counter packets 121358130 bytes 47755094543 accept
                meta l4proto icmp counter packets 2466 bytes 177408 accept
                iifname "lo" counter packets 7314466 bytes 438867740 accept
                meta l4proto tcp ct state new tcp dport 22 counter packets 2754 bytes 156756 accept
                counter packets 88545 bytes 5644321 reject with icmp type host-prohibited
        }

        chain FORWARD {
                type filter hook forward priority 0; policy accept;
                counter packets 0 bytes 0 reject with icmp type host-prohibited
        }

        chain OUTPUT {
                type filter hook output priority 0; policy accept;
        }

        chain f2b-sshd {
                counter packets 33769 bytes 3938312 return
        }
}

, что означает, правила имеются.
Сохранились файлы rules.v4 и rules.v6. Из них загружены были?

4

Расширение диапазона портов

Re: Расширение диапазона портов

Вдруг, кому понадобится:

table ip filter {
    chain INPUT {
        type filter hook input priority 0; policy accept;
        meta l4proto tcp ct state new tcp dport 22 counter packets 1 bytes 60 accept comment "SSH"
        meta l4proto tcp ct state new tcp dport 80 counter packets 0 bytes 0 accept comment "HTTP"
        meta l4proto tcp ct state new tcp dport 443 counter packets 0 bytes 0 accept comment "HTTPS"
        meta l4proto tcp ct state new tcp dport 8024 counter packets 0 bytes 0 accept comment "HTTP Wialon CMS port"
        meta l4proto tcp ct state new tcp dport 8025 counter packets 0 bytes 0 accept comment "HTTP Wialon monitoring interface port"
        meta l4proto tcp ct state new tcp dport 8080 counter packets 0 bytes 0 accept comment "HTTP alternative"
        meta l4proto udp ct state new udp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        meta l4proto tcp ct state new tcp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        meta l4proto tcp ct state new tcp dport 32001 counter packets 0 bytes 0 accept comment "Backup port"
        ct state related,established counter packets 1575 bytes 379902 accept
        meta l4proto icmp counter packets 0 bytes 0 accept
        iifname "lo" counter packets 1 bytes 60 accept
        counter packets 207 bytes 70347 reject with icmp type host-prohibited
        ct state new tcp dport ssh counter packets 0 bytes 0 accept comment "SSH"
        ct state new tcp dport http counter packets 0 bytes 0 accept comment "HTTP"
        ct state new tcp dport https counter packets 0 bytes 0 accept comment "HTTPS"
        ct state new tcp dport 8024 counter packets 0 bytes 0 accept comment "HTTP Wialon CMS port"
        ct state new tcp dport 8025 counter packets 0 bytes 0 accept comment "HTTP Wialon monitoring interface port"
        ct state new tcp dport http-alt counter packets 0 bytes 0 accept comment "HTTP alternative"
        ct state new udp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        ct state new tcp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        ct state new tcp dport 32001 counter packets 0 bytes 0 accept comment "Backup port"
        ct state established,related counter packets 0 bytes 0 accept
        ip protocol icmp counter packets 0 bytes 0 accept
        iifname "lo" counter packets 0 bytes 0 accept
        counter packets 0 bytes 0 reject with icmp type host-prohibited
        ct state new tcp dport ssh counter packets 0 bytes 0 accept comment "SSH"
        ct state new tcp dport http counter packets 0 bytes 0 accept comment "HTTP"
        ct state new tcp dport https counter packets 0 bytes 0 accept comment "HTTPS"
        ct state new tcp dport 8024 counter packets 0 bytes 0 accept comment "HTTP Wialon CMS port"
        ct state new tcp dport 8025 counter packets 0 bytes 0 accept comment "HTTP Wialon monitoring interface port"
        ct state new tcp dport http-alt counter packets 0 bytes 0 accept comment "HTTP alternative"
        ct state new udp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        ct state new tcp dport 20100-30000 counter packets 0 bytes 0 accept comment "HW ports"
        ct state new tcp dport 32001 counter packets 0 bytes 0 accept comment "Backup port"
        ct state established,related counter packets 0 bytes 0 accept
        ip protocol icmp counter packets 0 bytes 0 accept
        iifname "lo" counter packets 0 bytes 0 accept
        counter packets 0 bytes 0 reject with icmp type host-prohibited
    }

    chain FORWARD {
        type filter hook forward priority 0; policy accept;
        counter packets 0 bytes 0 reject with icmp type host-prohibited
        counter packets 0 bytes 0 reject with icmp type host-prohibited
        counter packets 0 bytes 0 reject with icmp type host-prohibited
    }

    chain OUTPUT {
        type filter hook output priority 0; policy accept;
    }
}