我是 LXD 新手。我运行的是 Ubuntu 16.04.1,我安装了 lxd。我最初没有使用 init lxd 安装网络。我尝试稍后设置网络。容器没有显示任何 IP 地址。我希望容器有自己的 IP 地址。我做错了什么?
以下是一些输出:
/etc/network/interfaces:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#auto enp0s25
#iface eth0 inet dhcp
#pre-up /sbin/ethtool -s eth0 speed 1000 duplex full
#iface enp0s25 inet static
auto br0
iface br0 inet static
address 128.194.145.15
netmask 255.255.255.0
gateway 128.194.145.1
dns-search tamu.edu
dns-nameservers 128.194.254.1 128.194.254.2
bridge_ports enp0s25
bridge_stp off
bridge_maxwait 0
iface enp0s25 inet manual
我启用了数据包转发:
我确实编辑/etc/sysctl.conf
并取消注释了 net.ipv4.ip_forward=1 行和 sudo sysctl -p
sudo systemctl restart networking.service
lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: br0
type: nic
name: default
lxc list 显示以下内容:
+-----------+---------+------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-----------+---------+------+------+------------+-----------+
| appstack1 | RUNNING | | | PERSISTENT | 0 |
+-----------+---------+------+------+------------+-----------+
| kcxenial1 | RUNNING | | | PERSISTENT | 0 |
+-----------+---------+------+------+------------+-----------+
以下是 ifconfig 的输出:
br0 Link encap:Ethernet HWaddr 00:26:b9:7b:82:db
inet addr:128.194.145.15 Bcast:128.194.145.255 Mask:255.255.255.0
inet6 addr: fe80::226:b9ff:fe7b:82db/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12126 errors:0 dropped:0 overruns:0 frame:0
TX packets:2413 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2438060 (2.4 MB) TX bytes:341636 (341.6 KB)
enp0s25 Link encap:Ethernet HWaddr 00:26:b9:7b:82:db
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:31738 errors:0 dropped:0 overruns:0 frame:0
TX packets:10498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9031992 (9.0 MB) TX bytes:1616482 (1.6 MB)
Interrupt:21 Memory:f7ae0000-f7b00000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:1910 (1.9 KB) TX bytes:1910 (1.9 KB)
vethRLDAS7 Link encap:Ethernet HWaddr fe:a7:58:6b:11:ea
inet6 addr: fe80::fca7:58ff:fe6b:11ea/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30 errors:0 dropped:0 overruns:0 frame:0
TX packets:10988 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8172 (8.1 KB) TX bytes:1404949 (1.4 MB)
vethWXSA9S Link encap:Ethernet HWaddr fe:17:94:89:8f:fe
inet6 addr: fe80::fc17:94ff:fe89:8ffe/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:10932 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10224 (10.2 KB) TX bytes:1397627 (1.3 MB)