1 (edytowany przez viper_lasser 2024-02-09 19:24:12)

Temat: Problem z zestawieniem tunelu po gre-tap

Próbuję według tego opisu zestawić sobie tunel
http://blog.asiantuntijakaveri.fi/2012/ … built.html

Host A:

ip link add gretap0 type gretap local 172.31.0.1 remote 172.31.0.2
ip link set dev gretap0 up
ip link set dev eth1 up
brctl addbr br0
brctl addif br0 gretap0
brctl addif br0 eth1
ip addr add 10.10.10.1/24 dev br0
ip link set br0 up


Host B:

ip link add gretap0 type gretap local 172.31.0.2 remote 172.31.0.1
ip link set dev gretap0 up
ip link set dev eth1 up
brctl addbr br0
brctl addif br0 gretap0
brctl addif br0 eth1
ip addr add 10.10.10.2/24 dev br0
ip link set br0 up

Niestety już przy pierwszym poleceniu jest problem

root@OpenWrt:~# ip link add gretap0 type gretap local 172.31.0.1 remote 172.31.0.2
RTNETLINK answers: File exists
root@OpenWrt:~#

Koniecznie chcę zrobić za pomocą skryptu bo chcę okresowo włączać ten tunel.

2

Odp: Problem z zestawieniem tunelu po gre-tap

zrób ifconfig -a i zobaczy czy czasami gretap0 już nie istnieje.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3 (edytowany przez viper_lasser 2024-02-09 19:35:09)

Odp: Problem z zestawieniem tunelu po gre-tap

Jest tylko skąd ? W jaki sposób się zrobił jak nie mam tego w /etc/config/network ?

Wykonałem co prawda cały skrypt ze wspomnianej wcześniej strony ale sypnął błędami.

root@OpenWrt:~# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          inet6 addr: fd65:fb2b:9f06::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2051 errors:0 dropped:0 overruns:0 frame:0
          TX packets:144 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:94346 (92.1 KiB)  TX bytes:41221 (40.2 KiB)

br0       Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet addr:10.10.10.2  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1186 (1.1 KiB)

erspan0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1450  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:9781 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1896 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1605090 (1.5 MiB)  TX bytes:392254 (383.0 KiB)
          Interrupt:17

gre0      Link encap:UNSPEC  HWaddr 00-00-00-00-9E-C8-00-00-00-00-00-00-00-00-00                                             -00
          NOARP  MTU:1476  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

gretap0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1462  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6gre0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                                             -00
          NOARP  MTU:1448  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                                             -00
          NOARP  MTU:1452  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan1      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan2      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan3      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:579 errors:0 dropped:530 overruns:0 frame:0
          TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:169863 (165.8 KiB)  TX bytes:40965 (40.0 KiB)

lan4      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2010 errors:0 dropped:0 overruns:0 frame:0
          TX packets:144 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:92535 (90.3 KiB)  TX bytes:41221 (40.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:97 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8762 (8.5 KiB)  TX bytes:8762 (8.5 KiB)

wan       Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C9
          inet addr:192.168.1.17  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe5d:9ec9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7192 errors:0 dropped:431 overruns:0 frame:0
          TX packets:1577 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1166634 (1.1 MiB)  TX bytes:289748 (282.9 KiB)

wlan0     Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2192 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:203211 (198.4 KiB)

wlan1     Link encap:Ethernet  HWaddr B0:39:56:5D:9E:CC
          inet6 addr: fe80::b239:56ff:fe5d:9ecc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:202863 (198.1 KiB)

root@OpenWrt:~#

root@OpenWrt:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'fd65:fb2b:9f06::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.10.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

4

Odp: Problem z zestawieniem tunelu po gre-tap

Domyślnie się robi, więc ty zrób na gretap1

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Problem z zestawieniem tunelu po gre-tap

gretap można zrobić w pliku /etc/config/network.
on się wtedy nazywa  gre4t-* 
*)nazwa jaką sobie nadamy w sekcji konfiguracyjnej

Xiaomi AX3000T @ Netgear R6220
* DVBT2 - T230C *

6

Odp: Problem z zestawieniem tunelu po gre-tap

Można, tylko on nie chce smile

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: Problem z zestawieniem tunelu po gre-tap

Na obu działających routerach mam vpn'a n2n. Chcę tylko zejść do warstwy 2.
Czy poprzez gre-tap to dobry pomysł ?

http://h-wrt.com/en/mini-how-to/gretun

8 (edytowany przez mar_w 2024-02-09 20:13:17)

Odp: Problem z zestawieniem tunelu po gre-tap

może i dobry. można przez polecenia a można tradycyjnie w pliku.
poradnik z nazwy wychodzi że jest do gretun a nie gretap
gretun to L3

Xiaomi AX3000T @ Netgear R6220
* DVBT2 - T230C *

