LINUX.ORG.RU
ФорумAdmin

Убунте GRE, а она в ответ ICMP protocol 47 port *** unreachable

 , ,


0

1

Пытаюсь поднять GRE между роутером и Ubuntu 20

С роутера GRE пакеты улетают, а сервак отвечает анричибл.(логи с сервера) На роутере тоже тоже видно что пакеты по 3 gre\icmp прилетают\улетают.

tcpdump

13:14:41.894242 IP mikrotik > Ubuntu20: GREv0, length 141: IP mikrotik_gre.5678 > 255.255.255.255.5678: UDP, length 109

13:14:41.894284 IP Ubuntu20 > mikrotik: ICMP Ubuntu20 protocol 47 port 2048 unreachable, length 169

13:14:41.894965 IP mikrotik > Ubuntu20: GREv0, length 106: gre-proto-0x4

13:14:41.894977 IP Ubuntu20 > mikrotik: ICMP Ubuntu20 protocol 47 port 4 unreachable, length 134

13:14:41.894989 IP mikrotik > Ubuntu20: GREv0, length 122: gre-proto-0x88cc

13:14:41.894994 IP Ubuntu20 > mikrotik: ICMP Ubuntu20 protocol 47 port 35020 unreachable, length 150

ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 02:00:17:00:86:31 brd ff:ff:ff:ff:ff:ff
3: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/gre 0.0.0.0 brd 0.0.0.0
4: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
6: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/gre Ubuntu20 peer Mikrotik

sudo ufw status Status: inactive

