On Wed, 21 Jan 2015, Fajar A. Nugraha wrote:

> On Wed, Jan 21, 2015 at 7:09 PM, scrumpyjack <scrumpyj...@me.com> wrote:
> 
> > Yes, i want to give a /32 to a container.

> This is on ubuntu server. The host has 100.0.0.10/24, router is on
> 100.0.0.1, the container is on 100.0.0.11 (fake IPs, of course).
> The host communicates with the container thru a PRIVATE bridge with IP
> 192.168.124.1 (note that this IP doesn't even have to be in the same
> network as host and container's IP)
> 
> Relevant part of host's /etc/network/interfaces
> ###
> auto eth0
> iface eth0 inet static
> address 100.0.0.10
> netmask 255.255.255.0
> gateway 100.0.0.1
> # this part functions similar as proxy arp, force eth0 to accepts packets
> # destined for the container's IP using static arp
> up arp -i eth0 -Ds 100.0.0.11 eth0 pub || true
> 
> # this is an internal bridge used to connect the host to the container
> auto br0
> iface br0 inet manual
> bridge_ports none
> bridge_maxwait 0
> bridge_stp off
> bridge_fd 0
> # add specific route for the container IP
> up ip route add 100.0.0.11/32 dev br0 || true
> ###
> 
> 
> Relevant part of container config. Note that this only sets the bridge and
> persistent vif mac & name.
> ###
> lxc.network.type=veth
> lxc.network.link=br0
> lxc.network.veth.pair=veth-c1-0
> lxc.network.flags=up
> lxc.network.hwaddr = 00:16:3E:FD:46:25
> ###
> 
> 
> Relevant part of container's /etc/network/interfaces
> ###
> auto eth0
> iface eth0 inet static
>         address 100.0.0.11
>         netmask 255.255.255.255
> # force route for host's br0
> up ip route add 192.168.124.1 dev eth0
> # ... and use it for default route
> up ip route add default via 192.168.124.1

Yup, thanks, this worked for me.
I was trying to use macvlan and phys to avoid having to add my eth0 to the 
bridgeport and putting into promiscuois mode, which this solves

thanks again!




_______________________________________________
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to