Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

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 github.com/dotcloud/docker/pull/2902 once/if accepted. –  Alex_www Dec 12 '13 at 5:38

1 Answer 1

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) 50.19.169.157
pipework eth3 $(docker run -d hipache /usr/sbin/hipache) 107.22.140.5

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

 
discard

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.