ifconfig

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 10.0.0.3  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::17ff:fe00:8631  prefixlen 64  scopeid 0x20<link>
        ether 02:00:17:00:86:31  txqueuelen 1000  (Ethernet)
        RX packets 7146  bytes 2898696 (2.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8988  bytes 5897030 (5.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

gre1: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1476
        inet 192.168.255.254  netmask 255.255.255.0  destination 192.168.255.254  -Вот незнаю откуда это вылезло
        unspec 9E-65-C3-E6-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 6  dropped 0 overruns 0  carrier 6  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2256  bytes 246084 (246.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2256  bytes 246084 (246.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

netplan

network:
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: 02:00:17:00:86:31
            set-name: ens3
    version: 2
    tunnels:
        gre1:
            mode: gre
            local: Ubuntu20
            remote: Mikrotik
            mtu: 1476
            addresses: [192.168.255.254/24]

ip tunnel show

gre0: gre/ip remote any local any ttl inherit nopmtudisc
gre1: gre/ip remote mikrotik local ubuntu20 ttl inherit

Если пытаться пинговать с сервера роутер, то растёт счётчик carrier, пинги не проходят

iptables-save

# Generated by iptables-save v1.8.4 on Sat Jul 18 10:43:24 2020
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:InstanceServices - [0:0]
-A INPUT -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p udp -m udp --sport 123 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -j ACCEPT
-A OUTPUT -d 169.254.0.0/16 -j InstanceServices
-A InstanceServices -d 169.254.0.2/32 -p tcp -m owner --uid-owner 0 -m tcp --dpo                                                                                                                                   rt 3260 -m comment --comment "See the Oracle-Provided Images section in the Orac                                                                                                                                   le Cloud Infrastructure documentation for security impact of modifying or removi                                                                                                                                   ng this rule" -j ACCEPT
-A InstanceServices -d 169.254.2.0/24 -p tcp -m owner --uid-owner 0 -m tcp --dpo                                                                                                                                   rt 3260 -m comment --comment "See the Oracle-Provided Images section in the Orac                                                                                                                                   le Cloud Infrastructure documentation for security impact of modifying or removi                                                                                                                                   ng this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.2/32 -p tcp -m tcp --dport 80 -m comment --comm                                                                                                                                   ent "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure d                                                                                                                                   ocumentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 53 -m comment --                                                                                                                                   comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructu                                                                                                                                   re documentation for security impact of modifying or removing this rule" -j ACCE                                                                                                                                   PT
-A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 53 -m comment --                                                                                                                                   comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructu                                                                                                                                   re documentation for security impact of modifying or removing this rule" -j ACCE                                                                                                                                   PT
-A InstanceServices -d 169.254.0.3/32 -p tcp -m owner --uid-owner 0 -m tcp --dpo                                                                                                                                   rt 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle                                                                                                                                    Cloud Infrastructure documentation for security impact of modifying or removing                                                                                                                                    this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.4/32 -p tcp -m tcp --dport 80 -m comment --comm                                                                                                                                   ent "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure d                                                                                                                                   ocumentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -m comment --                                                                                                                                   comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructu                                                                                                                                   re documentation for security impact of modifying or removing this rule" -j ACCE                                                                                                                                   PT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 67 -m comment --                                                                                                                                   comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructu                                                                                                                                   re documentation for security impact of modifying or removing this rule" -j ACCE                                                                                                                                   PT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 69 -m comment --                                                                                                                                   comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructu                                                                                                                                   re documentation for security impact of modifying or removing this rule" -j ACCE                                                                                                                                   PT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 123 -m comment -                                                                                                                                   -comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastruct                                                                                                                                   ure documentation for security impact of modifying or removing this rule" -j ACC                                                                                                                                   EPT
-A InstanceServices -d 169.254.0.0/16 -p tcp -m tcp -m comment --comment "See th                                                                                                                                   e Oracle-Provided Images section in the Oracle Cloud Infrastructure documentatio                                                                                                                                   n for security impact of modifying or removing this rule" -j REJECT --reject-wit                                                                                                                                   h tcp-reset
-A InstanceServices -d 169.254.0.0/16 -p udp -m udp -m comment --comment "See th                                                                                                                                   e Oracle-Provided Images section in the Oracle Cloud Infrastructure documentatio                                                                                                                                   n for security impact of modifying or removing this rule" -j REJECT --reject-wit                                                                                                                                   h icmp-port-unreachable
COMMIT
# Completed on Sat Jul 18 10:43:24 2020


Последнее исправление: Lurker-beta (всего исправлений: 4)

Покажи выхлоп ip tunnel и iptables-save с Ubuntu(только оберни его в теги code, читать не возможно)

Pinkbyte ★★★★★
()
Ответ на: комментарий от Pinkbyte

ip tunnel show добавил в 1-й пост.

вместо iptables там sudo ufw status Status: inactive

Не нашёл тегов code, спойлер почему-то не сработал. Сделал как смог.

Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

вместо iptables там sudo ufw status Status: inactive

Отключенный ufw еще не означает что правила в Netfilter отсутствуют. Нужен выхлоп именно iptables-save

Pinkbyte ★★★★★
()
Ответ на: комментарий от Lurker-beta

Не нашёл тегов code, спойлер почему-то не сработал

сейчас по умолчанию разметка Markdown, code из LORCODE-разметки. можешь изменить в своём профиле разметку по-умолчанию. спойлер только для новостей. используй «Предпросмотр» до публикации.

anonymous
()
Ответ на: комментарий от anonymous

В смысле только для новостей? к сожалению похоже на lorcode уже написанный пост не переключить. Менюшка неактивна.

Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

В смысле только для новостей?

так указано в описании разметок:

Спойлер (cut) в ленте

Длинные тексты в новостях и галерее можно скрыть при помощи следующей разметки:
Спойлер (cut) в ленте

Парный тег [cut] для создания спойлера с целью сокращения занимаемого места на главной странице и в ленте.

к сожалению похоже на lorcode уже написанный пост не переключить.

естественно, использование машины времени всё ещё невозможно. менять тип разметки возможно только для новых или «текущих» сообщений. и только если по-умолчанию" тебе не удобно.

anonymous
()
Ответ на: комментарий от Lurker-beta

Что и требовалось доказать - в цепочке INPUT нет правила, разрешающего gre протокол(за номером 47). GRE-пакеты подпадают под последнее правило(-j REJECT --reject-with icmp-host-prohibited), поэтому ты и видишь соответствующее ICMP unreachable сообщение.

Если ты действительно хочешь полностью выключить файрвол, делай так:

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT

Это очистит правила файрвола до перезагрузки(или как минимум до рестарта скрипта, который тебе эти правила добавляет).

И еще:

inet 192.168.255.254  netmask 255.255.255.0  destination 192.168.255.254

это не очень нормально.

Покажи на всякий случай выхлоп:

ip -d addr show dev gre1

Pinkbyte ★★★★★
()
Последнее исправление: Pinkbyte (всего исправлений: 2)
Ответ на: комментарий от Pinkbyte

А разве по этому правилу проходить не должно? -A INPUT -j ACCEPT

самого удивляет destination 192.168.255.254 но ничего кроме жалоб на то, что ifconfig в некоторых случаях показывает неверную инфу не нашёл.

ip -d addr show dev gre1 6: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN group default qlen 1000 link/gre 158.101.195.230 peer 109.95.219.210 promiscuity 0 minmtu 0 maxmtu 0 gre remote mikrotik local ubuntu20 ttl inherit numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 inet 192.168.255.254/24 brd 192.168.255.255 scope global gre1 valid_lft forever preferred_lft forever

пошёл править iptables

Lurker-beta
() автор топика
Ответ на: комментарий от Pinkbyte

Не работает, всё так-же по 3 пакета туда и 3 обратно летает.

Generated by iptables-save v1.8.4 on Sat Jul 18 15:40:38 2020
*filter
:INPUT ACCEPT [6176:1018105]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [12126:4547377]
:InstanceServices - [0:0]
-A FORWARD -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A InstanceServices -d 169.254.0.2/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.2.0/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.2/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.3/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.4/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 67 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 69 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 123 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d 169.254.0.0/16 -p tcp -m tcp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with tcp-reset
-A InstanceServices -d 169.254.0.0/16 -p udp -m udp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Sat Jul 18 15:40:38 2020
Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

на каком интерфейсе сервера назначен ip-адрес, который прописан как local для gre туннеля там же?

Что говорит команда ip route get remote_address на сервере для адреса, который прописан как remote для gre туннеля?

Pinkbyte ★★★★★
()
Последнее исправление: Pinkbyte (всего исправлений: 1)
Ответ на: комментарий от Pinkbyte

IP адрес прописан только на самом туннеле. Разве его ещё где-то надо прописывать?

говорит remote_address via 10.0.0.1 dev ens3 src 10.0.0.3 uid 1001 cache

Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

IP адрес прописан только на самом туннеле. Разве его ещё где-то надо прописывать?

ээээ, что?

local и remote в свойствах туннеля - это не тоже самое, что адреса внутри туннеля. Это адреса соответственного С которого и НА который будет строиться туннель.

И если они у тебя в настройках совпадают с адресами на самом туннеле - то логично что ничего не работает.

говорит remote_address via 10.0.0.1 dev ens3 src 10.0.0.3 uid 1001 cache

local address на туннеле(не ВНУТРИ туннеля) у тебя 10.0.0.3 ?

Pinkbyte ★★★★★
()
Последнее исправление: Pinkbyte (всего исправлений: 2)
Ответ на: комментарий от Pinkbyte

Ваше разъяснение я понял. Собственно это и так понятно. Но я не могу понять изначальный вопрос.

Вот из 1-го поста

tunnels:
        gre1:
            mode: gre
            local: Ubuntu20 (158.101...)
            remote: Mikrotik (109.95...)
            mtu: 1476
            addresses: [192.168.255.254/24]

ТАК ДО МЕНЯ ДОШЛО.

В консоли управления VPS оракла указан внешний адрес сервера... я его и указывал как local. Но есть ньюанс. В интерфейсах сервера то я не вижу этого IPшника. Там только LAN-овский 10.0.0... Похоже там какой-то странный NAT, когда все прокинуто на 1 внутренний IP. Сейчас поменять local туннеля со стороны убунты на LANовский, посмотрю что будет.

Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

А я еще думал что меня смущало - видел же в одном из постов белый IP внешний который ты не затер, но в упор не видел его в списке ifconfig из темы

GRE с NAT-ом будет тяжко. Потому что если NAT не gre-aware, то ничего не взлетит. Если там 1-to-1 NAT на внутренний адрес для всех протоколов - тогда шансы есть

Pinkbyte ★★★★★
()
Последнее исправление: Pinkbyte (всего исправлений: 1)

iptables -I INPUT 1 -p 47 -j ACCEPT

zgen ★★★★★
()
Ответ на: комментарий от Pinkbyte

Ура, в качестве local прописал внутренний IP, ребутнулся и всё поднялось. Осталось: 0)потереть тут IP который спалил(где кнопка редактировать пост? куда делась?) 1)прописать NAT 2)прописать маршруты 3)найти список зароскомнадзоренных IP и впихнуть его в маршруты.(зачем потёрли статью на хабре?) 4)IPsec-нуть всё это дело. 5)Снести всё и настроить начисто. Но начало положено.

