diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2010-10-19 17:49:56 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2010-10-19 17:49:56 -0700 |
commit | 7cb4ca9db6167a53eeac30425ebfcb90881c9b77 (patch) | |
tree | 4fe8f71ff100ada0d5b21de25e881bf33e1a9b6a | |
parent | 844d9c60f8610d2387af4579d8d83a434c09b438 (diff) | |
download | jrayhawk-7cb4ca9db6167a53eeac30425ebfcb90881c9b77.tar.gz jrayhawk-7cb4ca9db6167a53eeac30425ebfcb90881c9b77.zip |
Adding some networking stuff and cleaning up some.
-rw-r--r-- | notes/lxc_setup.sh.txt | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/notes/lxc_setup.sh.txt b/notes/lxc_setup.sh.txt index eff8d96..819e09e 100644 --- a/notes/lxc_setup.sh.txt +++ b/notes/lxc_setup.sh.txt @@ -27,16 +27,16 @@ while cat /srv/lxc/*/config | grep -q 'lxc\.network\.ipv4 = 192\.168\.1\.'$addr; addr=$(($addr+1)) done -echo >> /srv/lxc/$container/config -echo '# networking' >> /srv/lxc/$container/config -echo lxc.utsname = $container >> /srv/lxc/$container/config -echo lxc.network.type = veth >> /srv/lxc/$container/config -echo lxc.network.flags = up >> /srv/lxc/$container/config -echo lxc.network.link = br0 >> /srv/lxc/$container/config -echo lxc.network.ipv4 = 192.168.1.$addr/24 >> /srv/lxc/$container/config -echo lxc.network.hwaddr = 00:16:53:00:01:$addr >> /srv/lxc/$container/config - -lxc-create -n $container -f /srv/lxc/$container/config +( + echo + echo '# networking' + echo lxc.utsname = $container + echo lxc.network.type = veth + echo lxc.network.flags = up + echo lxc.network.link = br0 + echo lxc.network.ipv4 = 192.168.1.$addr/24 + echo lxc.network.hwaddr = 00:16:53:00:01:$addr +) >> /srv/lxc/$container/config echo > /srv/lxc/$container/rootfs/etc/network/interfaces @@ -55,6 +55,21 @@ for newuser in "${users[@]}"; do tar -cvvC /home/$newuser/ .ssh | chroot /srv/lxc/$container/rootfs/ tar -xvvC /home/$newuser/ done -( grep -v PermitRootLogin\\\|PasswordAuthentication /srv/lxc/$container/rootfs/etc/ssh/sshd_config -echo "PermitRootLogin no" -echo "PasswordAuthentication no" ) | sponge /srv/lxc/$container/rootfs/etc/ssh/sshd_config +( + grep -v PermitRootLogin\\\|PasswordAuthentication /srv/lxc/$container/rootfs/etc/ssh/sshd_config + echo PermitRootLogin no + echo PasswordAuthentication no +) | sponge /srv/lxc/$container/rootfs/etc/ssh/sshd_config + +( + grep -v ^exit /srv/lxc/$container/rootfs/etc/rc.local + echo ip route add default via 192.168.1.1 +) | sponge /srv/lxc/$container/rootfs/etc/rc.local + +( + echo 127.0.0.1 localhost + echo 192.168.1.$addr $container +) > /srv/lxc/$container/rootfs/etc/hosts + +lxc-create -n $container -f /srv/lxc/$container/config + |