9

Odp: Problem z zestawieniem tunelu po gre-tap

Racja
Znalazłem odpowiednik pod wireguarda
https://notes.superlogical.ch/pages/note_wg/nolayer2/

Przykładowo jeśli u mnie n2n nr 1 jest na routerze z openwrt 22.03 i ma adres 10.1.2.75.
Na tym routerze jest podsieć 192.168.10.0/24

Drugi n2n to mój komputer 10.1.2.94 z windowsem. Czy na routerze zadziała taki skrypt ?

ip link add gretap1 type gretap local 10.1.2.75 remote 10.1.2.94
ip link set dev gretap1 up
ip link set dev eth0 up
brctl addbr br0
brctl addif br0 gretap1
brctl addif br0 eth0
#ip addr add 10.10.10.2/24 dev br0
ip link set br0 up

Czy po stronie windowsa idzie to zrobić jakoś z automatu czy jednak trzeba tworzyć ręcznie most ?

10

Odp: Problem z zestawieniem tunelu po gre-tap

Próbuję jeszcze interfejs ale system uparcie twierdzi że tunel0 istnieje.
root@OpenWrt:~# ip link add tunel0 type gretap local 10.1.2.75 remote 10.1.2.74
ip: RTNETLINK answers: File exists
root@OpenWrt:~# ifconfig -a | grep *tunel0*
root@OpenWrt:~# ifdown tunel0
Interface tunel0 not found
root@OpenWrt:~#

Na drugim routerze z Openwrt 22.03 (identyczny router) przechodzi to bez problemu oczywiście adresy dla local i remote zamieniłem.

11 (edytowany przez mar_w 2024-02-09 23:04:47)

Odp: Problem z zestawieniem tunelu po gre-tap

zainstaluj ip-full

albo dodaj na końcu dev [nazwa interfejsu] do którego przypięty jest adres n2n

 ip link add tunel0 type gretap local 10.1.2.75 remote 10.1.2.74 dev [n2n] 
Xiaomi AX3000T @ Netgear R6220
* DVBT2 - T230C *

12 (edytowany przez viper_lasser 2024-02-09 23:16:35)

Odp: Problem z zestawieniem tunelu po gre-tap

@mar_w: Dzięki. Poszło
Po drugiej stronie n2n mam windowsa (10.1.2.94)

W jaki sposób mogę przełożyć polecenia linuksowe na windowsa ?

ip link add gretap1 type gretap local 10.1.2.94 remote 10.1.2.75
ip link set dev gretap1 up
ip link set dev eth0 up
brctl addbr br0
brctl addif br0 gretap1
brctl addif br0 eth0 # to chyba nie potrzebne bo mi na openwrt nie działało
ip link set br0 up

Czy lepiej zadziałać na wsl2 pod windowsem czy jednak podłączyć się do drugiego routera z n2n'em i wykonać podobny skrypt ?

Docelowo chcę się dostać po L2 po stronie zdalnego routera z n2n 10.1.2.75 żeby wykryć urządzenia siemensa (sterowniki i moduły plc) które nie mają przypisanych adresów IP.

13 (edytowany przez mar_w 2024-02-09 23:40:40)

Odp: Problem z zestawieniem tunelu po gre-tap

tylko że sterowniki bez adresu są w sieci LAN powiedzmy 192.168.3.0/24 a Ty chcesz z kompa w sieci 192.168.1.0/24 widzieć te sterowniki ?
musisz być w jednym dużym bridgu, żeby broadcast przeszedł do jakiś tam hostów podpiętych do switcha.

gretap zestawisz między router1 - router2 i jeden z nich może być serwerem DHCP a drugi klientem DHCP i ten drugi dostanie adres IP od pierwszego ale żeby hosty w LAN2 dostały IP to muszą być w moście z tym gretap-em
to był taki przykład do zastanowienia...

Xiaomi AX3000T @ Netgear R6220
* DVBT2 - T230C *

14 (edytowany przez viper_lasser 2024-02-10 12:00:28)

Odp: Problem z zestawieniem tunelu po gre-tap

Router 1 to router do którego podpięty jest komputer z windowsem
Router 2 to router do którego podpięte są sterowniki plc


Konfiguracja routera 1

/etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'fdfb:bf2f:af48::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.11.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'n2n'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '10.1.2.190'
        option device 'edge0'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

W pliku /etc/config/dhcp dodałem opcję wyłączenia tego interfejsu z dhcp na wzór wanu ale coś chyba nie działa

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

        option ignore '1'

Konfiguracja routera 2 do którego podpięte są sterowniki

/etc/config/network
config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'fd65:fb2b:9f06::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.10.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'n2n'
        option device 'edge0'
        option proto 'static'
        option ipaddr '10.1.2.75'
        option netmask '255.255.255.0'

