Hello everyone.
I have a routing problem from an LXC container.
After setting up a VPN, StrongSwan, it uses a particular table, routing table 220.
For information, Linux routing tables are configured in this file:
root@pve:~ $ cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
So, as I pointed out, Containers do not query table 220 (strongSwan).
I’ll run the procedure that makes me say this
So I have a Very StongSwan ESTABLISHED in which I declared my local and client networks :
root@bw: # swanctl --list-sas
home_orange-vps_de: #1, ESTABLISHED, IKEv2, 9ce0e73e646f3d4b_i* 366b768b639e3928_r
local 'bw.home.lab3w.fr' @ 172.16.0.1[4500]
remote 'vps.de.ipv10.net' @ 135.125.133.51[4500]
AES_CBC-256/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/CURVE_25519/KE1_KYBER_L3/KE2_BIKE_L3/KE3_HQC_L3/KE4_HQC_L5
established 505s ago, rekeying in 12598s
home_orange-vps_de: #5, reqid 1, INSTALLED, TUNNEL-in-UDP, ESP:AES_CBC-256/HMAC_SHA2_256_128/CURVE_25519/KE1_KYBER_L3/KE2_BIKE_L3/KE3_HQC_L3/KE4_HQC_L5
installed 172s ago, rekeying in 3082s, expires in 3788s
in cbe8b4cb, 10316 bytes, 61 packets, 9s ago
out c6432537, 11748 bytes, 81 packets, 12s ago
local fc01::10:126:42:0/112 fc01::172:16:0:0/104 fc01::192:168:0:0/104 fec2::/16
remote fc00:41d0:701:1100::/64 fc00:41d0:801:2000::/64 fec0::/16 fec1::/16
Below :
root@bw: # ip -6 route show
2a01:cb1d:2d4:8800:1ab3:1000::/84 dev vmbr1 proto kernel metric 256 pref medium
fc01::172:16:0:0/104 dev vmbr2 proto kernel metric 256 pref medium
fe80::/64 dev vmbr2 proto kernel metric 256 pref medium
fe80::/64 dev vmbr1 proto kernel metric 256 pref medium
fec2::/16 dev vmbr2 proto kernel metric 256 pref medium
default via fc01::172:16:0:254 dev vmbr2 metric 1024 onlink pref medium
root@bw: # ip -6 route show table 254
2a01:cb1d:2d4:8800:1ab3:1000::/84 dev vmbr1 proto kernel metric 256 pref medium
fc01::172:16:0:0/104 dev vmbr2 proto kernel metric 256 pref medium
fe80::/64 dev vmbr2 proto kernel metric 256 pref medium
fe80::/64 dev vmbr1 proto kernel metric 256 pref medium
fec2::/16 dev vmbr2 proto kernel metric 256 pref medium
default via fc01::172:16:0:254 dev vmbr2 metric 1024 onlink pref medium
Table 220 for StrongSwan :
root@bw: # ip -6 route show table 220
fc00:41d0:701:1100::/64 dev vmbr2 proto static src fec2::1 metric 1024 pref medium
fc00:41d0:801:2000::/64 dev vmbr2 proto static src fec2::1 metric 1024 pref medium
fec0::/16 dev vmbr2 proto static src fec2::1 metric 1024 pref medium
fec1::/16 dev vmbr2 proto static src fec2::1 metric 1024 pref medium
In this sense I can access my LXC container (quite normal).
root@bw: # ping6 fc00:41d0:701:1100::1
PING fc00:41d0:701:1100::1(fc00:41d0:701:1100::1) 56 data bytes
64 bytes from fc00:41d0:701:1100::1: icmp_seq=1 ttl=63 time=23.5 ms
64 bytes from fc00:41d0:701:1100::1: icmp_seq=2 ttl=63 time=22.6 ms
64 bytes from fc00:41d0:701:1100::1: icmp_seq=3 ttl=63 time=22.9 ms
64 bytes from fc00:41d0:701:1100::1: icmp_seq=4 ttl=63 time=23.7 ms
^C
--- fc00:41d0:701:1100::1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 22.552/23.165/23.700/0.449 ms
lun. sept. 30 05:16:41 root@bw:/var/pro/alibaba #
On the other hand, here is the symptom - on the machine “vps.de.ipv10” where I have a LinuX Containers :
root@vps-de:~ # ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether fa:16:3e:16:c6:f3 txqueuelen 1000 (Ethernet)
RX packets 302593055 bytes 124617335405 (116.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 332860140 bytes 70836308292 (65.9 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 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 (Boucle locale)
RX packets 1154 bytes 130694 (127.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1154 bytes 130694 (127.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vethlQV0nW: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc16:1fff:fe91:b2e prefixlen 64 scopeid 0x20<link>
ether fe:16:1f:91:0b:2e txqueuelen 1000 (Ethernet)
RX packets 97817321 bytes 24554228134 (22.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 113376348 bytes 13430510793 (12.5 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 135.125.133.51 netmask 255.255.255.0 broadcast 135.125.133.255
inet6 fec0::1 prefixlen 16 scopeid 0x40<site>
inet6 fe80::24b2:4ff:fea2:c384 prefixlen 64 scopeid 0x20<link>
inet6 2001:41d0:701:1100::6530 prefixlen 128 scopeid 0x0<global>
ether 26:b2:04:a2:c3:84 txqueuelen 1000 (Ethernet)
RX packets 296876976 bytes 119969634347 (111.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 332860140 bytes 70836308292 (65.9 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmbr1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.133.0.254 netmask 255.255.255.0 broadcast 10.133.0.255
inet6 fe80::7069:deff:fe53:4683 prefixlen 64 scopeid 0x20<link>
inet6 fc00:41d0:701:1100::fffe prefixlen 64 scopeid 0x0<global>
ether 72:69:de:53:46:83 txqueuelen 1000 (Ethernet)
RX packets 97817285 bytes 23184783528 (21.5 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 89687774 bytes 12198704545 (11.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Routing table 254 (main) :
root@vps-de:~ # ip -6 route show
::1 dev lo proto kernel metric 256 pref medium
2001:41d0:701:1100::6530 dev vmbr0 proto kernel metric 256 pref medium
fc00:41d0:701:1100::/64 dev vmbr1 proto kernel metric 256 pref medium
fe80::/64 dev vmbr0 proto kernel metric 256 pref medium
fe80::/64 dev vethlQV0nW proto kernel metric 256 pref medium
fe80::/64 dev vmbr1 proto kernel metric 256 pref medium
fec0::/16 dev vmbr0 proto kernel metric 256 pref medium
default via 2001:41d0:701:1100::1 dev vmbr0 metric 1024 onlink pref medium
Routing table 220 (strongswan):
root@vps-de:~ # ip -6 route show table 220
fc00:41d0:801:2000::/64 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::10:6:0:0/104 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::10:126:42:0/112 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::10:126:0:0/104 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::172:16:0:0/104 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::192:168:0:0/104 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fc01::/16 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fec1::/16 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
fec2::/16 dev vmbr0 proto static src fec0::1 metric 1024 pref medium
Let’s check :
root@vps-de:~ # ip -6 route get fc01::172:16:0:1
fc01::172:16:0:1 from :: dev vmbr0 table 220 proto static src fec0::1 metric 1024 pref medium
Ping works from host - OK :
root@vps-de:~ # ping fc01::172:16:0:1
PING fc01::172:16:0:1(fc01::172:16:0:1) 56 data bytes
64 bytes from fc01::172:16:0:1: icmp_seq=1 ttl=64 time=23.0 ms
64 bytes from fc01::172:16:0:1: icmp_seq=2 ttl=64 time=23.4 ms
64 bytes from fc01::172:16:0:1: icmp_seq=3 ttl=64 time=23.6 ms
^C
--- fc01::172:16:0:1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 23.026/23.352/23.648/0.254 ms
Traceroute command :
root@vps-de:~ # traceroute6 fc01::172:16:0:1
traceroute to fc01::172:16:0:1 (fc01::172:16:0:1), 30 hops max, 80 byte packets
1 fc01::172:16:0:1 (fc01::172:16:0:1) 22.781 ms 22.725 ms 22.688 ms
I connect to the container “fc00:41d0:701:1100::1
” (the one that responds well to my pings from home).
root@vps-de:~ # lxc-attach ns3
root@vps-de.nameserver:~ # ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.133.0.1 netmask 255.255.255.0 broadcast 10.133.0.255
inet6 fe80::216:3eff:fe78:442d prefixlen 64 scopeid 0x20<link>
inet6 fc00:41d0:701:1100::1 prefixlen 64 scopeid 0x0<global>
ether 00:16:3e:78:44:2d txqueuelen 1000 (Ethernet)
RX packets 113377105 bytes 13430614954 (12.5 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 97817892 bytes 24554346687 (22.8 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 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 1810 bytes 255582 (249.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1810 bytes 255582 (249.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now when I ping to “a” machine at home - say “bw.home.lab3w” the container does not query table 220 AND therefore goes out the host’s default route.
root@vps-de.nameserver:~ # ping fc01::172:16:0:1
PING fc01::172:16:0:1(fc01::172:16:0:1) 56 data bytes
From 2001:41d0:701:1100::6530 icmp_seq=1 Destination unreachable: Address unreachable
From 2001:41d0:701:1100::6530 icmp_seq=2 Destination unreachable: Address unreachable
From 2001:41d0:701:1100::6530 icmp_seq=3 Destination unreachable: Address unreachable
^C
--- fc01::172:16:0:1 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3068ms
root@vps-de.nameserver:~ # traceroute6 fc01::172:16:0:1
traceroute to fc01::172:16:0:1 (fc01::172:16:0:1), 30 hops max, 80 byte packets
1 fc00:41d0:701:1100::fffe (fc00:41d0:701:1100::fffe) 0.095 ms 0.034 ms 0.018 ms
2 vps.de.ipv10.net (2001:41d0:701:1100::6530) 3069.566 ms !H 3069.365 ms !H 3069.323 ms !H
It seems to me that there is a “forgetting” of questioning of routes since the LXC
I really need it, it’s urgent!!
Thank you.
Warmest regards.
Romain.
PS : And it doesn’t work in IPv4 (class A, B and C addresses) or in IPv6 (ULA addresses).
I installed strongSwan 6.0beta Vici Post-Quantum IKEv2 Daemon. Of course you can use today’s official version, version 5.9 without compiling, but you won’t be able to encrypt with OQS algorithms.
Documentation StrongSwan - Modern vici-based Scenarios IPv6 Configuration Examples et la page Usable Examples configurations.
Documentation strongSwan :: Introduction to strongSwan → Routing
Documentation strongSwan :: Route-based VPN
Note of me at 06h GMT+1 : It is true that StrongSwan does not write anything to this file (it knows that).
root@vps-de:~ # cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
root@vps-de:~ #
Note of me at 6h40 GMT +1 :
root@vps-de:~ # ip -6 route show table 255
local ::1 dev lo proto kernel metric 0 pref medium
local 2001:41d0:701:1100::6530 dev vmbr0 proto kernel metric 0 pref medium
anycast fc00:41d0:701:1100:: dev vmbr1 proto kernel metric 0 pref medium
local fc00:41d0:701:1100::fffe dev vmbr1 proto kernel metric 0 pref medium
anycast fe80:: dev vmbr0 proto kernel metric 0 pref medium
anycast fe80:: dev vethlQV0nW proto kernel metric 0 pref medium
anycast fe80:: dev vmbr1 proto kernel metric 0 pref medium
local fe80::24b2:4ff:fea2:c384 dev vmbr0 proto kernel metric 0 pref medium
local fe80::7069:deff:fe53:4683 dev vmbr1 proto kernel metric 0 pref medium
local fe80::fc16:1fff:fe91:b2e dev vethlQV0nW proto kernel metric 0 pref medium
anycast fec0:: dev vmbr0 proto kernel metric 0 pref medium
local fec0::1 dev vmbr0 proto kernel metric 0 pref medium
multicast ff00::/8 dev vmbr0 proto kernel metric 256 pref medium
multicast ff00::/8 dev vmbr1 proto kernel metric 256 pref medium
multicast ff00::/8 dev vethlQV0nW proto kernel metric 256 pref medium
I tried to add the “table 220
” to the “/etc/iproute2/rt_tables
” file without positive result:
root@vps-de:~ # cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
#
# strongswan perso
#
220 strongswan
For information
I opened the same topic on the forum the other day (my first addition of a request for help on the forum):
Have a nice day everyone.