I have this server (the host) which has 1000 external ip addresses. I created a docker container running squid3 and I need to use those ip addresses. I can enable forwarding from the host but that just forwards the request to the local docker ip which screws up my squid ACLs since squid sees the internal ip instead of the external one.

My question is as follows, how do I play with docker or lxc (docker has lxc directives via -lxc-conf=) so that I can see my host's external ip addresses in my container (running ifconfig for example). Right now docker starts with it's own isolated network so it's unusable to me.

The host external ip addresses are assigned to interface p1p1.

I tried running it with -lxc-conf="lxc.network.type = phys" -lxc-conf="lxc.network.link = p1p1" but that completely messes my hosts interface and even kicks me out of ssh.

Any idea what I'm doing wrong?


the pipework can help you.

Connect a container to a local physical interface

Let's pretend that you want to run two Hipache instances, listening on real interfaces eth2 and eth3, using specific (public) IP addresses. Easy!

pipework eth2 $(docker run -d hipache /usr/sbin/hipache)
pipework eth3 $(docker run -d hipache /usr/sbin/hipache)

Note that this will use macvlan subinterfaces, so you can actually put multiple containers on the same physical interface.

I think this is what you need.

  • Well I have boxes with 2k external ip addresses, is this doable so that I can use those ip addresses inside my docker via pipework? – Romeo Mihalcea Dec 12 '13 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.