Gao feng @ 12/11/2013 01:49 AM:> I have a machine running libvirt lxc, > on this machine(host), the network configure looks like this > eth0 is the physical nic, virbr0 is the bridge libvirt created, and vnet0 > is the veth device created for libvirt lxc container. you can see, the eth0 > is a port of virbr0, and the ip is assigned on virbr0. > > [snip] > > And in container > > I change the ip of eth0 to 192.168.122.33 and add a route rule > ip route add default via 192.168.122.1 dev eth0 > > then the container can access the outside. > > I think it should work even you change the 192.168.x.x to the > global ip.arrg thank you but this is all so confusing to me >< this is what my ifconfig and brctl show looks like on host machine: http://pastebin.com/9f1HzXi5 i want to use 67.180.246.123 for the container
On 12/13/2013 12:33 PM, scar wrote:> Gao feng @ 12/11/2013 01:49 AM: >> I have a machine running libvirt lxc, >> on this machine(host), the network configure looks like this >> eth0 is the physical nic, virbr0 is the bridge libvirt created, and vnet0 >> is the veth device created for libvirt lxc container. you can see, the eth0 >> is a port of virbr0, and the ip is assigned on virbr0. >> >> [snip] >> >> And in container >> >> I change the ip of eth0 to 192.168.122.33 and add a route rule >> ip route add default via 192.168.122.1 dev eth0 >> >> then the container can access the outside. >> >> I think it should work even you change the 192.168.x.x to the >> global ip. > > arrg thank you but this is all so confusing to me >< > > this is what my ifconfig and brctl show looks like on host machine: > http://pastebin.com/9f1HzXi5 > > i want to use 67.180.246.123 for the container >I saw there are two bridge br0 and virbr0 in your host. which bridge the libvirt uses? what's result of #virsh net-list ? I think you may setup the wrong bridge. try to set ip for virbr0 and make eth0 as a port of virbr0.
On 12/13/2013 01:18 PM, Gao feng wrote:> On 12/13/2013 12:33 PM, scar wrote: >> Gao feng @ 12/11/2013 01:49 AM: >>> I have a machine running libvirt lxc, >>> on this machine(host), the network configure looks like this >>> eth0 is the physical nic, virbr0 is the bridge libvirt created, and vnet0 >>> is the veth device created for libvirt lxc container. you can see, the eth0 >>> is a port of virbr0, and the ip is assigned on virbr0. >>> >>> [snip] >>> >>> And in container >>> >>> I change the ip of eth0 to 192.168.122.33 and add a route rule >>> ip route add default via 192.168.122.1 dev eth0 >>> >>> then the container can access the outside. >>> >>> I think it should work even you change the 192.168.x.x to the >>> global ip. >> >> arrg thank you but this is all so confusing to me >< >> >> this is what my ifconfig and brctl show looks like on host machine: >> http://pastebin.com/9f1HzXi5 >> >> i want to use 67.180.246.123 for the container >> > > I saw there are two bridge br0 and virbr0 in your host. > which bridge the libvirt uses? what's result of #virsh net-list ?and #virsh net-dumpxml default> > I think you may setup the wrong bridge. try to set ip for virbr0 and > make eth0 as a port of virbr0. > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Gao feng @ 12/12/2013 10:18 PM:> I saw there are two bridge br0 and virbr0 in your host. which > bridge the libvirt uses? what's result of #virsh net-list ?well i don't quite understand bridges and their function, i'm kinda just following directions. br0 replaced eth0 though in my interfaces file according to this guide[1] i followed to setup the bridge. i'm pretty sure virbr0 is what libvirt uses.... host$ cat /etc/network/interfaces auto lo iface lo inet loopback auto br0 iface br0 inet static address 67.180.246.122 netmask 255.255.255.248 gateway 67.180.246.121 dns-nameservers 67.180.241.11 67.180.241.12 bridge_ports eth0 bridge_fd 9 bridge_maxage 12 bridge_stp off host$ virsh net-list Name State Autostart - ----------------------------------------- default active yes host$ virsh net-dumpxml default <network> <name>default</name> <uuid>e6d3f97a-5870-8ee7-1d82-64b3434f138b</uuid> <forward mode='nat'/> <bridge name='virbr0' stp='on' delay='0' /> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254' /> </dhcp> </ip> </network> $ 1. https://help.ubuntu.com/12.04/serverguide/network-configuration.html#bridging -----BEGIN PGP SIGNATURE----- iEYEAREIAAYFAlKrx58ACgkQXhfCJNu98qDHhwCguJBus/7kZj+5R2EAYSzSENg8 SFwAoLVCxi6jJQBaUhMl4Ter+Jnvq/rI =4wm8 -----END PGP SIGNATURE-----