Lurker-beta
() автор топика
Ответ на: комментарий от Pinkbyte

Даже не знаю сюда писать вроде уже не по теме. Новые темы плодить тоже как-то не очень, вдруг вопрос простой. Прописал марштуры, настроил NAT. Только хотел сюда написать что всё работает… а оказалось не всё. Вот заметил что данный форум напрямую открывается, а через нидерланды нет. В какую сторону копать?

Lurker-beta
() автор топика
Ответ на: комментарий от anc

Спасибо, сейчас думал пока на работу шёл, такая же мысль появилась, хотя вроде MTU выставлял.

anonymous
()
Ответ на: комментарий от anc

Как оказалось pmtu в интернете не работает. Нужно ставить костыли в виде MSS https://www.opennet.ru/docs/RUS/LARTC/x2657.html

Решение проблемы: 0)проверить что у тебя стоят правильные MTU 1)iptables -A FORWARD -p tcp –tcp-flags SYN,RST SYN -j TCPMSS –clamp-mss-to-pmtu

Lurker-beta
() автор топика
Ответ на: комментарий от anc

Ну вы писали pmtu… я и пытался понять почему он не работает. Проверял настройки у себя. Вот если бы вы написали pmtu не работает, ищи обходные пути…

Lurker-beta
() автор топика
Ответ на: комментарий от Lurker-beta

Ну действительно извините, что не «разжевал». Думал будет понятно куда копать.
Но вы же накопали по этому запросу. Так что мне кажется всё хорошо :)

anc ★★★★★
()
Ответ на: комментарий от anc

Не по этому. Понял только когда снял лог tcpdump-ом и понял что мне летят большие пакеты, а от меня ICMP need fragment и только по этому нагуглил

Lurker-beta
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.