LXC 无法从 DHCP 获取 IP

LXC 无法从 DHCP 获取 IP

我正在尝试为 lxc 分配一个 IP,以便网络上的其他机器可以看到它。 主机:~$ /etc/network/interfaces

auto lo
iface lo inet loopback

auto enp4s0
iface enp4s0 inet manual

auto br0
iface br0 inet dhcp
        bridge_ports enp4s0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

主机:〜$ cat .local/share/lxc/elastic/config

lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.include = /usr/share/lxc/config/ubuntu.userns.conf
lxc.arch = x86_64
# Container specific configuration
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
# Network configuration

lxc.network.type = veth 
lxc.network.flags = up 
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.hwaddr = 00:16:3e:c9:7a:92
lxc.rootfs = /home/nitigyasharma/.local/share/lxc/elastic/rootfs
lxc.rootfs.backend = dir
lxc.utsname = elastic

主机:〜$ cat .local/share/lxc/elastic/rootfs/etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

我的网络接口是

2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
    link/ether c8:5b:76:fa:6d:93 brd ff:ff:ff:ff:ff:ff
    inet 10.1.5.214/16 brd 10.1.255.255 scope global dynamic enp4s0
       valid_lft 3569sec preferred_lft 3569sec
    inet 10.1.6.11/16 brd 10.1.255.255 scope global secondary enp4s0
       valid_lft forever preferred_lft forever
3: wlp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 3c:95:09:43:7e:c7 brd ff:ff:ff:ff:ff:ff
25: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether c8:5b:76:fa:6d:93 brd ff:ff:ff:ff:ff:ff
    inet 10.1.6.11/16 brd 10.1.255.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::ca5b:76ff:fefa:6d93/64 scope link 
       valid_lft forever preferred_lft forever

但我无法从主机 ping 10.1.0.1,并且 lxc 根本无法获取网络 IP

路线

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.1.0.1        0.0.0.0         UG    0      0        0 br0
10.1.0.0        *               255.255.0.0     U     0      0        0 enp4s0
10.1.0.0        *               255.255.0.0     U     0      0        0 br0

lxc-info 的输出

host-machine-:~$ lxc-info -n elastic 
Name:           elastic
State:          RUNNING
PID:            3772
Memory use:     31.73 MiB
KMem use:       0 bytes
Link:           veth1VQMEE
 TX bytes:      1.63 KiB
 RX bytes:      4.76 KiB
 Total bytes:   6.40 KiB

相关内容