Sunday, April 27, 2008

Cari file dan content

aku sering lupa benda kecil2 camni...

nak cari file dan extension

find /mnt/win/backup/mp3 -type f -name "*inta*.mp3" >> /ice/skbj.lst

cari kandungan dalam file

grep apaapaaje *

@

grep "apa apa aje" *

@

grep apaapaaje */*

cari file

which

@

locate

Thursday, April 17, 2008

Another VLANs Guide on Debian

Suppose you have a layer 2 switch with support for 802.1q, and want to route traffic from one VLAN to another VLAN you can use a linux box for that.

VLAN is Virtual Lan and it is created with equipments such as switches that support the 802.1q protocol, which manage to insert a 'tag' in the ethernet frame, this tag identifies the VLAN to which a packet belongs.

If you have two VLANs in a switch is like having physically two switches, as the packets from one does not pass to the other, if you need to pass traffic from one to another VLAN you will a layer 3 switch, and enable the internal virtual
router, but you can do that with a Linux Box, this way.

#apt-get install vlan

-- this is to install the vlan software --
#modprobe 8021q

-- This is to load the 802.1q module --
#vconfig add eth0 2

#vconfig add eth0 3

-- Creating two vlans over the eth0 interface --
#ifconfig eth0 0.0.0.0 up
-- To make only the VLAN interfaces to have traffic, be sure you have the eth0 up or you will see no traffic at all


#ifconfig eth0.2 10.1.1.1 broadcast 10.1.1.255 netmask 255.255.255.0 up
#ifconfig eth0.3 10.1.2.1 broadcast 10.1.2.255 netmask 255.255.255.0 up

-- Assume you have this two VLANs 1 is 10.1.1.0/24 and the second is 10.1.2.0/24 and you want traffic between them --
Now you have this done, configure your one of your switch ports to belong to VLAN 2 and 3 at the same time, and connect your
linux box to that port.

#echo 1 > /proc/sys/net/ipv4/ip_forward

-- To enable packet forwarding on the linux router --

#route add -net 10.1.1.0 netmask 255.255.255.0 gw eth0.2
#route add -net 10.1.2.0 netmask 255.255.255.0 gw eth0.3

That should be all.If you want to see what is happening you can use Ethereal on your
linux and will get a graphic like this
http://jaws.go2linux.org/pics/Screenshot-vlan.png

VLAN configuration on Ubuntu (Debian)

Here is a quick guide how to enable VLANs on Ubuntu or Debian box.
VLANs on Linux will work with the most of the modern ethernet adapters. Frankly speaking I have not came across of adapter it would not work with.I presume that you use standard kernel shipped with Ubuntu. However, if you use a custom built kernel make sure VLAN support is enabled in it.


In this example I want my computer to connect to vlan4,vlan5 and vlan101. My default gateway is in vlan101. And I have only one ethernet interface eth0.

Note: If you want to connect to only one VLAN or you have many network interfaces it is possible to do as well.

OK, now how to do this:
1. Install VLAN package on your computer:
sudo apt-get install vlan

2. Edit your /etc/network/interfaces file so it would contain the following:

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto vlan4
auto vlan5
auto vlan101

# VLAN 4
iface vlan4 inet static
address 192.168.0.8
netmask 255.255.255.192
network 192.168.0.0
broadcast 192.168.0.63
mtu 1500
vlan_raw_device eth0

# VLAN 5
iface vlan5 inet static
address 10.0.111.8
netmask 255.255.255.0
network 10.0.111.0
broadcast 10.0.111.255
mtu 1500
vlan_raw_device eth0

# VLAN 101
iface vlan101 inet static
address 172.12.101.8
netmask 255.255.255.0
network 172.12.101.0
broadcast 172.12.101.255
gateway 172.12.101.1
mtu 1500
vlan_raw_device eth0

Note: You have to replace my IP addresses, network maskes and gateway IP address with your own.

3. Make sure that switch interface you are connected to configured with respective VLANs.

4. Restart your network interface:
sudo /etc/init.d/networking restart

You should see something like:

Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 4 to IF -:eth0:-
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 5 to IF -:eth0:-
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 101 to IF -:eth0:-

And this is it. Nice and easy. Happy VLANing!

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...