Wednesday, August 24, 2011

Using tftp in Ubuntu 10.10

I tried to use tftp in ubuntu 11.04 but it was giving error. Maybe the support for ubuntu at the time of writing this blog is not available. So I tried using tftp in ubuntu 10.10 and it worked. So what you need to use tftp.

First you need to install tftp. For that use this command:-
$sudo apt-get install tftpd-hpa

Now the default directory which will be accessed while doing tftp to the server is having location address as :-
/var/lib/tftpboot
You can get this address by viewing the contents of tftpd-hpa file present at location "/etc/default/tftpd-hpa"

Now add all the files which you want to be accessed via tftp in this directory. This directory will appear as the parent directory.
Make sure you have given proper permissions to the files to be accessed.

Now simply goto command prompt and type "tftp <server_ip_address>" like "tftp localhost"
Now you will get a prompt as "tftp>""
Here you can write the commands.

For getting the file, type "get <filename_on_server>  <filename_to_be_used_o_client>" like:-
tftp> get rahul.txt new.txt

Now this file will be copied to you computer. It will be in the directory in which you are currently in. I.E. when you do tftp <host>, the directory in which you are there at that time, the file is copied to that directory.

Similarly to put the files on the tftp server, you need to use the command "put "filename" "server_path" "

To exit from the tftp command prompt, simply type "quit" and you will exit from it.

One thing to be kept in mind is that the path for tftp server starts from the tftpboot directory. So if you have rr directory inside tftpboot directory and want to access any file inside rr, then you have to specify the path as /rr/<filename>. Therefore, the default path starts from the tftpboot directory.

If you have any queries, then do comment, I would be happy to help...... :)

Tuesday, August 23, 2011

How to enable DHCP in Ubuntu 11.04

For DHCP, you will need to first install DHCP3-SERVER.
Open terminal and write "sudo apt-get install dhcp3-server

Once its installed, you need to check in few things:-
If your system is having more than one NIC, then you need to specify which nic is to be used for the DHCP service.
For that, type "sudo vi /etc/default/isc-dhcp-server"

Now in this, goto the line 'INTERFACES="" ' and enter the name of ethernet you want to use for dhcp there..... like 'INTERFACES="eth0" '

Now if your network adapter is getting IP via some other DHCP server, then you need to specify the subnet mask. So for that you need to modify the dhcpd.conf file. For that type "sudo vi /etc/dhcp/dhcpd.conf"
In that add this line "subnet <ip address> netmask <netmask_value>{} " like "subnet 192.168.233.129 netmask 255.255.255.0 {}"

Now restart the dhcp server and you will have it running. Type "/etc/init.d/isc-dhcp-server restart"

Now your dhcp server is running. You need to provide range that can be allocated in the dhcpd.conf file.....

Friday, August 12, 2011

VM creation using Python for XenServer

I tried for 4-5 days to create a VM for XenServer using Python and finally I am able to create a VM for XEN. Here I am going to tell you the basic steps needed to be performed to do the operations.

VM creation involves 3 things in common.
1. Creation of VM.
2. Creation of disk referred as VDI.
3. Creation of VBD which acts as a link between VM and Disk.
(Network card is the other optional thing which can be added.. for that you need VIF)

So, In the code, I have first created a Disk, then created a VM, and then passed both as parameters while creating VBD which will attach Disk to the VM. Here is the code:-