Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IPv6 network only works on localhost in OpenVZ [workaround]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
sliwowitz
Apprentice
Apprentice


Joined: 21 Jan 2005
Posts: 209
Location: Europe/Prague

PostPosted: Thu May 09, 2019 9:19 am    Post subject: IPv6 network only works on localhost in OpenVZ [workaround] Reply with quote

I have troubles setting up IPv6 network on a VPS. The IPv6 subsystem seems to be working i.e. for pinging on localhost, but I cannot reach any outside host by ipv6, nor can the server be contacted from the internet. The provider only assigns one /128 ipv6 address
Code:
yggdrasill ~ # cat /etc/conf.d/net
config_venet0=" 77.93.223.239/32  2a01:430:17:1::ffff:148/128 "
routes_venet0="default"

Code:
yggdrasill ~ # ifconfig venet0
venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 77.93.223.239  netmask 255.255.255.255  broadcast 0.0.0.0  destination 77.93.223.239
        inet6 2a01:430:17:1::ffff:148  prefixlen 128  scopeid 0x0<global>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)
        RX packets 22115  bytes 2370037 (2.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19503  bytes 6585491 (6.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

pinging the server from itself works
Code:
yggdrasill ~ # ping6 2a01:430:17:1::ffff:148
PING 2a01:430:17:1::ffff:148(2a01:430:17:1::ffff:148) 56 data bytes
64 bytes from 2a01:430:17:1::ffff:148: icmp_seq=1 ttl=64 time=0.057 ms
64 bytes from 2a01:430:17:1::ffff:148: icmp_seq=2 ttl=64 time=0.143 ms

but trying to ping something outside does not
Code:
yggdrasill ~ # ping6 ipv6.google.com
connect: Network is unreachable

If I try to ping 2a01:430:17:1::ffff:148 from the outside, it won't work either (all packets would get lost).

I don't really understand how IPv6 routing is supposed to work, but there seems to be a route set up in a similar way as the IPv4 one
Code:
yggdrasill ~ # ip -6 r
2a01:430:17:1::ffff:148 dev venet0 proto kernel metric 256 mtu 1500
fe80::/64 dev venet0 proto kernel metric 256 mtu 1500
yggdrasill ~ # ip -4 r
127.0.0.0/8 via 127.0.0.1 dev lo
default dev venet0 scope link metric 4

Is there any configuration I might have missed?
_________________
The question of whether Machines Can Think... is about as relevant as the question of whether Submarines Can Swim.
-- Edsger Dijkstra


Last edited by sliwowitz on Tue May 21, 2019 2:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
sliwowitz
Apprentice
Apprentice


Joined: 21 Jan 2005
Posts: 209
Location: Europe/Prague

PostPosted: Thu May 09, 2019 10:06 am    Post subject: Reply with quote

The provider told me I was hitting this bug https://bugs.gentoo.org/507770 and provided a workaround

Code:
root@yggdrasill ~ # cat /etc/conf.d/net
config_venet0=" 77.93.223.239/32  2a01:430:17:1::ffff:148/128 "
routes_venet0="default"

# Workaround to set default route for IPv6
# Should be removed after #507770 will be fixed.
postup() {
    ip -6 route add default dev venet0
}

_________________
The question of whether Machines Can Think... is about as relevant as the question of whether Submarines Can Swim.
-- Edsger Dijkstra
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7367

PostPosted: Thu May 09, 2019 3:48 pm    Post subject: Reply with quote

No, you hit this because you wrongly set default route, it comes from this
Code:
routes_venet0="default"


it's not just "default" it should be "default via hostdest"

and the result of routes_eth0="default via 192.168.0.100"
gave you this output
Code:
ip  r
default via 192.168.0.100 dev eth0 metric 2
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.4

which mean:
* anything from eth0 outside the 192.168.0.0/24 range, will be sent thru 192.168.0.100
* eth0 is assign as 192.168.0.4

maybe the bug still exists, no idea, but at least, proper configuration should be set, and maybe you'll see your workaround is no more need
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44900
Location: 56N 3W

PostPosted: Thu May 09, 2019 4:42 pm    Post subject: Reply with quote

sliwowitz,

Your default ipv6 route needs to point to the IP address of the router.
Code:
$ ip -6 route show
2a02:<mangled>::/64 dev eth0 proto kernel metric 256 expires 86161sec pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
default via fe80::463e:59d6:205c:c109 dev eth0 proto ra metric 1024 expires 661sec mtu 1280 hoplimit 64 pref medium


There are two ways. Routers are supposed to send Router advertisement messages.
If that's set up by the router provider,
Code:
dhcpcd -6 eth0
will set up IPv6 only, on eth0.
Be aware that the router IP address is supposed to change prom time to time but its designed to work that way.

The other way is to send router discovery packets. Its a special ping -6 that only routers will respond to.
However, beware a static setup.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sliwowitz
Apprentice
Apprentice


Joined: 21 Jan 2005
Posts: 209
Location: Europe/Prague

PostPosted: Tue May 21, 2019 2:43 pm    Post subject: Reply with quote

I think this issue is specific to OpenVZ. The traffic is somehow routed straight to the interface and there seems to be no gateway. (If that makes any sense - I'm no networking expert). With the current configuration, both IPv4 and IPv6 work fine, though the ip route shows this:
Code:
yggdrasill ~ # ip route show
127.0.0.0/8 via 127.0.0.1 dev lo
default dev venet0 scope link metric 4
yggdrasill ~ # ip -6 route show
2a01:430:17:1::ffff:148 dev venet0 proto kernel metric 256 mtu 1500
fe80::/64 dev venet0 proto kernel metric 256 mtu 1500
default dev venet0 metric 1024 mtu 1500

There is no gateway to set for the default route. In theory, you should be able to get it working by setting routes_venet0="default -f inet6 default", which works but won't survive a reboot - the OpenVZ scripts would rewrite this variable on boot back to routes_venet0="default". This seems to have been fixed here https://dev.gentoo.org/~vapier/openrc/projects/openrc/ticket/152.html but it didn't work for me, so I had to put the postup() function in the config, which would be left untouched by the scripts.

As for the static IPv6 config - this provider only assigns static IPs. In the IPv6 case, you can request as many as you want, but they are single separate /128 IPs - you don't get a continuous IPv6 subnet block, but they guarantee that the IPs will be always assigned to the virtual machines as you requested (i.e. not reassigned to different customers etc.)
_________________
The question of whether Machines Can Think... is about as relevant as the question of whether Submarines Can Swim.
-- Edsger Dijkstra
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum