Tunele w systemie Linux

IPIP

Utworzenie:

ip tunnel add tunnel1 mode ipip remote 1.2.3.4 local 4.3.2.1

Czasem trzeba zmodyfikować MTU – w zależności czy po którejś stronie jest mniejsze to trzeba dostosować po obu strona te same:

ifconfig tunnel1 mtu 1434 up

Nadanie adresu:

ip a a 10.0.15.85/30 dev tunnel1

Usunięcie tunelu:

ip tunnel del tunnel1

Wpis w firewall Nftables:

table ip global {
...
 chain INPUT {
...
  ip saddr 1.2.3.4 meta l4proto 94 counter accept
...
 }
...
}

Konfiguracja w systemie Debian w pliku /etc/network/interfaces:

auto tunnel1
iface tunnel1 inet static
        address 10.0.15.85/30
        pre-up /sbin/ip tunnel add tunnel1 mode ipip remote 1.2.3.4 local 4.3.2.1
        up ifconfig tunnel1 mtu 1434 up
        post-down /sbin/ip tunnel del tunnel1

GRE

Utworzenie:

ip tunnel add tunnel1 mode gre remote 1.2.3.4 local 4.3.2.1

Czasem trzeba zmodyfikować MTU – w zależności czy po którejś stronie jest mniejsze to trzeba dostosować po obu strona te same:

ifconfig tunnel1 mtu 1434 up

Nadanie adresu:

ip a a 10.0.15.85/30 dev tunnel1

Usunięcie tunelu:

ip tunnel del tunnel1

Wpis w firewall Nftables:

table ip global {
...
 chain INPUT {
...
  ip saddr 1.2.3.4 meta l4proto 47 counter accept
...
 }
...
}

Konfiguracja w systemie Debian w pliku /etc/network/interfaces:

auto tunnel1
iface tunnel1 inet static
        address 10.0.15.85/30
        pre-up /sbin/ip tunnel add tunnel1 mode gre remote 1.2.3.4 local 4.3.2.1 ttl 255
        up ifconfig tunnel1 mtu 1434 up
        post-down /sbin/ip tunnel del tunnel1

Opublikowano:

Ostatni modyfikacja: