dhcp

PXE Boot – Thin Client LTSP Config

The main component of LTSP (Linux Terminal Server Project) is the dhcp configuration. To start install the required packages:

sudo apt-get install ltsp-utils ltsp-server ltsp-server-standalone

Then open /etc/ltsp/dhcpd.conf, which is a template of your possible dhcp3 configuration. To makes things simple just use everything in this file as the configuration for dhcp, otherwise if you are comfortable configuring the option feel free; they can be configured many ways! The main dhcpd configuration file is located in /etc/dhcp3/dhcpd.conf. Do not forget to turn off the dhcp server in your router!!!!!! This will cause conflict. Also include next-server “serverip” in the dhcpd configuration. This is required to point secondary ip traffic, during PXE boot, to the ltsp server. Now just build your client environment and your ready to PXE boot:

ltsp-build-client

There are additional lstp configurations that can be done with ltspadmin. You can use ltspadmin to set a gdm login screen for your thin clients; I prefer to not use the gdm. You can use ltspadmin with:

sudo ltspadmin

The rest is terminal graphics. You can monitor the status of your various ltsp components, and set additional sometimes necessary configurations.

Now you might get stuck at various places. One place is the tftp during the pxe boot process. This may be the setting the export correctly in /etc/exports. Add if its not there:

/opt/ltsp *(ro,no_root_squash,async,no_subtree_check)

Then maybe you need to configure the next server option. DHCP is configure in /etc/ltsp/, and not directly in the dhcp /etc directory. Add or uncomment accordingly:

next-server ip.address.of.server;

The whole kit and kaboodle is described in greater detail on the debian wiki.

Network Interfaces Configuration File

In your /etc ditectory is the network folder. In the network folder is the interfaces file that contains all the data used to configure your network. The default configuration is dhcp. You can configure this file manually, to a limited degree, via the administration>>network panel. For most applications dhcp will be fine, and therefore you can leave your default configuration. If you want to setup a static ip, for your primary ethernet card, use the administration>>network configuration menu. You can set any static local ip outside the range of the dhcp configuration on your router. You can disable the dhcp of your router to set static addresses for the lower safe range. The default dhcp range is typically 192.168.0.2 to 1982.168.0.50. After disabling dhcp you can disable network manager in the preferences>>sessions configuration menu. If you are using a bridge and tap I highly recommend direct configuration of your interfaces via the /etc/network/interfaces file. Please refer to my previous post for more information about bridge and tap configuration.

VirtualBox Host Networking Set Host Static Local IP

If you are running a guest operating system, and are utilizing host networking via a bridge and tap, you should set the host IP address statically. On my other machine I was able to utilize DHCP for the host IP, but on this machine when the guest IP address is set the host has trouble DHCP’ing and new IP address. Overall setting IP address statically is important to keep track of utilized and available IP addresses. DHCP is really only useful in practice when anonymous machines are connecting and the MAC addresses are new to the router.

Virtual Server Can Fool Hackers – Backup/Restore is Easy

When a virtual server is utilizing the host systems network, and receives an independent local IP via DHCP from your router it appears to be an actual computer form the outside world. If a backup of the VDI is kept regularly it can simply replace a damaged, or hacked system in the time it takes to copy a file. Virtual servers exist as a single VDI file, therefore for blogs that utilize database backends simply copy your backup server VDI image, boot, then use your phpmyadmin to update your mysql databases from your backups; obviously this entails keeping mysql database backups. For more information about mysql backups utilizing automated cron scripts see: http://www.bgevolution.com/blog/index.php/cron-server-backup-scripts/

VirtualBox Host Networking (Grab an IP Via DHCP)

A little diagram of an IP address (IPv4)
Image via Wikipedia

I use the following commands in a boot script. I posted about this a while back, and ran into some trouble re-doing the procedure, so I though I would post about what I learned the second time around.

Replace “primaryusername” with the user that you login with. Replace eth0 with your primary adapter name. Replace 192.168.0.11 with an unused IP address that is provided by your DHCP server. Replace 192.168.0.2 with another IP address that is provided by your DHCP server. Make sure both IP addresses are not currently in use!!!!!!

sudo tunctl -t tap0 -u primaryusername

sudo chmod 666 /dev/net/tun

sudo /usr/sbin/brctl addbr br0

sudo /sbin/ifconfig eth0 0.0.0.0 promisc

sudo /usr/sbin/brctl addif br0 eth0

sudo /sbin/dhclient br0

sudo /usr/sbin/brctl addif br0 tap0

sudo ifconfig tap0 192.168.0.11 up

sudo bash -c ‘echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp’

sudo route add -host 192.168.0.2 dev tap0

sudo arp -Ds 192.168.0.2 eth0 pub

After these commands are run, configure your VirtualBox to use Host Networking, with the device name being tap0.

Reblog this post [with Zemanta]

VirtualBox Guest IP Address

UPDATE: VirtualBox host networking is much easier now, and is completely automated on both Windows and Linux.

There are two ways to interact with your guest operating system. You can either forward a port on the host machine, or you can have the guest operating system utilize dhcp to retrieve an IP address from your router. The following are three terminal commands, utilizing the VBoxManage command with a variety of options. To forward a port to your guest OS do the following; replace guestOS with your VirtualBox OS, port 2222 with the port on your host machine that you want to forward, and port 22 for the desired port on the guest OS:

VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort 2222

VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort 22

VBoxManage setextradata guestOSname VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol TCP

Now this method I find really really really cool !!! We are going to configure your VirtualBox guest OS to get a regular IP address from your routers DHCP server. By doing this you will be able to access your VirtualBox guest OS as you would any regular computer. Doing this really establishes a Virtual Operating System that truly and completely functions as a real computer. First install a couple of files via apt; the packages were in my Debian Etch repositories, therefore I have no doubt that they are in Ubuntu’s: sudo apt-get install bridge-utils uml-utilities The best part it its only a couple of command that can be thrown in a script that is automatically run on boot. Add the following lines to a script, you can name the file something like “virtualbridge.sh”:

#replace user with the main username that you use to login
sudo tunctl -t tap0 -u user
sudo chmod 666 /dev/net/tun
sudo /usr/sbin/brctl addbr br0 sudo /sbin/ifconfig eth0 0.0.0.0 promisc
sudo /usr/sbin/brctl addif br0 eth0 sudo /sbin/dhclient br0
sudo /usr/sbin/brctl addif br0 tap0 #replace tap0ipaddress with an unused local ipaddress
sudo ifconfig tap0 tap0ipaddress up
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp' #replace hostipaddress
sudo route add -host hostipaddress dev tap0 #also replace hostipaddress with the host ip address
sudo arp -Ds hostipaddress eth0 pub
#END of SCRIPT

Now configure your VirtualBox Guest OS to use the tap0 network interface. This can all be done graphically. Add these lines to a empty new text file and name it what you wish. Set it to be executable with a quick chmod 777 command. Add it to your sessions to be automatically run on user login. Also add your VirtualBox OS to boot on login; you can do this with:

#replace GuestOS with the desired GuestOS
VBoxManage startvm GuestOS

Now your script will run automatically on login, and the GuestOS will automatically boot. Viola, you now have a GuestOS that automatically boots, and is practically indistinguishable from a real computer complete with a real local ipaddress :)