テクノロイド

コンピュータやゲーム他、色々日々思ったことをつづっていきます。

LXDのUbuntu18.04コンテナのLAN設定

2019-08-15 03:25:30 | LXC/LXD,コンテナ,snaps
LXDのUbuntu18.04コンテナのLAN設定を忘れないようにメモ

コンテナのeth1にDHCPアドレスを振る設定
host$ lxc ls u18test
+---------+---------+---------------------+-----------------------+------------+-----------+
|  NAME   |  STATE  |        IPV4         |          IPV6         |    TYPE    | SNAPSHOTS |
+---------+---------+---------------------+-----------------------+------------+-----------+
| u18test | RUNNING | 192.168.0.8 (eth1)  | fd42:(略):7895 (eth0) | PERSISTENT | 0         |
|         |         | 10.196.59.80 (eth0) |                       |            |           |
+---------+---------+---------------------+-----------------------+------------+-----------+

host$ lxc exec u18test bash
root@u18test:~# cat /etc/netplan/50-cloud-init.yaml 
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            dhcp4: true
root@u18test:~# cat /etc/netplan/70-eth1.yaml
network:
    version: 2
    ethernets:
        eth1:
            dhcp4: true


追記)
ちなみにコンテナへeth1を追加するには
host$ lxc config device add u18test eth1 nic nictype=macvlan parent=eno2

最新の画像もっと見る

コメントを投稿