#config interface 'hosta'
#       option proto 'gretap'
#       option zone 'tunnels'
#       option peeraddr '10.1.2.74'
#       option tunlink 'eth0'

#config interface 'hosta_addr'
#       option proto 'static'
#       option ipaddr '192.168.10.1'
#       option netmask '255.255.255.0'
#       option device '@hosta'

config interface 'wan'
        option device 'wan'

Tutaj w dhcp nic nie zmieniałem

W jaki sposób mogę sprawdzić czy zestawiony jest most pomiędzy tymi 2 routerami ?
Czego może mi jeszcze brakować żeby zejść do warstwy 2 ?
Docelowo chcę żeby zadziałał ten protokół
https://profinetuniversity.com/naming-a … finet-dcp/

Edit:
Zapomniałem dopisać jeszcze w jaki sposób zestawiam tunele.

Router 1

ip link add gretap1 type gretap local 10.1.2.190 remote 10.1.2.75
ip link set dev gretap1 up
ip link set dev eth0 up
brctl addbr br0
brctl addif br0 gretap1
brctl addif br0 eth0
#ip addr add 10.10.10.2/24 dev br0
ip link set br0 up

Nie wiem czemu ale nie działa dołączenie karty eth0 do mostu.

brctl addif br0 eth0
brctl: bridge br0: Invalid argument



Router 2

ip link add gretap1 type gretap local 10.1.2.75 remote 10.1.2.190
ip link set dev gretap1 up
ip link set dev eth0 up
brctl addbr br0
brctl addif br0 gretap1
brctl addif br0 eth0
#ip addr add 10.10.10.2/24 dev br0
ip link set br0 up

Na 1 i 2 routerze po uruchomieniu skryptów widać ten nowy most br0

root@openwrt:~# ifconfig
br-lan    Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          inet addr:192.168.11.1  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fdfb:bf2f:af48::1/60 Scope:Global
          inet6 addr: fe80::b239:56ff:fe53:dbe8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6877 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5292 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1298381 (1.2 MiB)  TX bytes:3929093 (3.7 MiB)

br0       Link encap:Ethernet  HWaddr 6A:87:E5:3B:4E:AC
          inet6 addr: fe80::6887:e5ff:fe3b:4eac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:934 (934.0 B)

edge0     Link encap:Ethernet  HWaddr 1A:4C:E9:8F:C9:7C
          inet addr:10.1.2.190  Bcast:10.1.2.255  Mask:255.255.255.0
          inet6 addr: fe80::184c:e9ff:fe8f:c97c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1400  Metric:1
          RX packets:243 errors:0 dropped:42 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:60577 (59.1 KiB)  TX bytes:3324 (3.2 KiB)

eth0      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          inet6 addr: fe80::b239:56ff:fe53:dbe8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:14592 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12194 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5808079 (5.5 MiB)  TX bytes:5341819 (5.0 MiB)
          Interrupt:17

gretap1   Link encap:Ethernet  HWaddr 6A:87:E5:3B:4E:AC
          inet6 addr: fe80::6887:e5ff:fe3b:4eac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1456 (1.4 KiB)

lan1      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7193 errors:0 dropped:104 overruns:0 frame:0
          TX packets:5298 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1334393 (1.2 MiB)  TX bytes:3929609 (3.7 MiB)

lan2      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan3      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan4      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:63 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5651 (5.5 KiB)  TX bytes:5651 (5.5 KiB)

wan       Link encap:Ethernet  HWaddr B0:39:56:53:DB:E9
          inet addr:192.168.100.41  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe53:dbe9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7399 errors:0 dropped:103 overruns:0 frame:0
          TX packets:5997 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4211030 (4.0 MiB)  TX bytes:1250163 (1.1 MiB)

15 (edytowany przez viper_lasser 2024-02-10 18:03:49)

Odp: Problem z zestawieniem tunelu po gre-tap

Mam zaktualizowane skrypty do tworzenia bridge'a gre z lan'em.

Dla routera 1

ip link add grelan0 type gretap local 10.1.2.190 remote 10.1.2.75
ip link set dev grelan0 up
brctl addif br-lan grelan0

Dla routera 2 - analogicznie

ip link add grelan0 type gretap local 10.1.2.75 remote 10.1.2.190
ip link set dev grelan0 up
brctl addif br-lan grelan0

Router 1

root@OpenWrt:~# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          inet addr:192.168.11.1  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe53:dbe8/64 Scope:Link
          inet6 addr: fdfb:bf2f:af48::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3174 (3.0 KiB)  TX bytes:2276 (2.2 KiB)

