Daniel - Thank you for answering, not a big deal. Gordon - Aye, that is what I do for containers. For applications I write an "init" script
#!/bin/bash route add default gw 192.168.0.1 eth0 Additional commands / config service start foo or what not (depending on the application). then lxc-execute -n foo -f foo.config /path_to/init_script ----- Original Message ----- From: "Daniel Lezcano" <[email protected]> To: "Bodhi Zazen" <[email protected]> Cc: [email protected] Sent: Wednesday, June 9, 2010 2:09:50 PM Subject: Re: [Lxc-users] Set default GW On 06/09/2010 09:15 PM, Bodhi Zazen wrote: > Is there a way to set the default gateway in a linux container ? > > If I set an ipaddress in the config file > > lxc.utsname = foo > lxc.network.type = veth > lxc.network.flags = up > lxc.network.link = br0 > lxc.network.name = eth0 > lxc.network.mtu = 1500 > lxc.network.ipv4 = 192.168.0.10/24 > > These lines set the ip address of the guest. > > Now if I use it either as a container (adding a rootfs , fstab, > devices and running lxc-start -n foo) or as an application (using the > system / and lxc-execute -n foo -f /lxc/foo.config /bin/bash) , > everything starts as expected, I can enter the container with > lxc-console, etc ... > > The "problem" is the default gw is not set. I have to either add the > gw manually (when running /bin/bash) or adding it to the init scripts > (if running a container) > > route add default gw 192.168.0.1 eth0 > > after running the route command everything works as expected. > > So, what I am asking, is there a way of setting the default route / gw > in the config file, foo.config ? > Unfortunately, no yet. It is in the TODO list :/ ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Lxc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-users ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Lxc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-users
