Skip to main content

Posts

Showing posts from October, 2012

Creating VM-II

Yeah probably if somebody http://blogs.eskratch.com/2012/10/create-your-own-vms-i.html tried this, you would have faced problems in network connectivity either to the host or vm. Documentation for LXC sucks. So lets quickly go through a series of steps to make host and container accessible

Requirements : The system should be connected to internet via ethernet. Use a ubuntu host

So lets use the dhcp proto to assign ips to our containers instead of static ips, remove lxc.network.pv4 from conf file
its enough for the conf file to have

lxc.utsname = beta
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0

Now create a bridge    brctl addbr br0
Attach the bridge with interface eth0    brctl addif eth0 You should lose our internet connectivity bcoz during bridging eth0 enters promiscuous mode(where it reads all packets on network and forward to bridge, if the bridge knows the ip, forwards it, else drops it)   ifconfig br0 up create a lxc container of ubuntu   lxc-create -…

Create your own VMs - I

LXC(Linux Containers:http://en.wikipedia.org/wiki/LXC) is a virtualization technique which provides os and network stack level isolation. It allows to run multiple OS distros on a host machine with isolated process listings, user groups, ip addressing. The only constraint is all  these containers and host machines should use same kernel(http://en.wikipedia.org/wiki/Linux_kernel). It make use of cgroups, a new feature addition to latest linux kernels.

What is cgroup
Cgroup associates each task to a subsystem and the subsystem allocates resources shared fro host machine. One can even control amount of resources by passing them as parameter. There can be heirarchy of cgroups i.e cgroups within cgroups(in precise vm within vm)
Have a look at http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt to get a taste of cgroup

Create our VM
This works without any issue in Ubuntu host.
1)install lxc
2)create a mount point for vms

    mkdir -p /cgroup

    mount none -t cgroup /cgroup

3)create …

Data Link Layer

Came across this question in Quora https://www.quora.com/TCP-IP/What-is-the-main-purpose-of-Data-link-layer-in-TCP-IP-or-OSI-layer.
So what DLL layer does when I know the ip and port from ip and tcp layer?
Actually ip layer just specifies the destination ip. Say if I need to route a packet from a network A to C via network B. A ip address of host in network C will be in the destination ip field of IP header.
The ip layer in the host finds the route from the routing table(use route -n to see the available routes)  and sends a ARP request to find the mac address of the host matching the route, then send the packet to the host by placing its mac address in segment header. Now the packet reaches the router of network A. Now the router finds the route for the host in network C from its routing table and place that mac address and send the packet to a router in B network which does the same to push the packet to router in network in C and finally to the destination host.
Routes can have ip…