I am pretty happy with how I set up my home lab so far. A simple and free solution, but can meet nearly all my needs.
I run all my test machines as VirtualBox virtual machines on my Ubuntu laptop. I setup an RHEL 5.5 box as the main infrastructure server in my lab domain – my.lab. It provides the DNS, NIS, NFS, Web, DB, Samaba, Mail, FTP, Spacewalk… services. The Ubuntu laptop is used as a Router/NAT device which provides the Internet connection to my.lab domain.
To enable the Routing and NAT on Ubuntu, the following two things need to be done:
1) Enable ip forwarding.
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
To make it permanent, set ‘net.ipv4.ip_forward=1’ in /etc/sysctl.conf
2) Allow masquerade in iptables.
iptables -P FORWARD ACCEPT
iptables –table nat -A POSTROUTING -j MASQUERADE
To make it permanent, save the iptables setting and restore when the server boots up.
iptables-save > /etc/iptables/iptables.rules
Add ‘iptables-restore < /etc/iptables/iptables.rules’ in the /etc/rc.local file.