如何从其他网络主机访问本地 juju 实例?

如何从其他网络主机访问本地 juju 实例?

我在无头机器上运行 juju,并且已经配置了网络,以便网络的其余部分可以连接到使用 br0 桥部署的 lxc 客户机。

不幸的是,Juju 创建了自己的 virtbr0。我希望能够从其他联网设备访问我的 juju 实例,但目前我只能从 juju 主机访问它们。

有什么建议吗?我很高兴能路由到 juju 子网,或者使用 br0 部署 juju 实例。

以下是有关当前网络设置的一些信息:

root@ragnarok:~# ifconfig -a
br0       Link encap:Ethernet  HWaddr 0e:31:50:b7:42:15  
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3ed9:2bff:fe0b:1ee/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:368136 errors:0 dropped:0 overruns:0 frame:0
          TX packets:448695 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:86744921 (86.7 MB)  TX bytes:225010392 (225.0 MB)

eth0      Link encap:Ethernet  HWaddr 3c:d9:2b:0b:01:ee  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:403922 errors:0 dropped:0 overruns:0 frame:0
          TX packets:482977 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:121619070 (121.6 MB)  TX bytes:229584532 (229.5 MB)
          Interrupt:18 

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:16436  Metric:1
          RX packets:39616 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39616 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:77037707 (77.0 MB)  TX bytes:77037707 (77.0 MB)

lxcbr0    Link encap:Ethernet  HWaddr 42:17:6e:6e:da:02  
          inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::4017:6eff:fe6e:da02/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:268 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:23000 (23.0 KB)

veth6XdwFd Link encap:Ethernet  HWaddr 92:52:9b:2d:30:be  
          inet6 addr: fe80::9052:9bff:fe2d:30be/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:15890 errors:0 dropped:0 overruns:0 frame:0
          TX packets:121216 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1433414 (1.4 MB)  TX bytes:28807169 (28.8 MB)

vethsUH9q7 Link encap:Ethernet  HWaddr 0e:31:50:b7:42:15  
          inet6 addr: fe80::c31:50ff:feb7:4215/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:1544 errors:0 dropped:0 overruns:0 frame:0
          TX packets:100924 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:121236 (121.2 KB)  TX bytes:6347816 (6.3 MB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:5993 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11778 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:479255 (479.2 KB)  TX bytes:15580755 (15.5 MB)

root@ragnarok:~# ip route
default via 192.168.1.1 dev br0  metric 100 
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1 
192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.110 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 
root@ragnarok:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 br0
10.0.3.0        0.0.0.0         255.255.255.0   U     0      0        0 lxcbr0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

答案1

目前本地提供商不支持该用例。如果要手动执行此操作,您必须修改每个容器的 lxc 配置,并在为您的网络设置进行设置后重新启动容器(实际上作为本地网络上 dhcp 的另一个以太网设备设置)。

http://manpages.ubuntu.com/manpages/precise/man5/lxc.conf.5.html

相关内容