Hello,
Je me casse la tête sur ce problème depuis hier soir, sans être capable d’y arriver, j’appelle au secours…
J’ai un VPS chez onesetsolutions, avec une ipv4, c’est une VM debian toute simple, accès au net OK, ci-dessus la conf :
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 185.163.*.* netmask 255.255.252.0 broadcast 185.163.*.*
inet6 fe80::250:*** prefixlen 64 scopeid 0x20<link>
ether 00:50:56:06:65:f1 txqueuelen 1000 (Ethernet)
RX packets 1692801 bytes 132946890 (126.7 MiB)
RX errors 0 dropped 40 overruns 0 frame 0
TX packets 5336 bytes 1262323 (1.2 MiB)
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 2338 bytes 296292 (289.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2338 bytes 296292 (289.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Je veux transformer cette VM pour y intégrer des zones, un peu façon solaris, car je souhaiterais avoir plusieurs instances me permettant d’installer des environnements spécifiques et pouvoir les virer facilement (en gros une zone pour du test, une autre pour du de l’hebergement gaming etc…).
Après m’être cassé les dents sur LXC, bien qu’arrivant avec une conf fonctionnelle, j’abandonne l’idée de ce produit cassé de partout. Je me dirige donc vers LXD, qui semble être plus aboutit. Bon, même si ça commence mal car non packagé debian, un coup de snapd et j’ai mon LXD d’installé.
Je fais un lxd init, je réponds aux questions (bridge oui, création, oui, etc…). Je créé une première instance, ça boot, mais pas de réseau. J’hérite d’une interface ip6 inexploitable et d’ailleurs dont je ne veux pas.
Je cherche de la doc, je tombe sur des confs uniquement basées sur LXC, rien sur LXD pure… je commence à m’arracher les cheveux. Il n’y a pas deux explications identiques, du coup je teste plein de trucs sans rien réussir à faire fonctionner.
Quelqu’un pourrait-il avoir la gentillesse de m’expliquer étape par étape comment arriver à avoir, avec ou sans lxc-net, des instances dans un subnet, utilisant un bridge sur l’hote, leur permettant d’accéder à internet. C’est juste ça que je veux, mais ça parait impossible à faire… Merci !
Pour info, voici ce que j’ai fait :
/snap/bin/lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]: lxd
Name of the storage backend to use (btrfs, dir, lvm, ceph) [default=btrfs]: lvm
Create a new LVM pool? (yes/no) [default=yes]:
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]:
Size in GB of the new loop device (1GB minimum) [default=30GB]: 100GB
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 192.168.0.1/24
Would you like LXD to NAT IPv4 traffic on your bridge? [default=yes]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: none
Would you like the LXD server to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
/snap/bin/lxc launch images:debian/buster instance-valheim
Creating instance-valheim
Starting instance-valheim
brctl show
bridge name bridge id STP enabled interfaces
lxdbr0 8000.00163edf17cf no veth8ce152d5
/snap/bin/lxc network list
+--------+----------+---------+----------------+------+-------------+---------+
| NAME | TYPE | MANAGED | IPV4 | IPV6 | DESCRIPTION | USED BY |
+--------+----------+---------+----------------+------+-------------+---------+
| eth0 | physical | NO | | | | 0 |
+--------+----------+---------+----------------+------+-------------+---------+
| lxdbr0 | bridge | YES | 192.168.0.1/24 | none | | 2 |
+--------+----------+---------+----------------+------+-------------+---------+
/snap/bin/lxc list
+------------------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------------+---------+------+------+-----------+-----------+
| instance-valheim | RUNNING | | | CONTAINER | 0 |
+------------------+---------+------+------+-----------+-----------+
/snap/bin/lxc network show lxdbr0
config:
ipv4.address: 192.168.0.1/24
ipv4.nat: "true"
ipv6.address: none
description: ""
name: lxdbr0
type: bridge
used_by:
- /1.0/instances/instance-valheim
- /1.0/profiles/default
managed: true
status: Created
locations:
- none
> route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default link-029517.one 0.0.0.0 UG 0 0 0 eth0
185.163.124.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 lxdbr0
ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 185.163.124.*** netmask 255.255.252.0 broadcast 185.163.127.255
inet6*************** prefixlen 64 scopeid 0x20<link>
ether 00:50:56:06:65:f1 txqueuelen 1000 (Ethernet)
RX packets 491646 bytes 39732048 (37.8 MiB)
RX errors 0 dropped 3194 overruns 0 frame 0
TX packets 3263 bytes 645377 (630.2 KiB)
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 669 bytes 83132 (81.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 669 bytes 83132 (81.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lxdbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.1 netmask 255.255.255.0 broadcast 0.0.0.0
inet6 *********** prefixlen 64 scopeid 0x20<link>
ether 00:16:3e:df:17:cf txqueuelen 1000 (Ethernet)
RX packets 25 bytes 4760 (4.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13 bytes 1006 (1006.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth8ce152d5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 52:37:2b:28:42:90 txqueuelen 1000 (Ethernet)
RX packets 25 bytes 5110 (4.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13 bytes 1006 (1006.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
cat /etc/default/lxc-net
USE_LXC_BRIDGE="true"
/snap/bin/lxc config show instance-valheim
architecture: x86_64
config:
image.architecture: amd64
image.description: Debian buster amd64 (20210221_05:24)
image.os: Debian
image.release: buster
image.serial: "20210221_05:24"
image.type: squashfs
image.variant: default
volatile.base_image: bc0a55159801e73d0f3be94839e8c663da33d28a2714bd401922c9f55f0c4f98
volatile.eth0.host_name: vethbda23e92
volatile.eth0.hwaddr: 00:16:3e:dc:e2:0e
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":10 00000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":10000 00000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange" :1000000000}]'
volatile.last_state.power: RUNNING
volatile.uuid: fec4b733-0fa2-4292-aab8-39f91922fe7d
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""
lsof -i :53
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
dnsmasq 655 dnsmasq 4u IPv4 18122 0t0 UDP *:domain
dnsmasq 655 dnsmasq 5u IPv4 18123 0t0 TCP *:domain (LISTEN)
dnsmasq 655 dnsmasq 6u IPv6 18124 0t0 UDP *:domain
dnsmasq 655 dnsmasq 7u IPv6 18125 0t0 TCP *:domain (LISTEN)
Mais une fois dans la VM :
/snap/bin/lxc exec instance-valheim -- /bin/bash
root@instance-valheim:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 ******* prefixlen 64 scopeid 0x20<link>
ether 00:16:3e:dc:e2:0e txqueuelen 1000 (Ethernet)
RX packets 12 bytes 936 (936.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 18 bytes 2988 (2.9 KiB)
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 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Rien… que me manque-t-il ??
Réponse de moi à moi grâce à un copain : le problème vient de dnsmasq. Ne surtout pas installer dnsmasq de la version debian, mais bien laisser dnsmasq-base, qui vient avec le snap !