Showing posts with label Internet. Show all posts
Showing posts with label Internet. Show all posts

Friday, 25 March 2016

Linux Containers on Virtualbox - Disposal Boxes

Hey look, a month went by and I stopped blogging because I have a new job. Great. 
One of my responsibilities is keeping an eye on our sprawling Github account, currently at 326 repositories and 151 members. The current fellows are working on a huge number of projects and I frequently need to be able to quickly install, test and run projects with a weirdly-large variety of backend and server technologies. So, it’s become incredibly important to me to be able to rapidly spin up disposable Linux web servers to test with. Seth clued me in to Linux Containers (LXC) for this: 
LXC provides operating system-level virtualization not via a full blown virtual machine, but rather provides a virtual environment that has its own process and network space. LXC relies on the Linux kernel cgroups functionality that became available in version 2.6.24, developed as part of LXC. … It is used by Heroku to provide separation between their “dynos.”
I use a Mac, so I’m running these under Virtualbox. I move around between a number of different networks, so each server container had to have a no-hassle network connection. I’m also impatient, so I really needed to be able to clone these in seconds and have them ready to use. 
This is a guide for creating an Ubuntu Linux virtual machine under Virtualbox to host individual containers with simple two-way network connectivity. You’ll be able to clone a container with a single command, and connect to it using a simple <container>.local host name. 

The Linux Host

First, download an Ubuntu ISO. I try to stick to the long-term support releases, so I’m using Ubuntu 12.04 here. Get a copy of Virtualbox, also free. 
Create a new Virtualbox virtual machine to boot from the Ubuntu installation ISO. For a root volume, I selected the VDI format with a size of 32GB. The disk image will expand as it’s allocated, so it won’t take up all that space right away. I manually created three partitions on the volume: 
  1. 4.0 GB ext4 primary.
  2. 512 MB swap, matching RAM size. Could use more.
  3. All remaining space btrfs, mounted at /var/lib/lxc.
Btrfs (B-tree file system, pronounced “Butter F S”, “Butterfuss”, “Better F S”, or “B-tree F S") is a GPL-licensed experimental copy-on-write file system. It will allow our cloned containers to occupy only as much disk space as is changed, which will decrease the overall file size of the virtual machine. 
During the OS installation process, you’ll need to select a host name. I used “ubuntu-demo” for this demonstration. 

Host Linux Networking

Boot into Linux. I started by installing some basics, for me: gitvimtcshscreenhtop, and etckeeper
Set up /etc/network/interfaces with two bridges for eth0 and eth1, both DHCP. Note that eth0 and eth1 must be commented-out, as in this sample part of my /etc/network/interfaces
## The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
        dns-nameservers 8.8.8.8
        bridge_ports eth0
        bridge_fd 0
        bridge_maxwait 0

auto br1
iface br1 inet dhcp
        bridge_ports eth1
        bridge_fd 0
        bridge_maxwait 0
Back in Virtualbox preferencese, create a new network adapter and call it “vboxnet0”. My settings are 10.1.0.1, 255.255.255.0, with DHCP turned on. 


Shut down the Linux host, and add the secondary interface in Virtual box. Choose host-only networking, the vboxnet0adapter, and “Allow All” promiscuous mode so that the containers can see inbound network traffic. 

The primary interface will be NAT by default, which will carry normal out-bound internet traffic. 
  1. Adapter 1: NAT (default)
  2. Adapter 2: Host-Only vboxnet0
Start up the Linux host again, and you should now be able to ping the outside world. 
% ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=63 time=340 ms
…
Use ifconfig to find your Linux IP address (mine is 10.1.0.2), and try ssh’ing to that address from your Mac command line with the username you chose during initial Ubuntu installation. 
% ifconfig br1

br1       Link encap:Ethernet  HWaddr 08:00:27:94:df:ed  
          inet addr:10.1.0.2  Bcast:10.1.0.255  Mask:255.255.255.0
          inet6 addr: …
Next, we’ll set up Avahi to broadcast host names so we don’t need to remember DHCP-assigned IP addresses. On the Linux host, install avahi-daemon
% apt-get install avahi-daemon
In the configuration file /etc/avahi/avahi-daemon.conf, change these lines to clarify that our host names need only work on the second, host-only network adapter: 
allow-interfaces=br1,eth1
deny-interfaces=br0,eth0,lxcbr0
Then restart Avahi. 
% sudo service avahi-daemon restart
Now, you should be able to ping and ssh to ubuntu-demo.local from within the virtual machine and your Mac command line. 

No Guest Containers

So far, we have a Linux virtual machine with a reliable two-way network connection that’s resilient to external network failures, available via a meaningful host name, and with a slightly funny disk setup. You could stop here, skipping the LXC steps and use Virtualbox’s built-in cloning functionality or something like Vagrant to set up fresh development environments. I’m going to keep going and set up LXC. 

Linux Guest Containers

Install LXC
% sudo apt-get lxc
Initial LXC setup uses templates, and on Ubuntu there are several useful ones that come with the package. You can find them under /usr/lib/lxc/templates; I have templates for ubuntu, fedora, debian, opensuse, and other popular Linux distributions. To create a new container called “base” use lxc-create with a chosen template. 
% sudo lxc-create -n base -t ubuntu
This takes a few minutes, because it needs retrieve a bunch of packages for a minimal Ubuntu system. You’ll see this message at some point: 
##
# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.
##
Without starting the container, modify its network adapters to match the two we set up earlier. Edit the top of/var/lib/lxc/base/config to look something like this: 
lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up
lxc.network.hwaddr = 00:16:3e:c2:9d:71

lxc.network.type=veth
lxc.network.link=br1
lxc.network.flags=up
lxc.network.hwaddr = 00:16:3e:c2:9d:72
An initial MAC address will be randomly generated for you under lxc.network.hwaddr, just make sure that the second one is different. 
Modify the container’s network interfaces by editing /var/lib/lxc/base/rootfs/etc/network/interfaces (/var/lib/lxc/base/rootfsis the root filesystem of the new container) to look like this: 
auto eth0
iface eth0 inet dhcp
        dns-nameservers 8.8.8.8

auto eth1
iface eth1 inet dhcp
Now your container knows about two network adapters, and they have been bridged to the Linux host OS virtual machine NAT and host-only adapters. Start your new container: 
% sudo lxc-start -n base
You’ll see a normal Linux login screen at first, use the default username and password “ubuntu” and “ubuntu” from above. The system starts out with minimal packages. Install a few so you can get around, and include language-pack-en so you don’t get a bunch of annoying character set warnings
% sudo apt-get install language-pack-en
% sudo apt-get install git vim tcsh screen htop etckeeper
% sudo apt-get install avahi-daemon
Make a similar change to the /etc/avahi/avahi-daemon.conf as above: 
allow-interfaces=eth1
deny-interfaces=eth0
Shut down to return to the Linux host OS. 
% sudo shutdown -h now
Now, restart the container with all the above modifications, in daemon mode. 
% sudo lxc-start -d -n base
After it’s started up, you should be able to ping and ssh to base.local from your Linux host OS and your Mac. 
% ssh ubuntu@base.local

Cloning a Container

Finally, we will clone the base container. If you’re curious about the effects of Btrfs, check the overall disk usage of the/var/lib/lxc volume where the containers are stored: 
% df -h /var/lib/lxc

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        28G  572M   26G   3% /var/lib/lxc
Clone the base container to a new one, called “clone”. 
% sudo lxc-clone  -o base -n clone
Look at the disk usage again, and you will see that it’s not grown by much. 
% df -h /var/lib/lxc

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        28G  573M   26G   3% /var/lib/lxc
If you actually look at the disk usage of the individual container directories, you’ll see that Btrfs is allowing 1.1GB of files to live in just 573MB of space, representing the repeating base files between the two containers. 
% sudo du -sch /var/lib/lxc/*

560M /var/lib/lxc/base
560M /var/lib/lxc/clone
1.1G total
You can now start the new clone container, connect to it and begin making changes. 
% sudo lxc-start -d -n clone
% ssh ubuntu@clone.local

Conclusion

I have been using this setup for the past few weeks, currently with a half-dozen containers that I use for a variety of jobs: testing TileStache, installing Rails applications with RVM, serving Postgres data, and checking out new packages. One drawback that I have encountered is that as the disk image grows, my nightly time machine backups grow considerably. The Mac host OS can only see the Linux disk image as a single file. 
On the other hand, having ready access to a variety of local Linux environments has been a boon to my ability to quickly try out ideas. Special thanks again to Seth for helping me work through some of the networking ugliness. 

Further Reading

Tao of Mac has an article on a similar, but slightly different Virtualbox and LXC setup. They don’t include the promiscuous mode setting for the second network adapter, which I think is why they advise using Avahi and port forwarding to connect to the machine. I believe my way here might be easier. 
Shift describes a Vagrant and LXC setup that skips Avahi and uses a plain hostnames for internal connectivity.

The Owner of this post is Michal Migurski
Find is Blog here http://mike.teczno.com/notes/disposable-virtualbox-lxc-environments.html 

Thursday, 24 March 2016

How To Add All Friends To Facebook Group By Single Click – 2016

Facebook groups are best place for any discussion with your own choice friends or other members. No one from outside can interfere in group without admin permission means groups are totally different from pages. In pages every person is free to like page. Groups can be secret, closed or public. But the problem we face in groups is that, we have to add all member manually one by one. Which is time consuming process. As in my recent post i discuss about Invite All Friends to Like Facebook Pages. Which is helpful for inviting too many friend to Facebook page within few secs and its totally time saving method. But that process is only working on Facebook page not on Facebook group. Today i will discuss about method to add all member in Facebook group. Sometimes we had an account with 5000 or less friends. So its not an easy task to add too many friends and you face difficulty while adding them one by one. Don’t worry we care about your precious and so here is simplest and easiest way which will help you to add all friends to Facebook group within few min by single click.

Steps To Add All Friends To Facebook Group


  • First of all Log in into that account whose friends you want to invite.
  • Then open your Facebook Group in which you want to add friends.
  • Now Click F12 button to open debugger and then select console box.
  • Now copy script from below given button.
  • Copy paste the whole provided code and then paste them into console box.
add-all-friends-to-facebook-group-script-code
  • Press enter and process will start for sending invitation.
Note:- Don’t worry about anything this script is totally safe. In case you have too many friends then you get blocked for using groups or even your account may get locked. So be careful.
If Face any type of problem and want any type of suggestion just feel free to share your comment.

How To Create Wifi Hotspot In Windows Laptop Or PC

As we all know 21st century is an era of Internet. An Internet is a fast growing technology which provides every information in all over the world, you have to just search it on internet and you can find  information  related on any topic. With the increasing of new technologies Mobile phones, tablets are also growing very fast within the few decades. If you have a WiFi enable mobile phone, Tablet or an Ipad then you can easily connect your devices to available WiFi network in the public place, office or in the college, but in the home mostly people have only single connection (wired internet connections) or have not  WiFi router. Don’t worry, you can also connect your devices with your internet without any help of WiFi router. You have to just create an WiFi hotspot connection in your PC or Laptop. To Create WiFi Hotspot in Windows is not a very difficult task. You can easily create WiFi hotspot in your windows PC or Laptop by just doing simple steps which we discuss below.

Method 1:- How To Create WiFi Hotspot With Software.

In this method firstly you have to download software. After installing the software it will tell you creating your WiFi Hotspot username and password. Simply just create username and password according to you. Then click on start or activate button it will automatically create to you WiFi Hotspot, next whenever any user want to access your WiFi hotspot they have to put password first which is provided by you then they can access your WiFi hotspot network. So its just simple method and you can easily create a WiFi hotspot access point on your windows 7/8/8.1 PC or Laptop and you do not have to use any WiFi router.  So here we provide two software’s which is best and free for creating WiFi Hotspot on you PC or Laptop.

#1 mhotspot.
mHotspot is an free and easy method to create WiFi Hotspots with WiFi enable windows 7/8/8.1 on PC or Laptop. This software converts your computer or laptop windows into virtual WiFi router which can connect upto 10 devices. You can also share any type of internet connection including 3G/4G, LAN and Ethernet with the fully secured connection.
mHotspot
  • It is easy to use.
  • Security Features:- WPS, WPA2 and WEP password security.
  • The mHotspot also shows the number of devices connected, you can see sent and received data, and other log data.
OR USE
My WiFi router is another free software which converts your windows 7 & 8 PC/Laptop into WiFi hotspots. You can share the internet easily with My WiFi router software anywhere and anytime. Just download and install the software and place a your username and password according to you and click on activate button.
My WiFi Router
  • It is easy to create a secure WiFi hotspot with My WiFi router.
  • Share internet any kind of internet connection (3G/4G, Ethernet & LAN).
  • You can display and manage the connected devices(limit internet speed, blocklist).
  • You can extend your WiFi range.
Note:- Those who have desktop PC they have to first buy Bluetooth device then they will be able to create WiFi hotspot either they will not be able to create.

Method 2:- How To Create WiFi Hotspot With CMD.

In this method we will explain you that how to create WiFi hotspot in windows 7/8/8.1 PC or Laptop through command prompt. These are the simple steps to create WiFi hotspot.

Step 1:- Enable the Microsoft Virtual WiFi Miniport Adaptor.

  • To enable this first open “RUN” dialogue box using (“Window Key”+”R”).
  • After open the Run dialogue box type in it “cmd”. It will open your command prompt or in case you are not able to find by this way simply search at start for cmd you will easily get.
  • Run the command prompt under Administrator privileges by doing right click on cmd and select  (Run as Administrator) .
  • Once the command prompt open type in the below given command.
NETSH WLAN SET HOSTEDNETWORK MODE=ALLOW SSID=HOTSPOT KEY=PASSWORD 
command to create WiFi hotspot in windows PC or laptop
#1 SSID is your username that will show on the connection.
#2 Key is the password of your WiFi Hotspot connection.
#3 You can also create SSID and Key accroding to you !.

Step 2:- Starting WiFi Hotspot Connection.

  • After creating Hosted Network next you have to start it.
  • For starting WiFi hotspot connection, type in the command prompt given below command.
NETSH WLAN START HOSTED NETWORK
command to create WiFi hotspot in windows PC or laptop

Step 3:- Configuring Microsoft Virtual WiFi Miniport Adapter.

  • Go to Network and Sharing Center where you will see your created network.
  • Next go to right side and you will see change adapter setting click on it.
windows network and sharing
  • Then click on the Ethernet >> Properties.
ethernet properties
  • It will show you new dialogue box. Click on Sharing >> Tick on Allow network user. As show in the given image.
  • Select Local Area Connection*12 which we created.
  • And then click ok.
ethernet properties for wifi hotspot

Some Other Commands.

  • If you want to stop network connection then simply open your command prompt under administrator privileges and type below give command.
NETSH WLAN STOP HOSTEDNETWORK 
  • Or if you want to change your network Password then type below given command in the command prompt.
NETSH WLAN REFRESH HOSTEDNETWORKYOURNEWPASSWORD
Back to Top