To display the entire contents of the IP routing table, type:
route print
To display the routes in the IP routing table that begin with 10., type:
route print 10.*
To add a default route with the default gateway address of 192.168.12.1, type:
route add 0.0.0.0 mask 0.0.0.0 192.168.55.1
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a persistent route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and the cost metric of 7, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and using the interface index 0x3, type:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
To delete the route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, type:
route delete 10.41.0.0 mask 255.255.0.0
To delete all routes in the IP routing table that begin with 10., type:
route delete 10.*
To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
-------------
-f : Clears the routing table of all entries that are not host routes (routes with a netmask of 255.255.255.255),
the loopback network route (routes with a destination of 127.0.0.0 and a netmask of 255.0.0.0),
or a multicast route (routes with a destination of 224.0.0.0 and a netmask of 240.0.0.0).
If this is used in conjunction with one of the commands (such as add, change, or delete), the table is cleared prior to running the command.
-p : When used with the add command, the specified route is added to the registry
and is used to initialize the IP routing table whenever the TCP/IP protocol is started.
By default, added routes are not preserved when the TCP/IP protocol is started.
When used with the print command, the list of persistent routes is displayed. This parameter is ignored for all other commands.
Persistent routes are stored in the registry location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes.
-----------------------
To enable TCP/IP forwarding, follow these steps:
1. Start Registry Editor (Regedit.exe).
2. In Registry Editor, locate the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
3. Set the following registry value:
Value Name: IPEnableRouter
Value type: REG_DWORD
Value Data: 1
A value of 1 enables TCP/IP forwarding for all network connections that are installed and used by this computer.
4. Quit Registry Editor.
linux
Rabu, 30 Mei 2012
Senin, 07 Mei 2012
IP scanner for linux
NMAP
for scan ip on the network just use nmap
if you want to know the up ip on our network just type :
nmap -sP 192.168.1.0/24
this will show :
Host gw1.ipos.net (192.168.1.1) is up (0.00014s latency).
MAC Address: 00:0C:42:BC:4D:9A (Routerboard.com)
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).
MAC Address: 00:11:0A:ED:52:43 (Hewlett Packard)
Host hplj2200.ipos.net (192.168.1.6) is up (0.0020s latency).
MAC Address: 00:11:0A:ED:52:B9 (Hewlett Packard)
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00035s latency).
MAC Address: 08:00:37:97:B2:22 (Fuji-xerox CO.)
Host 192.168.1.9 is up (0.0011s latency).
MAC Address: 00:1A:4B:1F:EB:0A (Hewlett Packard)
Host 192.168.1.10 is up (0.00079s latency).
for more simple use :
nmap -sP 192.168.1.0/24 | grep Host
this will show :
Host gw1.ipos.net (192.168.1.1) is up (0.00012s latency).
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).
Host hplj2200.ipos.net (192.168.1.6) is up (0.0019s latency).
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00044s latency).Host 192.168.1.9 is up (0.0011s latency).
Host 192.168.1.10 is up (0.00098s latency).
Host 192.168.1.11 is up (0.0015s latency).
Host 192.168.1.12 is up (0.00024s latency).
Host 192.168.1.13 is up (0.00081s latency).
Host 192.168.1.15 is up (0.00046s latency).
for range ip 192.168.1.50 - 192.168.1.57 just type :
nmap -sP 192.168.1.50-57 | grep Host
this will show
Host januar.ipos.net (192.168.1.50) is up (0.00014s latency).
Host 192.168.1.51 is up (0.00042s latency).
Host 192.168.1.53 is up (0.00022s latency).
Host 192.168.1.56 is up (0.00055s latency).
for scan ip on the network just use nmap
if you want to know the up ip on our network just type :
nmap -sP 192.168.1.0/24
this will show :
Host gw1.ipos.net (192.168.1.1) is up (0.00014s latency).
MAC Address: 00:0C:42:BC:4D:9A (Routerboard.com)
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).
MAC Address: 00:11:0A:ED:52:43 (Hewlett Packard)
Host hplj2200.ipos.net (192.168.1.6) is up (0.0020s latency).
MAC Address: 00:11:0A:ED:52:B9 (Hewlett Packard)
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00035s latency).
MAC Address: 08:00:37:97:B2:22 (Fuji-xerox CO.)
Host 192.168.1.9 is up (0.0011s latency).
MAC Address: 00:1A:4B:1F:EB:0A (Hewlett Packard)
Host 192.168.1.10 is up (0.00079s latency).
for more simple use :
nmap -sP 192.168.1.0/24 | grep Host
this will show :
Host gw1.ipos.net (192.168.1.1) is up (0.00012s latency).
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).
Host hplj2200.ipos.net (192.168.1.6) is up (0.0019s latency).
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00044s latency).Host 192.168.1.9 is up (0.0011s latency).
Host 192.168.1.10 is up (0.00098s latency).
Host 192.168.1.11 is up (0.0015s latency).
Host 192.168.1.12 is up (0.00024s latency).
Host 192.168.1.13 is up (0.00081s latency).
Host 192.168.1.15 is up (0.00046s latency).
for range ip 192.168.1.50 - 192.168.1.57 just type :
nmap -sP 192.168.1.50-57 | grep Host
this will show
Host januar.ipos.net (192.168.1.50) is up (0.00014s latency).
Host 192.168.1.51 is up (0.00042s latency).
Host 192.168.1.53 is up (0.00022s latency).
Host 192.168.1.56 is up (0.00055s latency).
Rabu, 18 April 2012
openvpn-2.2.2 with slackware 13.37 and 13.0
here bellow my simple openvpn client and master with tap
openvpn-2.2.2
slackware 13.37(master) and slackware 13.0(client)
ip openvpn server : 11.11.11.1
ip client :192.168.1.191
ip openvpn client : 11.11.11.203
for the first download openvpn on http://openvpn.net/index.php/download.html
you can choose source Tarbal openvpn-2.2.2.tar.gz
follow the BOLD TEXT
copy this source to client
configure and install both server and client
modprobe tun
tar -xvf openvpn-2.2.2.tar.gz
cd openvpn-2.2.2
./configure
make
make install
-------------------------------------------------------------------------------------------------
==========================================
for server
==========================================
-----------------------------------------------------------------------------------------------
cp -a /yourpath/openvpn-2.2.2/easy-rsa /etc/openvpn/
cp /yourpath/openvpn-2.2.2/sample-config-files/server.conf /etc/openvpn/
create keys :
cd /etc/openvpn/easy-rsa/2.0
source ./vars
-------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# source ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/2.0/keys
---------------------------------------------------------------------------------------------------
./clean-all
./build-ca
----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-ca
Generating a 1024 bit RSA private key
.............++++++
....................++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [changeme]:
Name [changeme]:servervpn
Email Address [mail@host.domain]:
----------------------------------------------------------------------------------------------------
./build-key-server servervpn
----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-key-server servervpn
Generating a 1024 bit RSA private key
..........++++++
......................................................++++++
writing new private key to 'servervpn.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [servervpn]:
Name [changeme]:
Email Address [mail@host.domain]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'US'
stateOrProvinceName :PRINTABLE:'CA'
localityName :PRINTABLE:'SanFrancisco'
organizationName :PRINTABLE:'Fort-Funston'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'servervpn'
name :PRINTABLE:'changeme'
emailAddress :IA5STRING:'mail@host.domain'
Certificate is to be certified until Apr 16 07:46:46 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
-------------------------------------------------------------------------------------------------------
./build-key branch1
-------------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-key branch1
Generating a 1024 bit RSA private key
.......++++++
..++++++
writing new private key to 'branch1.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [branch1]:
Name [changeme]:
Email Address [mail@host.domain]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'US'
stateOrProvinceName :PRINTABLE:'CA'
localityName :PRINTABLE:'SanFrancisco'
organizationName :PRINTABLE:'Fort-Funston'
organizationalUnitName:PRINTABLE:'changeme'
commonName :PRINTABLE:'branch1'
name :PRINTABLE:'changeme'
emailAddress :IA5STRING:'mail@host.domain'
Certificate is to be certified until Apr 16 07:50:56 2022 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
-------------------------------------------------------------------------------------------------------
./build-dh
--------------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
..+....................................................
.+...........................................+.........
............++*++*++*
----------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ls keys/
01.pem branch1.csr ca.key index.txt.attr serial servervpn.csr
02.pem branch1.key dh1024.pem index.txt.attr.old serial.old servervpn.key
branch1.crt ca.crt index.txt index.txt.old servervpn.crt
----------------------------------------------------------------------------------------------------
cd keys
mkdir /etc/openvpn/keys
cp ca.crt dh1024.pem servervpn.crt servervpn.key /etc/openvpn/keys/
cd /etc/openvpn/
create server.conf
nano server.conf
----------------------------------------------------------------------------------------------------------
local 192.168.1.234
port 1194
proto tcp-server
dev tap
ca ca.crt
cert servervpn.crt
key servervpn.key # This file should be kept secret
dh dh1024.pem
mode server
tls-server
ifconfig 11.11.11.1 255.255.255.0
ifconfig-pool 11.11.11.200 11.11.11.254 255.255.255.0
#push "ifconfig 10.11.204.201 255.255.255.0"
#push "route 192.168.168.0 255.255.255.0 10.11.204.1"
#push "route 192.168.188.0 255.255.255.0 10.11.204.1"
#push "route 192.168.77.0 255.255.255.0 10.11.204.1"
push "route 0.0.0.0 0.0.0.0 11.11.11.1"
client-config-dir /etc/openvpn/ccd
keepalive 10 120
cipher BF-CBC # Blowfish (default)
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append /var/log/openvpn.log
verb 3
;mute 20
--------------------------------------------------------------------------------------------------------
create stater file executable
nano stater.sh
----------------------------------------------------------------------------------------------------
#!/bin/sh
/usr/sbin/openvpn --cd /etc/openvpn/keys --daemon --config /etc/openvpn/server.conf
-----------------------------------------------------------------------------------------------------
chmod a+x stater.sh
create ccd directory
mkdir /etc/openvpn/ccd
cd ccd
nano branch1
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.203 255.255.255.0
-----------------------------------------------------------------------------------------------------
with file branch1 will give ip client 11.11.11.203
running the vpn server
./stater.sh
you can check with
ifconfig
you will find tap0 the vpn ip
-----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:e6:5f:75:ee
inet addr:192.168.1.234 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:e6ff:fe5f:75ee/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47417 errors:0 dropped:727 overruns:0 frame:0
TX packets:5610 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7341469 (7.0 MiB) TX bytes:1589473 (1.5 MiB)
Interrupt:23 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1032 (1.0 KiB) TX bytes:1032 (1.0 KiB)
tap0 Link encap:Ethernet HWaddr c6:2a:36:10:d5:1a
inet addr:11.11.11.1 Bcast:11.11.11.255 Mask:255.255.255.0
inet6 addr: fe80::c42a:36ff:fe10:d51a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:238 (238.0 B)
---------------------------------------------------------------------------------------------------
scp branch1.crt branch1.key ca.crt 192.168.1.191:/etc/openvpn/keys/
root@192.168.1.191's password:
branch1.crt 100% 4012 3.9KB/s 00:00
branch1.key 100% 887 0.9KB/s 00:00
ca.crt 100% 1387 1.4KB/s 00:00
----------------------------------------------------------------------------------------------------
===========================================
for client
===========================================
---------------------------------------------------------------------------------------------------
modprobe tun
cd /etc/openvpn/
create stater
nano stater.sh
----------------------------------------------------------------------------------------------------
#!/bin/sh
/usr/sbin/openvpn --cd /etc/openvpn/keys --daemon --config /etc/openvpn/client.conf
--------------------------------------------------------------------------------------------------------
chmod a+x stater.sh
create client.conf
nano client.conf
-------------------------------------------------------------------------------------------------------
client
dev tap
proto tcp
remote 192.168.1.234
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert branch1.crt
key branch1.key
comp-lzo
verb 3
mute 20
log-append /var/log/openvpncli.log
------------------------------------------------------------------------------------------------------
run the vpnclient
./stater.sh
and see the tap with ifconfig
ifconfig
------------------------------------------------------------------------------------------------------
root@<o000o>:/etc/openvpn# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:e6:df:58:de
inet addr:192.168.1.191 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:e6ff:fedf:58de/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66215295 errors:0 dropped:0 overruns:0 frame:0
TX packets:43617824 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16847421334 (15.6 GiB) TX bytes:5671321099 (5.2 GiB)
Interrupt:25 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1111 errors:0 dropped:0 overruns:0 frame:0
TX packets:1111 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:110499 (107.9 KiB) TX bytes:110499 (107.9 KiB)
tap0 Link encap:Ethernet HWaddr ce:2a:d0:9a:99:26
inet addr:11.11.11.203 Bcast:11.11.11.255 Mask:255.255.255.0
inet6 addr: fe80::cc2a:d0ff:fe9a:9926/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:168 (168.0 B)
------------------------------------------------------------------------------------------------------
test connction to vpn server with ping
ping 11.11.11.203
root@<o000o>:/etc/openvpn# ping 11.11.11.203
PING 11.11.11.203 (11.11.11.203) 56(84) bytes of data.
64 bytes from 11.11.11.203: icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from 11.11.11.203: icmp_seq=2 ttl=64 time=0.013 ms
64 bytes from 11.11.11.203: icmp_seq=3 ttl=64 time=0.013 ms
64 bytes from 11.11.11.203: icmp_seq=4 ttl=64 time=0.014 ms
64 bytes from 11.11.11.203: icmp_seq=5 ttl=64 time=0.014 ms
^C
--- 11.11.11.203 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.013/0.015/0.023/0.005 ms
----------------------------------------------------------------------------------------------
if you can not find the tap please see log at :
/var/log/syslog
/var/log/openvpn.log
ping with real ip
ping 192.168.88.21 -I eth0
==============================================
Multi client or add new client
==============================================
you can create connection with many client
example :branch2 branch3 branch4 ...
just create again the client keys on server
cd /etc/openvpn/easy-rsa/2.0/
source ./vars
( do not ./clean-all )
./build-key branch2
./build-key branch3
. . .
and add file branch2 branch3 ... on /etc/openvpn/ccd/ directory ( on server )
nano branch2
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.203 255.255.255.0
-----------------------------------------------------------------------------------------------------
nano branch3
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.204 255.255.255.0
-----------------------------------------------------------------------------------------------------
and then create client again for branch2 and branch3
this configuration work on my openvpn
enjoy your vpn
happy slackware........
othersite :
http://www.techrepublic.com/blog/opensource/how-to-set-up-an-openvpn-server/1873
http://xmalakaji.wordpress.com/2010/09/04/konfigurasi-openvpn-di-slackware/
http://www2.essex.ac.uk/cs/openvpn/windows7/setup-windows7.htm
http://www.fiberworks.com/Support/OpenVPN/tabid/171/language/en-US/Default.aspx
http://nikinuryadin.wordpress.com/2010/04/16/step-by-step-setting-up-openvpn-in-debian-with-routing-tun-connection/
Rabu, 04 April 2012
nslookup
this for testing domain has been resolve by dns server
check with www.who.is
root@<o000o>:~# nslookup
> server 202.158.20.1 Default server: 202.158.20.1
Address: 202.158.20.1#53
> apps.ipotindonesia.com
Server: 202.158.20.1
Address: 202.158.20.1#53
** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED
>
>
> server 202.59.169.226
Default server: 202.59.169.226
Address: 202.59.169.226#53
> apps.ipotindonesia.com
Server: 202.59.169.226
Address: 202.59.169.226#53
Name: apps.ipotindonesia.com
Address: 180.150.245.161
>
> server 202.158.40.1
Default server: 202.158.40.1
Address: 202.158.40.1#53
> apps.ipotindonesia.com
Server: 202.158.40.1
Address: 202.158.40.1#53
** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED
check with www.who.is
root@<o000o>:~# nslookup
> server 202.158.20.1 Default server: 202.158.20.1
Address: 202.158.20.1#53
> apps.ipotindonesia.com
Server: 202.158.20.1
Address: 202.158.20.1#53
** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED
>
>
> server 202.59.169.226
Default server: 202.59.169.226
Address: 202.59.169.226#53
> apps.ipotindonesia.com
Server: 202.59.169.226
Address: 202.59.169.226#53
Name: apps.ipotindonesia.com
Address: 180.150.245.161
>
> server 202.158.40.1
Default server: 202.158.40.1
Address: 202.158.40.1#53
> apps.ipotindonesia.com
Server: 202.158.40.1
Address: 202.158.40.1#53
** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED
Senin, 26 Maret 2012
RAID SOFTWARE LINUX
Hemmm...This is only my note.....
create raid software in linux with mdadm
with this mdadm i can create raid 0,1,10,and 5
prepare the disks,
command for create :
mdadm --create /dev/md0 --verbose --level=[level] --raid-devices=[number of disk] [member disk]
example:
mdadm --create /dev/md0 --verbose --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --verbose --level=raid5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
command for state raid :
cat /proc/mdstat
mdadm --detail /dev/md0
example :
root@totok:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : active raid1 nbd1[1] nbd0[0]
1999936 blocks [2/2] [UU]
[=======>.............] resync = 38.7% (777152/1999936) finish=0.3min speed=59780K/sec
root@totok:/mnt# mdadm --detail /dev/md0
Version : 0.90
Creation Time : Sun Oct 31 19:53:26 2010
Raid Level : raid5
Array Size : 5860535808 (5589.04 GiB 6001.19 GB)
Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Mar 27 21:18:45 2011
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : 829aacd2:bf52a9d7:f190e036:dc0a4837
Events : 0.36
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 8 49 3 active sync /dev/sdd1
if one memberdisk on the array RAID is fail we can add the new member disk:
mdadm /dev/md0 -a /dev/sda1
this for boot loader using lilo and grub :
===================
For LILO configuration:
- When asked about LILO, choose the "simple" setup.
- When asked about additional "append=" parameters, RAID 0 and
RAID 5 users should type in "root=/dev/md0", to ensure that the proper
array is mounted on / at bootup.
- When asked about where to install LILO, choose MBR.
Start by switching into your actual installation directory:
- chroot /mnt
Let's make sure LILO boots from the RAID arrays properly. Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
- add a new line (add it anywhere, but don't indent it):
raid-extra-boot = mbr-only
- You will need to change the following line:
boot = <something>
RAID 0 and RAID 5 users, change it to:
boot = /dev/md2
RAID 1 users, change it to:
boot = /dev/md0
- Save the file and exit your editor.
- run "lilo".
for Grub :
http://slackbuilds.org/repository/13.1/system/grub2/
download :ftp://alpha.gnu.org/gnu/grub/grub-1.98.tar.gz
http://slackbuilds.org/slackbuilds/13.1/system/grub2.tar.gz
tar -xvf grub2.tar.gz
mv grub-1.98.tar.gz grub2/
cd grub2
./grub2.SlackBuild
cd /tmp
installpkg grub2-1.98-x86_64-2_SBo.tgz
cat /proc/mdstat
grub-install /dev/md0
berikut ini pilihan bisa 2 cara :
1.grub-mkconfig -o /boot/grub/grub.cfg
hasilnya masih kosong...
2.copy grub.cfg
cp /usr/doc/grub2-1.98/grub.cfg /boot/grub2/
saya pilih yang no 2.
edit file grub.cfg jadi :
---------------------------------------------------------------
#
# Sample GRUB configuration file
#
# Boot automatically after 30 secs.
set timeout=10
# By default, boot the first entry.
set default=0
# Fallback to the second entry.
set fallback=1
# For booting GNU/Linux
menuentry "linuxslac_serever" {
set root='(md0)'
linux /boot/vmlinuz root=/dev/md0
initrd
}
# Change the colors.
menuentry "Change the colors" {
set menu_color_normal=light-green/brown
set menu_color_highlight=red/blue
}
RAID 10
if you using raid 10 and the raid member are /dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1
for testting
if the fist fisical hdd remove from server the os still running and you can attach the new harddisk on server and then
check for new hdd with fdisk -l | grep dev
and compare with mdadm --detail /dev/md0
for new hdd
fdisk /dev/sdd create for type is fd ( linux raid autodetect )
and then mdadm /dev/md0 -a /dev/sdd1
and you can see the /dev/md0 rebuild
if the system still rebuilding and you restart the server if the first hdd on bios is new hdd the system would not boot,
for boot up the system you must change the first bios for other old hdd.
when the system up the /dev/md0 will re-building from 0 % ( cat /proc/mdstat )
note : after replace with new disk you must type grub-install /dev/md0 to write
grub.conf to new disk
create raid software in linux with mdadm
with this mdadm i can create raid 0,1,10,and 5
prepare the disks,
command for create :
mdadm --create /dev/md0 --verbose --level=[level] --raid-devices=[number of disk] [member disk]
example:
mdadm --create /dev/md0 --verbose --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --verbose --level=raid5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
command for state raid :
cat /proc/mdstat
mdadm --detail /dev/md0
example :
root@totok:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : active raid1 nbd1[1] nbd0[0]
1999936 blocks [2/2] [UU]
[=======>.............] resync = 38.7% (777152/1999936) finish=0.3min speed=59780K/sec
root@totok:/mnt# mdadm --detail /dev/md0
Version : 0.90
Creation Time : Sun Oct 31 19:53:26 2010
Raid Level : raid5
Array Size : 5860535808 (5589.04 GiB 6001.19 GB)
Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Mar 27 21:18:45 2011
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : 829aacd2:bf52a9d7:f190e036:dc0a4837
Events : 0.36
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 8 49 3 active sync /dev/sdd1
if one memberdisk on the array RAID is fail we can add the new member disk:
mdadm /dev/md0 -a /dev/sda1
this for boot loader using lilo and grub :
===================
For LILO configuration:
- When asked about LILO, choose the "simple" setup.
- When asked about additional "append=" parameters, RAID 0 and
RAID 5 users should type in "root=/dev/md0", to ensure that the proper
array is mounted on / at bootup.
- When asked about where to install LILO, choose MBR.
Start by switching into your actual installation directory:
- chroot /mnt
Let's make sure LILO boots from the RAID arrays properly. Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
- add a new line (add it anywhere, but don't indent it):
raid-extra-boot = mbr-only
- You will need to change the following line:
boot = <something>
RAID 0 and RAID 5 users, change it to:
boot = /dev/md2
RAID 1 users, change it to:
boot = /dev/md0
- Save the file and exit your editor.
- run "lilo".
for Grub :
http://slackbuilds.org/repository/13.1/system/grub2/
download :ftp://alpha.gnu.org/gnu/grub/grub-1.98.tar.gz
http://slackbuilds.org/slackbuilds/13.1/system/grub2.tar.gz
tar -xvf grub2.tar.gz
mv grub-1.98.tar.gz grub2/
cd grub2
./grub2.SlackBuild
cd /tmp
installpkg grub2-1.98-x86_64-2_SBo.tgz
cat /proc/mdstat
grub-install /dev/md0
berikut ini pilihan bisa 2 cara :
1.grub-mkconfig -o /boot/grub/grub.cfg
hasilnya masih kosong...
2.copy grub.cfg
cp /usr/doc/grub2-1.98/grub.cfg /boot/grub2/
saya pilih yang no 2.
edit file grub.cfg jadi :
---------------------------------------------------------------
#
# Sample GRUB configuration file
#
# Boot automatically after 30 secs.
set timeout=10
# By default, boot the first entry.
set default=0
# Fallback to the second entry.
set fallback=1
# For booting GNU/Linux
menuentry "linuxslac_serever" {
set root='(md0)'
linux /boot/vmlinuz root=/dev/md0
initrd
}
# Change the colors.
menuentry "Change the colors" {
set menu_color_normal=light-green/brown
set menu_color_highlight=red/blue
}
RAID 10
if you using raid 10 and the raid member are /dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1
for testting
if the fist fisical hdd remove from server the os still running and you can attach the new harddisk on server and then
check for new hdd with fdisk -l | grep dev
and compare with mdadm --detail /dev/md0
for new hdd
fdisk /dev/sdd create for type is fd ( linux raid autodetect )
and then mdadm /dev/md0 -a /dev/sdd1
and you can see the /dev/md0 rebuild
if the system still rebuilding and you restart the server if the first hdd on bios is new hdd the system would not boot,
for boot up the system you must change the first bios for other old hdd.
when the system up the /dev/md0 will re-building from 0 % ( cat /proc/mdstat )
note : after replace with new disk you must type grub-install /dev/md0 to write
grub.conf to new disk
Rabu, 07 Maret 2012
Selasa, 06 Maret 2012
install squid 3.1.19 at slackware 13.37
bellow resume for install squid 3.1.19 at slackware 13.37
download from http://www.squid-cache.org/Versions/v3/3.1/
#tar -xvf squid-3.1.19.tar.gz
#./configure
#make all
#make install
#groupadd proxy
#useradd proxy -g proxy -d /usr/local/squid -s /usr/bin/nologin
#mkdir /cache
#chown -R proxy.proxy /cache
# scp 192.168.1.191:/sdb/Docu/gudang/malang/squid.conf /usr/local/squid/etc/
you can create your own squid.conf see the create squid.conf
#scp 192.168.1.191:/root/gudang/rc.squid /etc/rc.d/
or create rc.squid bellow
#chown -R proxy.proxy /cache
#chmod a+w /cache
#useradd squid
#/usr/local/squid/sbin/squid -z
#cd /usr/local/squid/var/
#chmod -R a+w logs
#cd logs
#chown squid cache.log
#/etc/rc.d/rc.squid start
#ps -ax | grep squid
create rc.squid
#cd /etc/rc.d/
#nano rc.squid
copy this text at your rc.squid :
----------------------------------------------------------------------------------------------------------
#!/bin/sh
# Start/stop/restart/reload the Squid Internet Object Cache (squid)
# To make Squid start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.Squid
#
# Written for Slackware Linux by Erik Jan Tromp
# Modified by David Somero <xgizzmo@slackbuilds.org>
SQUIDCFG=/usr/local/squid/etc/squid.conf
SQUIDCMD=/usr/local/squid/sbin/squid
if [ ! -r $SQUIDCFG ]; then
echo "Please set the correct path to $SQUIDCFG"
exit 1
fi
if [ ! -x $SQUIDCMD ]; then
echo "$SQUIDCMD not found"
exit 1
fi
squid_start() {
# Create cache directory hierarchy if needed
ALL_DIRS=$(awk '/^cache_dir/ {print $3}' $SQUIDCFG)
[ -z "$ALL_DIRS" ] && ALL_DIRS=/var/cache/squid
for CACHE_DIR in $ALL_DIRS ; do
if [ ! -d $CACHE_DIR/00 ] ; then
echo "Creating swap directories: $SQUIDCMD -z"
$SQUIDCMD -z 2> /dev/null
break
fi
done
echo "Starting Squid: $SQUIDCMD -SDYCF"
$SQUIDCMD -SDYCF
}
squid_stop() {
COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG)
[ -z "$COUNTDOWN" ] && COUNTDOWN=5
echo -n "Shutting down Squid in $COUNTDOWN seconds: "
$SQUIDCMD -k shutdown 2> /dev/null
while $SQUIDCMD -k check 2> /dev/null ; do
sleep 1
echo -n .
COUNTDOWN=$[ $COUNTDOWN - 1 ]
if [ $COUNTDOWN -le 0 ] ; then
$SQUIDCMD -k interrupt 2> /dev/null
sleep 1
break
fi
done
echo
}
squid_restart() {
squid_stop
sleep 1
squid_start
}
squid_reload() {
$SQUIDCMD -k reconfigure 2> /dev/null
}
case "$1" in
'start')
squid_start
;;
'stop')
squid_stop
;;
'restart')
squid_restart
;;
'reload')
squid_reload
;;
*)
echo "usage: $0 start|stop|restart|reload"
esac
-----------------------------------------------------------------------------------------------------
#chmod a+x rc.squid
for start up squid at boot server linux
add this line at /etc/rc.d/rc.local
"/etc/rc.d/rc.squid start"
#nano /etc/rc.d/rc.local
/etc/rc.d/rc.squid start
to start your proxy
#/etc/rc.d/rc.squid start
to stop your proxy
#/etc/rc.d/rc.squid stop
to reload your proxy after reconfigure your squid.conf
#/etc/rc.d/rc.squid reload
===============================================
for any error see cache.log
#nano /usr/local/squid/var/logs/cache.log
this step working at my proxy server
Happy ...Slackware..... :)
create your squid.conf
for simple way you can edit the squid.conf
#cd /usr/local/squid/etc/
#nano squid.conf
find text bellow
======================================
# should be allowed
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
-------------------------------------------------------------
add your acl at your network
-------------------------------------------------------------
acl localnet src 192.168.23.0/24
acl admin1 src 192.168.23.7/32
acl ipblock src 192.168.23.21/32
---------------------------------------------------------------
find text : # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
and add your acl site to block or allow
-----------------------------------------------------
acl company url_regex -i youtube.com
acl linux url_regex -i linux.com
http_access allow admin1 all
http_access deny ipblock company
http_access allow ipblock linux
http_access deny localnet all
=============================================
this squid.conf mean :
allow admin1 to all internet
deny ipblock(192.168.23.21) to see youtube.com
allow ipblock to see linux.com
download from http://www.squid-cache.org/Versions/v3/3.1/
#tar -xvf squid-3.1.19.tar.gz
#./configure
#make all
#make install
#groupadd proxy
#useradd proxy -g proxy -d /usr/local/squid -s /usr/bin/nologin
#mkdir /cache
#chown -R proxy.proxy /cache
# scp 192.168.1.191:/sdb/Docu/gudang/malang/squid.conf /usr/local/squid/etc/
you can create your own squid.conf see the create squid.conf
#scp 192.168.1.191:/root/gudang/rc.squid /etc/rc.d/
or create rc.squid bellow
#chown -R proxy.proxy /cache
#chmod a+w /cache
#useradd squid
#/usr/local/squid/sbin/squid -z
#cd /usr/local/squid/var/
#chmod -R a+w logs
#cd logs
#chown squid cache.log
#/etc/rc.d/rc.squid start
#ps -ax | grep squid
create rc.squid
#cd /etc/rc.d/
#nano rc.squid
copy this text at your rc.squid :
----------------------------------------------------------------------------------------------------------
#!/bin/sh
# Start/stop/restart/reload the Squid Internet Object Cache (squid)
# To make Squid start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.Squid
#
# Written for Slackware Linux by Erik Jan Tromp
# Modified by David Somero <xgizzmo@slackbuilds.org>
SQUIDCFG=/usr/local/squid/etc/squid.conf
SQUIDCMD=/usr/local/squid/sbin/squid
if [ ! -r $SQUIDCFG ]; then
echo "Please set the correct path to $SQUIDCFG"
exit 1
fi
if [ ! -x $SQUIDCMD ]; then
echo "$SQUIDCMD not found"
exit 1
fi
squid_start() {
# Create cache directory hierarchy if needed
ALL_DIRS=$(awk '/^cache_dir/ {print $3}' $SQUIDCFG)
[ -z "$ALL_DIRS" ] && ALL_DIRS=/var/cache/squid
for CACHE_DIR in $ALL_DIRS ; do
if [ ! -d $CACHE_DIR/00 ] ; then
echo "Creating swap directories: $SQUIDCMD -z"
$SQUIDCMD -z 2> /dev/null
break
fi
done
echo "Starting Squid: $SQUIDCMD -SDYCF"
$SQUIDCMD -SDYCF
}
squid_stop() {
COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG)
[ -z "$COUNTDOWN" ] && COUNTDOWN=5
echo -n "Shutting down Squid in $COUNTDOWN seconds: "
$SQUIDCMD -k shutdown 2> /dev/null
while $SQUIDCMD -k check 2> /dev/null ; do
sleep 1
echo -n .
COUNTDOWN=$[ $COUNTDOWN - 1 ]
if [ $COUNTDOWN -le 0 ] ; then
$SQUIDCMD -k interrupt 2> /dev/null
sleep 1
break
fi
done
echo
}
squid_restart() {
squid_stop
sleep 1
squid_start
}
squid_reload() {
$SQUIDCMD -k reconfigure 2> /dev/null
}
case "$1" in
'start')
squid_start
;;
'stop')
squid_stop
;;
'restart')
squid_restart
;;
'reload')
squid_reload
;;
*)
echo "usage: $0 start|stop|restart|reload"
esac
-----------------------------------------------------------------------------------------------------
#chmod a+x rc.squid
for start up squid at boot server linux
add this line at /etc/rc.d/rc.local
"/etc/rc.d/rc.squid start"
#nano /etc/rc.d/rc.local
/etc/rc.d/rc.squid start
to start your proxy
#/etc/rc.d/rc.squid start
to stop your proxy
#/etc/rc.d/rc.squid stop
to reload your proxy after reconfigure your squid.conf
#/etc/rc.d/rc.squid reload
===============================================
for any error see cache.log
#nano /usr/local/squid/var/logs/cache.log
this step working at my proxy server
Happy ...Slackware..... :)
create your squid.conf
for simple way you can edit the squid.conf
#cd /usr/local/squid/etc/
#nano squid.conf
find text bellow
======================================
# should be allowed
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
-------------------------------------------------------------
add your acl at your network
-------------------------------------------------------------
acl localnet src 192.168.23.0/24
acl admin1 src 192.168.23.7/32
acl ipblock src 192.168.23.21/32
---------------------------------------------------------------
find text : # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
and add your acl site to block or allow
-----------------------------------------------------
acl company url_regex -i youtube.com
acl linux url_regex -i linux.com
http_access allow admin1 all
http_access deny ipblock company
http_access allow ipblock linux
http_access deny localnet all
=============================================
this squid.conf mean :
allow admin1 to all internet
deny ipblock(192.168.23.21) to see youtube.com
allow ipblock to see linux.com
Selasa, 28 Februari 2012
test koneksi di linux
for tes conection use ping to destination server :
for monitoring connection :
1. the sequance number ( green colour )
2.time ( blue colour )
3.packet loss ( yellow colour )
4.packet error ( pink colour )
root@<o000o>:/# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.174 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.171 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.147 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.148 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.149 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.147/0.157/0.174/0.019 ms
64 bytes from 172.16.0.25: icmp_seq=65100 ttl=64 time=0.718 ms
64 bytes from 172.16.0.25: icmp_seq=65101 ttl=64 time=0.638 ms
64 bytes from 172.16.0.25: icmp_seq=65102 ttl=64 time=0.639 ms
64 bytes from 172.16.0.25: icmp_seq=65103 ttl=64 time=0.521 ms
--- 172.16.0.25 ping statistics ---
261711 packets transmitted, 261008 received, +198 errors, 0% packet loss, time 261709076ms
rtt min/avg/max/mdev = 0.356/0.498/468.511/1.706 ms, pipe 3
64 bytes from 172.16.0.25: icmp_seq=625 ttl=64 time=0.562 ms
64 bytes from 172.16.0.25: icmp_seq=626 ttl=64 time=0.546 ms
64 bytes from 172.16.0.25: icmp_seq=627 ttl=64 time=0.548 ms
64 bytes from 172.16.0.25: icmp_seq=628 ttl=64 time=0.971 ms
--- 172.16.0.25 ping statistics ---
628 packets transmitted, 602 received, 4% packet loss, time 626995ms
rtt min/avg/max/mdev = 0.540/1.079/53.770/3.836 ms
root@<o000o>:/# ping -c 9 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.186 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.166 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.164 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.165 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.173 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=0.164 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=0.173 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=0.163 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=64 time=0.163 ms
--- 192.168.1.1 ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 7999ms
rtt min/avg/max/mdev = 0.163/0.168/0.186/0.015 ms
ping for steess network :
root@<o000o>:/# ping -c 1000 -f -n 192.168.188.21
PING 192.168.188.21 (192.168.188.21) 56(84) bytes of data.
--- 192.168.188.21 ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 661ms
rtt min/avg/max/mdev = 0.509/0.647/2.210/0.164 ms, ipg/ewma 0.661/0.613 ms
stress network with large packet :
root@<o000o>:/# ping -s 512 -c 1000 -f -n 192.168.188.21
PING 192.168.188.21 (192.168.188.21) 512(540) bytes of data.
--- 192.168.188.21 ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 1311ms
rtt min/avg/max/mdev = 1.242/1.292/1.664/0.068 ms, ipg/ewma 1.313/1.339 ms
for recording route :
root@<o000o>:/# ping -c 2 -R 192.168.21.8
PING 192.168.21.8 (192.168.21.8) 56(124) bytes of data.
64 bytes from 192.168.21.8: icmp_seq=1 ttl=62 time=8.65 ms
RR: 192.168.1.191
172.16.0.57
192.168.21.201
192.168.21.8
192.168.21.8
172.16.0.58
192.168.1.1
192.168.1.191
64 bytes from 192.168.21.8: icmp_seq=2 ttl=62 time=8.66 ms (same route)
for monitoring connection :
1. the sequance number ( green colour )
2.time ( blue colour )
3.packet loss ( yellow colour )
4.packet error ( pink colour )
root@<o000o>:/# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.174 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.171 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.147 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.148 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.149 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.147/0.157/0.174/0.019 ms
64 bytes from 172.16.0.25: icmp_seq=65100 ttl=64 time=0.718 ms
64 bytes from 172.16.0.25: icmp_seq=65101 ttl=64 time=0.638 ms
64 bytes from 172.16.0.25: icmp_seq=65102 ttl=64 time=0.639 ms
64 bytes from 172.16.0.25: icmp_seq=65103 ttl=64 time=0.521 ms
--- 172.16.0.25 ping statistics ---
261711 packets transmitted, 261008 received, +198 errors, 0% packet loss, time 261709076ms
rtt min/avg/max/mdev = 0.356/0.498/468.511/1.706 ms, pipe 3
64 bytes from 172.16.0.25: icmp_seq=625 ttl=64 time=0.562 ms
64 bytes from 172.16.0.25: icmp_seq=626 ttl=64 time=0.546 ms
64 bytes from 172.16.0.25: icmp_seq=627 ttl=64 time=0.548 ms
64 bytes from 172.16.0.25: icmp_seq=628 ttl=64 time=0.971 ms
--- 172.16.0.25 ping statistics ---
628 packets transmitted, 602 received, 4% packet loss, time 626995ms
rtt min/avg/max/mdev = 0.540/1.079/53.770/3.836 ms
root@<o000o>:/# ping -c 9 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.186 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.166 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.164 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.165 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.173 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=0.164 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=0.173 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=0.163 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=64 time=0.163 ms
--- 192.168.1.1 ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 7999ms
rtt min/avg/max/mdev = 0.163/0.168/0.186/0.015 ms
ping for steess network :
root@<o000o>:/# ping -c 1000 -f -n 192.168.188.21
PING 192.168.188.21 (192.168.188.21) 56(84) bytes of data.
--- 192.168.188.21 ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 661ms
rtt min/avg/max/mdev = 0.509/0.647/2.210/0.164 ms, ipg/ewma 0.661/0.613 ms
stress network with large packet :
root@<o000o>:/# ping -s 512 -c 1000 -f -n 192.168.188.21
PING 192.168.188.21 (192.168.188.21) 512(540) bytes of data.
--- 192.168.188.21 ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 1311ms
rtt min/avg/max/mdev = 1.242/1.292/1.664/0.068 ms, ipg/ewma 1.313/1.339 ms
for recording route :
root@<o000o>:/# ping -c 2 -R 192.168.21.8
PING 192.168.21.8 (192.168.21.8) 56(124) bytes of data.
64 bytes from 192.168.21.8: icmp_seq=1 ttl=62 time=8.65 ms
RR: 192.168.1.191
172.16.0.57
192.168.21.201
192.168.21.8
192.168.21.8
172.16.0.58
192.168.1.1
192.168.1.191
64 bytes from 192.168.21.8: icmp_seq=2 ttl=62 time=8.66 ms (same route)
Senin, 20 Februari 2012
konsole xterm setting
to create monitoring for many server use xterm
create script like bellow with user non root
create file with name xtermtest
$nano xtermtest
#!/bin/sh
xterm -geometry 65x8 -title bandung -bg OliveDrab3 -e "ping 10.0.10.51" &
sleep 1
xterm -geometry 65x8 -title surabaya -bg chartreuse4 -e "ping 10.0.10.52" &
sleep 1
xterm -geometry 65x8 -title semarang -bg DarkOliveGreen -e "ping 10.0.10.53" &
sleep 1
xterm -geometry 65x8 -title makasar -bg SeaGreen4 -e "ping 10.0.10.54" &
sleep 1
xterm -geometry 65x8 -title medan -bg cyan4 -e "ping 10.0.10.55" &
sleep 1
xterm -geometry 65x8 -title solo -bg cyan4 -e "ping 10.0.10.56" &
sleep 1
xterm -geometry 65x8 -title bsd -bg SeaGreen4 -e "ping 10.0.10.57" &
sleep 1
xterm -geometry 65x8 -title puri -bg DarkOliveGreen -e "ping 10.0.10.58" &
sleep 1
xterm -geometry 65x8 -title malang -bg cyan4 -e "ping 10.0.10.59" &
sleep 1
xterm -geometry 65x8 -title pluit -bg chartreuse4 -e "ping 10.0.10.60" &
sleep 1
xterm -geometry 65x8 -title manado -bg OliveDrab3 -e "ping 10.0.10.61" &
sleep 1
xterm -geometry 65x8 -title pekanbaru -bg SeaGreen4 -e "ping 10.0.10.62" &
sleep 1
xterm -geometry 65x8 -title pontianak -bg DarkOliveGreen -e "ping 10.0.10.63" &
sleep 1
xterm -geometry 65x8 -title balikpapan -bg SeaGreen4 -e "ping 10.0.10.64" &
sleep 1
xterm -geometry 65x8 -title kelapagading -bg cyan4 -e "ping 192.168.21.8" &
$su -
password:
#chmod a+x xtermtest
$./xtermtest
enjoy your new konsole :)
for detail color you can see at http://critical.ch/xterm/
create script like bellow with user non root
create file with name xtermtest
$nano xtermtest
#!/bin/sh
xterm -geometry 65x8 -title bandung -bg OliveDrab3 -e "ping 10.0.10.51" &
sleep 1
xterm -geometry 65x8 -title surabaya -bg chartreuse4 -e "ping 10.0.10.52" &
sleep 1
xterm -geometry 65x8 -title semarang -bg DarkOliveGreen -e "ping 10.0.10.53" &
sleep 1
xterm -geometry 65x8 -title makasar -bg SeaGreen4 -e "ping 10.0.10.54" &
sleep 1
xterm -geometry 65x8 -title medan -bg cyan4 -e "ping 10.0.10.55" &
sleep 1
xterm -geometry 65x8 -title solo -bg cyan4 -e "ping 10.0.10.56" &
sleep 1
xterm -geometry 65x8 -title bsd -bg SeaGreen4 -e "ping 10.0.10.57" &
sleep 1
xterm -geometry 65x8 -title puri -bg DarkOliveGreen -e "ping 10.0.10.58" &
sleep 1
xterm -geometry 65x8 -title malang -bg cyan4 -e "ping 10.0.10.59" &
sleep 1
xterm -geometry 65x8 -title pluit -bg chartreuse4 -e "ping 10.0.10.60" &
sleep 1
xterm -geometry 65x8 -title manado -bg OliveDrab3 -e "ping 10.0.10.61" &
sleep 1
xterm -geometry 65x8 -title pekanbaru -bg SeaGreen4 -e "ping 10.0.10.62" &
sleep 1
xterm -geometry 65x8 -title pontianak -bg DarkOliveGreen -e "ping 10.0.10.63" &
sleep 1
xterm -geometry 65x8 -title balikpapan -bg SeaGreen4 -e "ping 10.0.10.64" &
sleep 1
xterm -geometry 65x8 -title kelapagading -bg cyan4 -e "ping 192.168.21.8" &
$su -
password:
#chmod a+x xtermtest
$./xtermtest
enjoy your new konsole :)
for detail color you can see at http://critical.ch/xterm/
Jumat, 17 Februari 2012
performance server
there are some item must be look at server performance
1.cpu
2.memory
3.Haddisk
4.ethernet
for first use nmon
1.cpu
2.memory
3.Haddisk
4.ethernet
for first use nmon
Senin, 13 Februari 2012
Linux beginner / Pemula
melihat lokasi
#pwd
melihat isi direktori
#ls
#ls -a
#ls -l
masuk ke direktori
cd nama_direktori
membuat direktori
mkdir nama_file
#pwd
melihat isi direktori
#ls
#ls -a
#ls -l
masuk ke direktori
cd nama_direktori
membuat direktori
mkdir nama_file
increase size mdadm
This just my note how to increase array raid from 54G to 80G
it was work without lost data
just follow this steps
it was work without lost data
just follow this steps
root@HO-1-231:~# fdisk -l | grep dev Disk /dev/md0 doesn't contain a valid partition table Disk /dev/sdc doesn't contain a valid partition table Disk /dev/sdd doesn't contain a valid partition table Disk /dev/sda: 2000.4 GB, 2000398934016 bytes /dev/sda1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes /dev/sdb1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/md0: 2000.4 GB, 2000396222464 bytes Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes root@HO-1-231:~# fdisk /dev/sdc Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x5ce337a5. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-243201, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +50G Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System
/dev/sdc1 1 6528 52436128+ 83 Linux Partition 1 does not start on physical sector boundary. Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System /dev/sdc1 1 6528 52436128+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@HO-1-231:~# fdisk /dev/sdd Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x3c581631. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-243201, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +50G Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 6528 52436128+ 83 Linux Partition 1 does not start on physical sector boundary. Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 6528 52436128+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@HO-1-231:~# fdisk -l | grep dev Disk /dev/md0 doesn't contain a Valid partition table Disk /dev/sda: 2000.4 GB, 2000398934016 bytes /dev/sda1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes /dev/sdb1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/md0: 2000.4 GB, 2000396222464 bytes Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes /dev/sdc1 1 6528 52436128+ fd Linux raid autodetect Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes /dev/sdd1 1 6528 52436128+ fd Linux raid autodetect root@HO-1-231:~# mdadm --create /dev/md1 --verbose --level=raid1 --raid-devices=2 /dev/sdc1 /dec/sdd1 mdadm: Cannot open /dec/sdd1: No such file or directory mdadm: create aborted root@HO-1-231:~# mdadm --create /dev/md1 --verbose --level=raid1 --raid-devices=2 /dev/sdc1 /dev/sdd1 mdadm: size set to 52436032K mdadm: array /dev/md1 started. root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [>....................] resync = 1.1% (599232/52436032) finish=7.2min speed=119846K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [>....................] resync = 1.4% (755520/52436032) finish=9.1min speed=94440K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [>....................] resync = 2.6% (1403328/52436032) finish=8.4min speed=100237K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [>....................] resync = 3.2% (1691072/52436032) finish=9.5min speed=89003K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [>....................] resync = 4.7% (2512256/52436032) finish=10.2min speed=81040K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [=========>...........] resync = 46.1% (24198208/52436032) finish=8.0min speed=58504K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] [===================>.] resync = 96.2% (50460544/52436032) finish=0.4min speed=66731K/sec md0 : active raid1 sda1[1] Sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:~# ls /mnt README cdrecorder/ cdrom/ dvd/ floppy/ hd/ memory/ tmp/ zip/ root@HO-1-231:~# mkdir /mnt/md1 root@HO-1-231:~# mount /dev/md1 /mnt/md1 mount: you must specify the filesystem type root@HO-1-231:~# mkfs.xfs -f /dev/md1 warning: device is not properly aligned /dev/md1 meta-data=/dev/md1 isize=256 agcount=16, agsize=819313 blks = sectsz=512 attr=2 data = bsize=4096 blocks=13109008, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=6400, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 root@HO-1-231:~# mount /dev/md1 /mnt/md1 root@HO-1-231:~# mc root@HO-1-231:/mnt/md1# exit exit root@HO-1-231:~# cd /mnt/md1 root@HO-1-231:/mnt/md1# ls siapsrv/ root@HO-1-231:/mnt/md1# ls siapsrv/ root@HO-1-231:/mnt/md1# cd siapsrv/ root@HO-1-231:/mnt/md1/siapsrv# ls grub2/ grub2.tar.gz monmdadm/ postgresql-9.0.4.tar.gz rc.pg_reload* rc.pg_start* rc.pg_stop* root@HO-1-231:/mnt/md1/siapsrv# mv rc.pg_reload testt root@HO-1-231:/mnt/md1/siapsrv# ls grub2/ grub2.tar.gz monmdadm/ postgresql-9.0.4.tar.gz rc.pg_start* rc.pg_stop* testt* root@HO-1-231:/mnt/md1/siapsrv# md5 md5pass md5sum root@HO-1-231:/mnt/md1/siapsrv# ls grub2/ grub2.tar.gz monmdadm/ postgresql-9.0.4.tar.gz rc.pg_start* rc.pg_stop* testt* root@HO-1-231:/mnt/md1/siapsrv# md5sum testt > md5sum root@HO-1-231:/mnt/md1/siapsrv# ls grub2/ grub2.tar.gz md5sum monmdadm/ postgresql-9.0.4.tar.gz rc.pg_start* rc.pg_stop* testt* root@HO-1-231:/mnt/md1/siapsrv# mc root@HO-1-231:/mnt/md1/siapsrv# exit exit root@HO-1-231:/mnt/md1/siapsrv# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/mnt/md1/siapsrv# mdadm /dev/md1 --fail /dev/sdc1 --remove /dev/sdc1 mdadm: set /dev/sdc1 faulty in /dev/md1 mdadm: hot remove failed for /dev/sdc1: Device or resource busy root@HO-1-231:/mnt/md1/siapsrv# cd / root@HO-1-231:/# mdadm /dev/md1 --fail /dev/sdc1 --remove /dev/sdc1 mdadm: set /dev/sdc1 faulty in /dev/md1 mdadm: hot removed /dev/sdc1 root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] 52436032 blocks [2/1] [_U] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# fdisk -l | grep dev Disk /dev/md0 doesn't contain a valid partition table Disk /dev/md1 doesn't contain a valid partition table Disk /dev/sda: 2000.4 GB, 2000398934016 bytes /dev/sda1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes /dev/sdb1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/md0: 2000.4 GB, 2000396222464 bytes Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes /dev/sdc1 1 6528 52436128+ fd Linux raid autodetect Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes /dev/sdd1 1 6528 52436128+ fd Linux raid autodetect Disk /dev/md1: 53.7 GB, 53694496768 bytes root@HO-1-231:/# fdisk /dev/sdc The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System /dev/sdc1 1 6528 52436128+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): d Selected partition 1 Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-243201, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +84G Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System /dev/sdc1 1 10968 88092396+ 83 Linux Partition 1 does not start on physical sector boundary. Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x5ce337a5 Device Boot Start End Blocks Id System /dev/sdc1 1 10968 88092396+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@HO-1-231:/# fdisk -l | grep dev Disk /dev/md0 doesn't contain a valid partition table Disk /dev/md1 doesn't contain a valid partition table Disk /dev/sda: 2000.4 GB, 2000398934016 bytes /dev/sda1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes /dev/sdb1 1 243201 1953512001 fd Linux raid autodetect Disk /dev/md0: 2000.4 GB, 2000396222464 bytes Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes /dev/sdc1 1 10968 88092396+ fd Linux raid autodetect Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes /dev/sdd1 1 6528 52436128+ fd Linux raid autodetect Disk /dev/md1: 53.7 GB, 53694496768 bytes root@HO-1-231:/# root@HO-1-231:/# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 1.9T 165G 1.7T 9% / tmpfs 7.9G 0 7.9G 0% /dev/shm /dev/md1 50G 25M 50G 1% /mnt/md1 root@HO-1-231:/# mdadm /dev/md1 -a /dev/sdc1 mdadm: added /dev/sdc1 root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdc1[2] sdd1[1] 52436032 blocks [2/1] [_U] [>....................] recovery = 0.8% (460928/52436032) finish=13.1min speed=65846K/sec root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdc1[2] sdd1[1] 52436032 blocks [2/1] [_U] [============>........] recovery = 61.8% (32446976/52436032) finish=5.1min speed=65110K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdc1[0] sdd1[1] 52436032 blocks [2/2] [UU] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# mdadm /dev/md1 --fail /dev/sdd1 --remove /dev/sdd1 mdadm: set /dev/sdd1 faulty in /dev/md1 mdadm: hot removed /dev/sdd1 root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdc1[0] 52436032 blocks [2/1] [U_] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# fdisk /dev/sdd The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 6528 52436128+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): d Selected partition 1 Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-243201, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201): +84G Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 10968 88092396+ 83 Linux Partition 1 does not start on physical sector boundary. Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 10968 88092396+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): t Selected partition 1 Hex code (type L to list codes): fd Command (m for help): p Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track, 243201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x3c581631 Device Boot Start End Blocks Id System /dev/sdd1 1 10968 88092396+ fd Linux raid autodetect Partition 1 does not start on physical sector boundary. Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@HO-1-231:/# mdadm /dev/md1 -a /dev/sdd1 mdadm: added /dev/sdd1 root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[2] sdc1[0] 52436032 blocks [2/1] [U_] [===============>.....] recovery = 76.3% (40046528/52436032) finish=3.1min speed=66193K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[2] sdc1[0] 52436032 blocks [2/1] [U_] [===================>.] recovery = 97.1% (50961088/52436032) finish=0.3min speed=68716K/sec md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md1 : active raid1 sdd1[1] sdc1[0] 52436032 blocks [2/2] [UU] md0 : active raid1 sda1[1] sdb1[0] 1953511936 blocks [2/2] [UU] unused devices: <none> root@HO-1-231:/# mdadm --detail /dev/md0 | grep -e 'Array Size' -e 'Device Size' Array Size : 1953511936 (1863.01 GiB 2000.40 GB) root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Device Size' Array Size : 52436032 (50.01 GiB 53.69 GB) root@HO-1-231:/# mdadm --detail /dev/md1 /dev/md1: Version : 0.90 Creation Time : Thu Feb 2 20:07:41 2012 Raid Level : raid1 Array Size : 52436032 (50.01 GiB 53.69 GB) Used Dev Size : 52436032 (50.01 GiB 53.69 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Thu Feb 2 21:09:54 2012 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 UUID : d2a575b9:b98dd42f:473eda47:d8152018 Events : 0.122 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 1 8 49 1 active sync /dev/sdd1 root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Used Dev Size' Array Size : 52436032 (50.01 GiB 53.69 GB) Used Dev Size : 52436032 (50.01 GiB 53.69 GB) root@HO-1-231:/# mdadm --grow /dev/md1 -z max
root@HO-1-231:/# mdadm --detail /dev/md1 | grep -e 'Array Size' -e 'Used Dev Size' Array Size : 88092288 (84.01 GiB 90.21 GB) Used Dev Size : 88092288 (84.01 GiB 90.21 GB)
root@HO-1-231:/# mount /dev/root on / type xfs (rw,relatime,attr2,noquota) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) usbfs on /proc/bus/usb type usbfs (rw) tmpfs on /dev/shm type tmpfs (rw) /dev/md1 on /mnt/md1 type xfs (rw) root@HO-1-231:/# resize2fs /dev/md1 resize2fs 1.41.11 (14-Mar-2010) resize2fs: Bad magic number in super-block while trying to open /dev/md1 Couldn't find valid filesystem superblock.
root@HO-1-231:/# mc root@HO-1-231:/mnt/md1/siapsrv# exit exit root@HO-1-231:/# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 1.9T 165G 1.7T 9% / tmpfs 7.9G 0 7.9G 0% /dev/shm /dev/md1 50G 25M 50G 1% /mnt/md1
root@HO-1-231:/# xfs_growfs /mnt/md1 meta-data=/dev/md1 isize=256 agcount=16, agsize=819313 blks = sectsz=512 attr=2 data = bsize=4096 blocks=13109008, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal bsize=4096 blocks=6400, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 13109008 to 22023072
root@HO-1-231:/# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 1.9T 165G 1. T 9% / tmpfs 7.9G 0 7.9G 0% /dev/shm /dev/md1 84G 26M 84G 1% /mnt/md1
root@HO-1-231:/#md5sum -c md5sum
ok
Kamis, 19 Januari 2012
compress
How can I compress a whole directory under Linux / UNIX using a shell prompt?A. It is very easy to compress a Whole Linux/UNIX directory. It is useful to backup files, email all files, or even to send software you have created to friends. Technically, it is called as a compressed archive. GNU tar command is best for this work. It can be use on remote Linux or UNIX server. It does two things for you:
=> Create the archive
=> Compress the archive
You need to use tar command as follows (syntax of tar command):
tar -zcvf archive-name.tar.gz directory-name
Where,
Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory. If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
Where,
=> Create the archive
=> Compress the archive
You need to use tar command as follows (syntax of tar command):
tar -zcvf archive-name.tar.gz directory-name
Where,
- -z: Compress archive using gzip program
- -c: Create archive
- -v: Verbose i.e display progress while creating archive
- -f: Archive File name
$ tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory. If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
$ tar -zxvf prog-1-jan-2005.tar.gz
Where,
- -x: Extract files
$ tar -zxvf prog-1-jan-2005.tar.gz -C /tmp
$ cd /tmp
$ ls -
Langganan:
Postingan (Atom)