V
V
Vincent12021-04-11 23:59:16
linux
Vincent1, 2021-04-11 23:59:16

How to set up routing for multiple ipv6 tunnels?

The task is to set up several concurrent ipv6 tunnels.
making tunnel 1

ip tunnel add v6-1 mode sit remote 209.51.161.14 local 45.139.184.150 ttl 255
ip link set v6-1 up
ip -6 addr add 2001:470:8a87:1111:1111:1111:1111:1111 dev v6-1
ip -6 route add ::/0 dev v6-1 metric 1


making tunnel 2

ip tunnel add v6-2 mode sit remote 184.105.250.46 local 185.230.140.161 ttl 255
ip link set v6-2 up
ip -6 addr add 2001:470:411c:2222:2222:2222:2222:2222 dev v6-2
ip -6 route add ::/0 dev v6-2 metric 2


I check it like this: it
works: curl -k --interface v6-1 " https://whatismyv6.com/ "
it works: curl -k --interface v6-2 " https://whatismyv6.com/ "

Then I check it like this:

it works : curl -k --interface 2001:470:8a87:1111:1111:1111:1111:1111 " https://whatismyv6.com/ "
Not working: curl -k --interface 2001:470:411c:2222:2222 :2222:2222:2222 " https://whatismyv6.com/ "

How can I make requests freely specifying the address for the v6-2 interface, just like for v6-1?
Well, the last check does not work because the default route with a lower metric priority is what I already understood. Then I tried to configure everything through ip rule, but I couldn’t even start because I couldn’t add the route to the new table.

route -nA inet6
[email protected]:~# route -nA inet6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
::1/128                        ::                         U    256 1     0 lo
2001:470:411c:2222:2222:2222:2222:2222/128 ::                         Un   256 1     0 v6-2
2001:470:8a87:1111:1111:1111:1111:1111/128 ::                         Un   256 1     0 v6-1
fe80::/64                      ::                         U    256 1     0 eth0
fe80::/64                      ::                         Un   256 1     0 v6-1
fe80::/64                      ::                         Un   256 1     0 v6-2
::/0                           ::                         U    1   2    52 v6-1
::/0                           ::                         U    2   2     1 v6-2
::1/128                        ::                         Un   0   3    16 lo
2001:470:411c:2222:2222:2222:2222:2222/128 ::                         Un   0   3    17 v6-2
2001:470:8a87:1111:1111:1111:1111:1111/128 ::                         Un   0   3    15 v6-1
fe80::2d8b:b896/128            ::                         Un   0   2     0 v6-1
fe80::b9e6:8ca1/128            ::                         Un   0   2     0 v6-2
fe80::5054:ff:fe51:e932/128    ::                         Un   0   2     0 eth0
ff00::/8                       ::                         U    256 2    10 eth0
ff00::/8                       ::                         U    256 1     0 v6-1
ff00::/8                       ::                         U    256 1     0 v6-2
::/0                           ::                         !n   -1  1     1 lo


ifconfig
[email protected]:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 45.139.184.150  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::5054:ff:fe51:e932  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:51:e9:32  txqueuelen 1000  (Ethernet)
        RX packets 2446  bytes 220457 (220.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 555  bytes 89861 (89.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 185.230.140.161  netmask 255.255.255.255  broadcast 185.230.140.161
        ether 52:54:00:51:e9:32  txqueuelen 1000  (Ethernet)

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 554  bytes 59163 (59.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 554  bytes 59163 (59.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

v6-1: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        inet6 fe80::2d8b:b896  prefixlen 64  scopeid 0x20<link>
        inet6 2001:470:8a87:1111:1111:1111:1111:1111  prefixlen 128  scopeid 0x0<global>
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 38  bytes 24661 (24.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83  bytes 8274 (8.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

v6-2: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        inet6 2001:470:411c:2222:2222:2222:2222:2222  prefixlen 128  scopeid 0x0<global>
        inet6 fe80::b9e6:8ca1  prefixlen 64  scopeid 0x20<link>
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 25  bytes 8175 (8.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 1449 (1.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0



I also tried doing this:
[email protected]:~# ip -6 route add default via 2001:470:39:1da::1 dev v6-1 table ipv6route-1
RTNETLINK answers: No route to host

2001:470:39:1da::1 is the gateway
Why is there an error here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
none7, 2021-04-12
@Vincent1

Because there is no route for 2001:470:39:1da::1. What for to you to specify the address of the gateway? The 6in4(sit) protocol does not provide for any physical addresses. And via only makes sense for 6to4, 6rd. In this case, the interface is created with remote any, and in the route via the gateway address is specified in the ::192.88.99.1 style, or an analogue of the ipv4 address in the 6to4, 6rd formats.
The IPv6 tunnel gateway address is only needed for pings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question