Wednesday, July 11, 2012

Creating and Binding bridge interface with tap and ethernet interface

Here i have written a script which firstly set the interface setting then load a virtual OS for host Ubuntu 12.04
i don't know it will work for other Ubuntu version or not....


start.sh ...

#!/bin/bash

username=$(whoami)
echo "username is $username"
tdevice=$(sudo tunctl -u $username)
bridgename='br0'
ethname='eth0'
tapname='tap0'

echo "bridge= $bridgename"
echo "ethernet = $ethname"
echo "tapname= $tapname"



sudo brctl addbr $bridgename
echo "A bridge has been added"

sudo brctl addif $bridgename $ethname
echo "eth0 is added to bridge"

sudo brctl addif $bridgename $tapname
echo "tap0 is added to bridge"

sudo ifconfig $bridgename up
echo "up bridge interface"

sudo ifconfig $ethname up
echo "up ethernet interface"

sudo ifconfig $tapname up
echo "up tap interface"

sudo ifconfig $bridgename 192.168.68.75/24
echo "Giving IP address manually to bridge interface"

sudo ifconfig $ethname 0.0.0.0 promisc
echo "setting eth at promisc mode"

sudo ifconfig $tapname 0.0.0.0 promisc
echo "setting tap interface at promisc mode"

sudo ip route add default via 192.168.68.254
echo "setting the gateway for bridge"

echo "Starting Ubuntu Server"
kvm -hda ubuntu.vmdk -net nic,model=i82551 -net tap,ifname=tap0,script=no,downscript=no -net nic,model=i82551 -boot c

echo "Turning off Server Oh Yeah!!!"
. off.sh
------------------------------------------------------------------------------------------------------------






off.sh .....
#!/bin/bash

bridgename='br0'
ethname='eth0'
tapname='tap0'

output=$(sudo tunctl -d $tapname)
echo $output
echo "Deleting tap interface"

sudo ifconfig $ethname 192.168.68.75/24 up
echo "Setting eth interface ip address"

sudo ifconfig $bridgename down
echo "Down bridge interface"

sudo brctl delbr $bridgename
echo "Deleting bridge interface"

sudo ip route add default via 192.168.68.254
echo "Adding gateway for eth interface"


Saturday, March 10, 2012

Setting Proxy in Ubuntu

In Ubuntu we have to set Proxy at four different Places



1=> In Network Proxy Setting 
        ( System Menu -> Preferences -> Network Proxy)

figure showing the configuration of proxy in ubuntu

      Select Manual Proxy configuration
       Enter the IP of proxy server  as shown in figure
  

Adding user name and password if provided by network administrator


       Click the details button and enter your username and password if provided by Network Administrator



2=> In apt.conf file
        ( /etc/apt/apt.conf)

 if this file is there in the directory then edit as shown below otherwise create one.

  Type the following in the apt.conf file


 Acquire::http::proxy "http://username:password@192.168.1.103:3128/";
 Acquire::ftp::proxy "ftp://username:password@192.168.1.103:3128/";
 Acquire::https::proxy "https://username:password@192.168.1.103:3128/";


Here the IP address is the address of the proxy server and 3128 is the port number of the proxy.





3=> In Mozilla Firefox


  In Firefox go to Edit->Preferences->Advanced->Network->Setting
  Enter the Proxy server address and Port Number. 





4=> In Synaptic Package Manager

    Go to Setting-> Preferences -> Network
Enter the proxy server address and Port Number.






     Thank You.