edge0     Link encap:Ethernet  HWaddr 8E:77:B1:9B:5E:7D
          inet addr:10.1.2.190  Bcast:10.1.2.255  Mask:255.255.255.0
          inet6 addr: fe80::8c77:b1ff:fe9b:5e7d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1400  Metric:1
          RX packets:2866 errors:0 dropped:274 overruns:0 frame:0
          TX packets:747 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:482450 (471.1 KiB)  TX bytes:215236 (210.1 KiB)

erspan0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1450  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          inet6 addr: fe80::b239:56ff:fe53:dbe8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:5660 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1866 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1240286 (1.1 MiB)  TX bytes:491366 (479.8 KiB)
          Interrupt:17

gre0      Link encap:UNSPEC  HWaddr 00-00-00-00-DB-E8-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1476  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

grelan0   Link encap:Ethernet  HWaddr C2:E5:D2:51:E5:EB
          inet6 addr: fe80::c0e5:d2ff:fe51:e5eb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:96 errors:0 dropped:44 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11822 (11.5 KiB)  TX bytes:2728 (2.6 KiB)

gretap0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1462  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6gre0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1448  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1452  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan1      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan2      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan3      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan4      Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:57 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5363 (5.2 KiB)  TX bytes:5363 (5.2 KiB)

wan       Link encap:Ethernet  HWaddr B0:39:56:53:DB:E9
          inet addr:192.168.3.7  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe53:dbe9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5660 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1848 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1138406 (1.0 MiB)  TX bytes:470138 (459.1 KiB)

wlan0     Link encap:Ethernet  HWaddr B0:39:56:53:DB:E8
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan1     Link encap:Ethernet  HWaddr B0:39:56:53:DB:EC
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@OpenWrt:~#

Router 2

root@OpenWrt:~# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          inet6 addr: fd65:fb2b:9f06::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:1002 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1211 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1136850 (1.0 MiB)  TX bytes:99172 (96.8 KiB)

edge0     Link encap:Ethernet  HWaddr 8E:38:BE:06:72:28
          inet addr:10.1.2.75  Bcast:10.1.2.255  Mask:255.255.255.0
          inet6 addr: fe80::8c38:beff:fe06:7228/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1400  Metric:1
          RX packets:2256 errors:0 dropped:93 overruns:0 frame:0
          TX packets:1571 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:239700 (234.0 KiB)  TX bytes:1250636 (1.1 MiB)

erspan0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1450  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1504  Metric:1
          RX packets:7776 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3772 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2417135 (2.3 MiB)  TX bytes:1764971 (1.6 MiB)
          Interrupt:17

gre0      Link encap:UNSPEC  HWaddr 00-00-00-00-9E-C8-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1476  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

grelan0   Link encap:Ethernet  HWaddr 5A:81:CC:56:51:B0
          inet6 addr: fe80::5881:ccff:fe56:51b0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1362  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:348 (348.0 B)  TX bytes:9636 (9.4 KiB)

gretap0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          BROADCAST MULTICAST  MTU:1462  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6gre0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1448  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:1452  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan1      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan2      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:344 errors:0 dropped:309 overruns:0 frame:0
          TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:97270 (94.9 KiB)  TX bytes:38487 (37.5 KiB)

lan3      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:323 errors:0 dropped:309 overruns:0 frame:0
          TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:98288 (95.9 KiB)  TX bytes:38487 (37.5 KiB)

lan4      Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1094 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1213 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1140155 (1.0 MiB)  TX bytes:99520 (97.1 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:86 errors:0 dropped:0 overruns:0 frame:0
          TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7905 (7.7 KiB)  TX bytes:7905 (7.7 KiB)

wan       Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C9
          inet addr:192.168.1.17  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::b239:56ff:fe5d:9ec9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6015 errors:0 dropped:250 overruns:0 frame:0
          TX packets:2325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:941454 (919.3 KiB)  TX bytes:1548895 (1.4 MiB)

wlan0     Link encap:Ethernet  HWaddr B0:39:56:5D:9E:C8
          inet6 addr: fe80::b239:56ff:fe5d:9ec8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:151 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:43675 (42.6 KiB)

wlan1     Link encap:Ethernet  HWaddr B0:39:56:5D:9E:CC
          inet6 addr: fe80::b239:56ff:fe5d:9ecc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:150 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:43483 (42.4 KiB)

root@OpenWrt:~#

Nie wiem dlaczego dla routera 1 w interfejsie grelan0 jest tyle odrzuconych pakietów a dla routera 2 prawie nie widać ruchu przychodzącego. RX = 2

Czy trzeba jeszcze coś zmienić w firewallu ?

Edit:
Podłączyłem się bezpośrednio do tego routera 1 w którym jest wyłączony dhcp i automatycznie dostałem adresację dla karty lan z routera 2 i mogę wykrywać sterowniki.
Potestuję jeszcze trochę czy wszystko gra.
@mar_w i @Cezary: Dziękuję za pomoc smile