2

My current environment is following; in Windows 10 I have installed Ubuntu 16.04 in Hyper-V, this hosted Ubuntu is connected to local network 10.10.10.*, where Ubuntu's IP is 10.10.10.1 and Windows's 10.10.10.100. They see each other and all is good. Inside Ubuntu, I have LXC/LXD containers (nginx, postgres and nodejs service) and for these containers I have bridged network called chyrrybr0 with addresses 10.10.0.*, so current environment look like this:

enter image description here

I'm able to ping Windows from containers, but I'm not able to ping or connect to containers from Windows. So, my question is following: how can I add a new network interface to containers, so I'll be able to setup static IP addresses to 10.10.10.*?

I'm trying to create a network, what's looks like this:

enter image description here

EDIT: I was able to add new eth1 interface. At first, in Ubuntu host I'd run lxc network attach eth1 postgres eth1 and then in postgres container I'd added network interface configuration 10-win-network.cfg with content

auto eth1
iface eth1 inet static
address 10.10.10.5
netmask 255.255.255.0

But, from now, I'm not able to ping Windows host at 10.10.10.100 (100% packet loss) and also Ubuntu host at 10.10.10.1 (icmp_seq=1 Destination Host Unreachable). But ping at 10.10.0.249 (IP address of Ubuntu host at cherrybr0) is succesful. What am I missing?

1 Answer 1

0

I don't know if you were able to solve this, but I ran into a similar problem lately ("how to access containers which run on my local laptop, from outside of my laptop?"), and I simply added static routes to my home router...

Steps:

  • run all your containers on a separate network, for example 172.18.0.0/16. All those containers will be behind an IP like 172.18.0.1, let's call this machine Ship (because it has containers..hehe).
  • Your Ship also must have a local ip like 192.168.1.xxx, which is the address your router knows it for.
  • on your router (or windows machine, if that's your router), add a static route for 172.18.0.0 net submask 255.255.0.0 to your Ships 192.168.1.xxx.

and voila, now you can call your containers (172.18.0.xxx)from anywhere on your local network (including your windows machines)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .