scaleway / initrd

:wrench: Initrd builder with qemu nbd metadata for Scaleway boot (armhf + x86_64)
https://www.scaleway.com/docs
MIT License
51 stars 23 forks source link

ipv6 address not configured #193

Open giovannicandido opened 6 years ago

giovannicandido commented 6 years ago

Ubuntu Xenial Image do not get ipv6 address on boot.

I think is because eth0 do not exist and is not guarantee to exist on different linux distributions

IP=$(scw-metadata --cached IPV6_ADDRESS)
GW=$(scw-metadata --cached IPV6_GATEWAY)
MASK=$(scw-metadata --cached IPV6_NETMASK)
run ip -6 addr add dev eth0 $IP/$MASK
run ip -6 route add default via $GW

Assume eth0, while ip a show ens2

giovannicandido commented 6 years ago

Manual configuration works

giovannicandido commented 6 years ago

I change the network name as a work around but no luck.

To change the interface name, in ubuntu create a file /etc/udev/rules.d/70-persistent-net.rules

With the contents:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:01:02:03:04:05",  ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

Change to mac address of interface.

Still manual configuration need to take place.

How to debug this? Is a systemd service? I try systemctl status scaleway there is no such services.

giovannicandido commented 6 years ago

I did a test with Ubuntu 18 is working as expected.

Not all server flavors has Bionic available as image. START1-XS and C1 are examples.

botanegg commented 6 years ago

VC1S + Debian Stretch cannot autoconfigure too Manual configuration works fine

I made workaround: Got a script from scaleway blog and change eth0 to ens2 then add it to /etc/crontab

/root/ipv6.sh

#!/bin/sh
# Load all IPv6 setting from the metadata service
IPV6_NETMASK=$(scw-metadata IPV6_NETMASK)  
IPV6_GATEWAY=$(scw-metadata IPV6_GATEWAY)  
IPV6_ADDRESS=$(scw-metadata IPV6_ADDRESS)  
# Add your IPv6
ip addr add ${IPV6_ADDRESS}/${IPV6_NETMASK} dev ens2  
# Add your default IPv6 gateway
ip -6 r add default via ${IPV6_GATEWAY} dev ens2  

/etc/crontab

@reboot root /root/ipv6.sh
botanegg commented 6 years ago

But on archlinux i got

CROND[264]: (root) CMDOUT (/root/ipv6.sh: line 6: scw-metadata: command not found) 
ghost commented 5 years ago

add /usr/local/bin to the PATH