Skip to content

Commit

Permalink
LXC: document autostart virsh
Browse files Browse the repository at this point in the history
  • Loading branch information
aphyr committed Jan 26, 2021
1 parent 5ab20a9 commit 676967b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions doc/lxc.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ for i in {1..10}; do
done
```

Start the network, and set it to start at boot so the dnsmasq will be
available.

```
virsh net-autostart default;
virsh net-start default
```

If you configure resolv.conf by hand, add the libvirt local dnsmasq to
resolv.conf:

Expand All @@ -56,6 +64,7 @@ If you're letting dhclient manage it, then:

```
echo "prepend domain-name-servers 192.168.122.1;" >>/etc/dhcp/dhclient.conf
sudo service networking restart
```

Slip your preferred SSH key into each node's `.authorized-keys`:
Expand All @@ -64,17 +73,11 @@ Slip your preferred SSH key into each node's `.authorized-keys`:
for i in {1..10}; do
mkdir -p /var/lib/lxc/n${i}/rootfs/root/.ssh
chmod 700 /var/lib/lxc/n${i}/rootfs/root/.ssh/
cp ~admin/.ssh/id_rsa.pub /var/lib/lxc/n${i}/rootfs/root/.ssh/authorized_keys
cp ~/.ssh/id_rsa.pub /var/lib/lxc/n${i}/rootfs/root/.ssh/authorized_keys
chmod 644 /var/lib/lxc/n${i}/rootfs/root/.ssh/authorized_keys
done
```

Start the virtual network...

```
virsh net-start default
```

And start the nodes:

```
Expand Down

0 comments on commit 676967b

Please sign in to comment.