Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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=" = phys" -lxc-conf=" = p1p1" but that completely messes my hosts interface and even kicks me out of ssh.

Any idea what I'm doing wrong?

share|improve this question
Tried it but unfortunately I still see requests coming in through docker's private network ip address and squid sees that address instead of the hosts external ip which was requested. Don't know if I'm making too much sense... – Romeo Mihalcea Dec 12 '13 at 3:46
I guess this pull request will fix that issue once/if accepted. – Alex_www Dec 12 '13 at 5:38

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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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