Sunday, January 31, 2010
Finding Subnet and Broadcast
ok, let's find, still remember how to find prefix? if you forget, please read here
/ 29 means 255.255.255.248, which note is that the value is not equal to 255, subtract that value by 256
256 to 248 = 8
needs in mind, the reduction is the key, K = 8. well, after it noticed its ip address, 192.168.0.18, key values must be at times the numbers do not exceed the value of the ip, in the example is 18, so 8 * 2 = 16, because 8 * 3 = 24 is higher than ip. 18. is already on to the network, well, to find the ip that can be used first, just add ip network + 1 = 17.After was broadcast live on the search, how, (Key + Network) - 1 = 23, to search for the last ip, live broadcast - 1 = 22.
Subnet Prefix
/ 22 or / 28 is called a prefix, as we know, ipv4 consisted of 4 octed or 32 bits, if we have 192.168.0.0/28 network, meaningful in a 28-bit binary networks (translated by 1) and rest (4 bits) is the host.
to find what ip that can be used 2n-2 ^ 2 = 4 x 2 = 14 hosts, if the 192.168.0.0/28 ip means that it can be in use is 192.168.0.1 to 192.168.0.14, because the 192.168.0.0 in use as network and 192.168.0.15 used as the broadcast.
well, to find the subnet mask from prefix / 28 was, because there are 28 bits network and host the 4-bit binary in writing as follows:
11111111.11111111.11111111.1111 0000
if translated into a decimal, becomes: 255.255.255.240
Know Linux partition and Directory
This partition is usually used for storing temporary files, is required before linux can mount the partition / usr.File-file as Boot Linux kernel and image, and all binary files as well as many important log files are also important. This partition is also used for temporary space when the operating system that requires performance, such as building or create a RPM packet from the source RPM files.
/ usr
This partition one partition that requires a large space, since many binary files in need linux, like many software installation, web pages, Squid proxy cache, Samba share files, all the local installation log files and other stored here.
Some local directory / usr:
# / usr / doc
Documentation relating to the installation program.
# / usr / bin
Execute the program is not required when booting or repair is usually only system.Program utility tools .. etc
# / usr / local / src
Source code for application installation
/ home
This partition to use for home directory of each user, is required if you provide a shell account to each of this partition user.
SWAP
Linux provides something called virtual memory, this partition is in accordance with this functuin.Partition made two times larger than the size of physical RAM is available, when the physical memory available RAM is full, SWAP partitions are used to help.
/ var
This partition is used to store variable files, files in / var is dynamic and continuously in writing or there is a change.
Some local directory to / var:
# / Var / spool
File Print Jobs, mail spool etc ..
# / var / log
File that contains the log information
# / var / run
File that contains the process ID, the service is running ..
/ boot
Partitions are used to store the file directory that is required when linux did booting.Like the vmlinux file, and the linux kernel files etc ..
/ etc
Directory that contains the local machine configuration file, save the configuration program in this directory and the file becomes a reference when running the program.
/ mnt
Used to mount the file system temporarily, when the mount cdrom or usb mount point flashdisk.Standar location is located at / mnt / cdrom or / etc .. mnt/sda1
/ proc
Provides information and processes running kernel.Directory information is used as information systems hardware such as RAM, CPU etc. ..
Simple Bash Script
################
#!/bin/sh #
#Script Adduser#
################
echo -n “Insert Username = “;
read name
echo -n “Insert yourname = “;
read namacomplete
echo “Add User”
/usr/sbin/useradd -c”$namacomplete” $name
echo “Insert Password”
/usr/bin/passwd $name
———————–
#######################
#!/bin/sh #
#171207 #
#Script Add IP Address#
#######################
echo “Example Interface = eth0″;
echo -n “Interface = “;
read interface
echo -n “Add IP Address = “;
read ip
echo -n “Subnetmask = “;
read subnetmask
echo -n “Default Gateway = “;
read gateway
echo -n “DNS Server = “;
read dns
echo “Add IP Address”;
/sbin/ifconfig -a $interface $ip $netmask
echo “Add Default Gateway”;
/sbin/route add default gw $gateway
echo “Add DNS Server”;
echo “nameserver $dns” > /etc/resolv.conf
——————————
##############################
#!/bin/sh #
#171207 #
#Script Add Virtual Interface#
##############################
echo “Example Interface Virtual = eth0:1″;
echo -n “Interface Virtual= “;
read interface
echo -n “Insert IP Address = “;
read ip
echo -n “Subnetmask = “;
read subnetmask
echo “Add Interface Virtual”
/bin/touch /etc/sysconfig/network-scripts/ifcfg-$interface
echo “DEVICE=$interface” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “BOOTPROTO=static” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “IPADDR=$ip” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “NETMASK=$subnetmask” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “Restart Service Network”;
/etc/init.d/network restart
———————————–
###################################
#!/bin/sh #
#171207 #
#Script Transparant Proxy #
###################################
echo -n “Insert source ‘IP/NETMASK’ =”;
read source
echo -n “Insert Destination ‘IP/NETMASK’ =”;
read destination
echo -n “Insert Protocol =”;
read protocol
echo -n “Insert Destination Port =”;
read dport
echo -n “Insert Redirect Port =”;
read redirect
echo “Create redirect rule”
/sbin/iptables -t nat -I POSTROUTING -s $source -o etho -j MASQUERADE
When IT Guys sing songs
By : Beatles
Yesterday,
All those backups seemed a waste of pay
Now my database has gone away
Oh I believe in yesterday…..
Suddenly,
There’s not half the files there used to be
And there’s a milestone hanging over me
The system crashed so suddenly
I pushed something wrong
What it was I could not say
Now all my data’s gone and I long for yesterday-ay-
ay-ay
Yesterday,
The need for back-ups seemed so far away
I knew my data was all here to stay
Now I believe in yesterday
IMAGINE
by : John Lennon
Imagine there’s no Windows
It’s easy if you try
No fatal errors or new bugs
To kill your hard drives
Imagine Mr. Bill Gates
Leaving us in peace!
Imagine never ending hard disks
It isn’t hard to do
Nothing to del or wipe off
And no floppy too
Imagine Mr. Bill Gates
Sharing all his money
You may say I’m a hacker
But I’m not the only one
I hope someday you’ll join us
And your games will fit in RAM
Imagine 1-Giga RAM
I wonder if you can
No need for left-shifts or setups
And no booting again and again
Imagine all the systems
Working all life-time!
You may say I’m a hacker
But I’m not the only one
Maybe someday I’ll be a cracker
And then I’ll make Windows run…..
LET IT BE
By : Beatles
When I find my code in tons of trouble
Friends and colleagues come to me
Speaking words of wisdom: Write in C
As the deadline fast approaches
And bugs are all that I can see
Somewhere, someone whispers: Write in C
Write in C, Write in C
Write in C, oh, Write in C
LOGO’s dead and buried
Write in C
I used to write a lot of FORTRAN
For science it worked flawlessly
Try using it for graphics!
Write in C
If you’ve just spent nearly 30 hours
Debugging some assembly
Soon you will be glad to Write in C
Write in C, Write in C
Write in C, yeah, Write in C
BASIC’s not the answer
Write in C
Write in C, Write in C
Write in C, oh, Write in C
Pascal won’t quite cut it
Write in C