This summary is not available. Please click here to view the post.
Sunday, August 30, 2009
Thursday, August 13, 2009
[FreeBSD] ลงโปรแกรม netatalk เอาไว้ share ให้ mac
Wednesday, August 12, 2009
[Dynamips] script สำหรับ start process dynamips
vi dynamips.sh
#!/usr/local/bin/bash
# Script for start dynamips process
DYNAMIPS_BIN=/usr/local/bin/dynamips
WORKDIR=/dynamips/cache
PORT_START=3600
NUM_PROC=12
case "$1" in
start)
cd $WORKDIR
i=0
while [ $i -ne $NUM_PROC ]
do
(( PORT = $PORT_START + $i ))
echo "Start dynamips hypervisor port $PORT "
nice $DYNAMIPS_BIN -H $PORT -l /dev/null > /dev/null 2>&1 &
(( i = i + 1 ))
done
exit 0
;;
stop)
echo "Stop dynamips all process .."
pkill -9 dynamips
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` {start|stop|restart}" >&2
exit 64
;;
esac
[FreeBSD] Create RamDisk on FreeBSD
vi mkramdisk.sh
#!/bin/sh
MOUNT_DIR="/dynamips/cache"
SIZE=512M
case "$1" in
start)
/sbin/mdmfs -S -s $SIZE md0 $MOUNT_DIR
echo "$SIZE ramdisk created on /dev/md0 and mounted on $MOUNT_DIR"
exit 0
;;
stop)
/sbin/umount $MOUNT_DIR
/sbin/mdconfig -d -u 0
echo "ramdisk unmounted from $MOUNT_DIR and deleted from /dev/md0"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` {start|stop|restart}" >&2
exit 64
;;
esac
[FreeBSD] Example /etc/pf.conf
vi /etc/rc.conf
pf_enable="YES" <== enable pf
vi /etc/pf.conf
## Macros
SYN_ONLY="S/FSRA"
EXT_NIC="bge0"
INT_NIC="bge1"
ALLOWED_ICMP="echoreq"
ALLOWED_TCP="{ 22,80 }"
TRUSTED_IP="{ 10.0.0.0/24, 1.1.1.1 }"
# Your Internet IP goes in the EXT_IP variable
EXT_IP="1.2.3.4"
# Your private network IP goes in the INT_IP variable
# if you have two NICs on the machine
INT_IP="192.168.1.1"
## TABLES
## GLOBAL OPTIONS
set block-policy drop
## TRAFFIC NORMALIZATION
## QUEUEING RULES
## TRANSLATION RULES (NAT)
## FILTER RULES
# Block everything (inbound AND outbound on ALL interfaces) by default (catch-all)
block all
# Default TCP policy
block return-rst in log on $EXT_NIC proto TCP all
pass in log quick on $EXT_NIC proto TCP from any to $EXT_IP port $ALLOWED_TCP flags $SYN_ONLY keep state
# Default UDP policy
block in log on $EXT_NIC proto udp all
# It's rare to be hosting a service that requires UDP (unless you are hosting
# a dns server for example), so there typically won't be any entries here.
# Default ICMP policy
block in log on $EXT_NIC proto icmp all
pass in log quick on $EXT_NIC proto icmp from any to $EXT_IP icmp-type $ALLOWED_ICMP keep state
# Default IP Policy
block in log on $EXT_NIC all
pass in log quick on $EXT_NIC from $TRUSTED_IP to $EXT_IP keep state
block out on $EXT_NIC all
pass out quick on $EXT_NIC from $EXT_IP to any keep state
# Allow the local interface to talk unrestricted
pass in quick on lo0 all
pass out quick on lo0 all
Sunday, August 9, 2009
Saturday, August 8, 2009
[Nokia] E71 ใช้ battery มากกว่าปกติเพราะ garmin xt
If you have just installed Garmin Mobile XT version 5.0.0.20 on your Mobile Phone (So far only verified on my Nokia E71 running Symbian OS), you may have notice that your battery life for you mobile phone seems to have reduce substantially from about 2 days before the installation to about 1 day.
This it seem is due to a background process that Garmin Mobile XT starts upon boot up of your Symbian operating system as well as upon running of the Mobile XT software.
Things you will need to verify if you are affected by this background process.
1.) An installed version of Garmin Mobile XT (Duh….)
2.) JBak Task Manager. (You can download it from: http://jbak.ru/jbaktaskman_en.php)
| Step 1 | Start JBakTaskMan |
| Step 2 | Select Menu >> Tools >> Processes |
| Step 3 | Type TSRAutoStart.exe |
If the process TSRAutoStart.exe is found, you are most likely affected by this background process wasting away your battery life.
How to kill the TSRAutostart?
| Step 1 | Follow the previous Step 1 – 3 |
| Step 2 | Select the process TSRAutoStart.exe |
| Step 3 | Select Menu >> Terminate process |
How to prevent TSRAutostart from auto loading upon boot up.
| Step 1 | Plug mobile phone to PC under Mass Storage mode (! important as directories used are otherwise hidden) |
| Step 2 | Delete file CardRunner.RSC in directory under Mobile Phone\Resource\plugins\CardRunner.RSC |
| Step 3 | Delete the file CardRunner.dll in directory under Mobile Phone\sys\bin\CardRunner.dll |
Permanent Fix.
Well if you are seeking a permanent fix, you could always try downloading the latest version of Garmin Mobile XT (Link: http://www8.garmin.com/support/collection.jsp?product=010-11034-00).
As of version 5.0.0.40, this background process is now an option that can be switched off, saving you the trouble of killing the process each time you run Garmin.
| Step 1 | Start GMobileXT (Duh…) |
| Step 2 | Goto Tools >> Settings >> System |
| Step 3 | Scroll down all the way till you see the option “Launch background service” |
| Step 4 | Select Disabled then Done to save |
h**p://www.symbian-freak.com/forum/viewtopic.php?p=440972
After installing v5.0.0.x0:
Turn OFF your S60
Turn S60 back ON
Launch JBak Taskman to see if TSRAutoStart.exe is running in Memory in Menu -> Tools -> Processes even though it's set as DISABLED by default in Tools -> Settings -> System -> Launch Background Services.
If TSRAutoStart.exe is running after S60 is turned ON, do this:
START GarminMXT v5.0.0.x0, goto Tools -> Settings -> System -> Launch Background Services and change to ENABLED.
EXIT GarminMXT, re-start GarminMXT and goto Tools -> Settings -> System -> Launch Background Services and change to DISABLED
Turn OFF S60
Turn ON S60
Launch JBak TaskMan to check that TSRAutoStart.exe ISN'T in Menu -> Tools -> Processes
Now:
START GarminMXT v5.0.0.x0
EXIT GarminMXT
Launch JBak TaskMan to check that TSRAutoStart.exe ISN'T in Menu -> Tools -> Processes
Now, you should find:
TSRAutoStart.exe doesn't start when you first turn ON your S60
TSRAutoStart.exe now CLOSES automatically when you exit GarminMXT v5.0.0.x0
It appears that GarminMXT v5.0.0.x0 when being installed, doesn't create the DISABLED entry and has to be done manually by setting to ENABLE, then DISABLE.
Friday, August 7, 2009
Thursday, June 11, 2009
[Linux] script สำหรับ check process แบบง่ายๆๆๆๆ
สืบเนื่องมาจากเปิด transmission-daemon ไว้แล้วมัน crash บ่อยเลยอยากให้มี script ไว้ตรวจสอบแล้ว restart อัติโนมัติ
[Linux] ใช้ wireshark บน text mode
ผมติดการใช้งาน wireshark แต่พอดีมาใช้บน linux แล้วเป็น text mode command line ใช้ tcpdump มันแสดงผลไม่สวยเห็น wireshark มีบน text เหมือนกันชื่อ tshark
[Cisco] QoS ทำการ marking ค่า DSCP แล้ว ไม่เห็นค่าที่ mark
Diagram
Thursday, May 21, 2009
[Juniper] How to simulate JUNOS w/ FreeBSD & VirtualBox on MacBook or Linux
Friday, May 15, 2009
[Cisco] QoS for GRE tunnel
เราต้องการ implement QOS บน tunnel interface เนื่องจาก traffic วิ่งอยู่บน tunnel
pre-config บน physical และ tunnel ปกติครับ
ip access-list extended data
permit ip any host 2.2.2.22
ip access-list extended voice
permit ip any host 2.2.2.2
!
ip route 0.0.0.0 0.0.0.0 Tunnel0
policy-map QOS
class voice
priority 128
class data
bandwidth 1024
int tu0
service-policy output QOS <== เมื่อเราป้อน service-policy บน interface tunnel จะเห็น warnning ว่าไม่สามารถ support
Class Based Weighted Fair Queueing not supported on interface Tunnel0
ปกติถ้ามีการ implement QOS บน physical interface เราจะไม่สามารถ classify packet ได้เพราะมันถูก encasulation ด้วย tunnel ไปแล้ว
แต่ถ้าไป implement บน tunnel ก็จะติดfeature บางอย่างบน tunnel interface
วิธีแก้ดังนี้
Solution:
Reference: h**p://www.cisco.com/en/US/tech/tk543/tk545/technologies_tech_note09186a008017405e.shtml
class-map match-all data
match access-group name data
class-map match-all map-voice
match ip precedence 2
class-map match-all map-data
match ip precedence 6
class-map match-all voice
match access-group name voice
!
!
policy-map QOS
class map-voice
priority 128
class map-data
bandwidth 1024
policy-map QOS-tunnel
class voice
set ip precedence 2
class data
set ip precedence 6
int tu0
qos pre-classify
service-policy output QOS-tunnel
int s1/0
service-policy output QOS
Verify:
AS1_PE1#sh int tu0
Tunnel0 is up, line protocol is up
Hardware is Tunnel
Internet address is 10.0.0.1/24
MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel source 192.168.12.1 (Serial1/0), destination 192.168.12.2, fastswitch TTL 255
Tunnel protocol/transport GRE/IP, key disabled, sequencing disabled
Tunnel TTL 255
Checksumming of packets disabled, fast tunneling enabled
Last input 00:05:26, output 00:05:26, output hang never
Last clearing of "show interface" counters 00:20:05
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo (QOS pre-classification) <=================== qos pre-classify
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
140 packets input, 24080 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicast)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
140 packets output, 17360 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 output buffer failures, 0 output buffers swapped out
! Before test send voice packet
AS1_PE1#sh policy-map int tu0
Tunnel0
Service-policy output: QOS-tunnel
Class-map: voice (match-all)
0 packets, 0 bytes <==== 0 packet
5 minute offered rate 0 bps, drop rate 0 bps
Match: access-group name voice
QoS Set
ip precedence 2
Packets marked 0
Class-map: data (match-all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access-group name data
QoS Set
ip precedence 6
Packets marked 0
Class-map: class-default (match-any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
AS1_PE1#sh policy-map int s1/0
Serial1/0
Service-policy output: QOS
Class-map: map-voice (match-all)
10 packets, 1280 bytes <===== 10 packet
5 minute offered rate 0 bps, drop rate 0 bps
Match: ip precedence 2
Queueing
Strict Priority
Output Queue: Conversation 264
Bandwidth 128 (kbps) Burst 3200 (Bytes)
(pkts matched/bytes matched) 10/1280
(total drops/bytes drops) 0/0
Class-map: map-data (match-all)
20 packets, 2560 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: ip precedence 6
Queueing
Output Queue: Conversation 265
Bandwidth 1024 (kbps) Max Threshold 64 (packets)
(pkts matched/bytes matched) 20/2560
(depth/total drops/no-buffer drops) 0/0/0
Class-map: class-default (match-any)
54 packets, 3736 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
! After test send voice 100 packet
AS1_PE1#ping 2.2.2.2 so lo0 re 100
Type escape sequence to abort.
Sending 100, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (100/100), round-trip min/avg/max = 4/16/44 ms
AS1_PE1#sh policy-map int tu0
Tunnel0
Service-policy output: QOS-tunnel
Class-map: voice (match-all)
100 packets, 10000 bytes <--- match voice 100 packet
5 minute offered rate 2000 bps, drop rate 0 bps
Match: access-group name voice
QoS Set
ip precedence 2
Packets marked 100
Class-map: data (match-all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access-group name data
QoS Set
ip precedence 6
Packets marked 0
Class-map: class-default (match-any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
AS1_PE1#sh policy-map int s1/0
Serial1/0
Service-policy output: QOS
Class-map: map-voice (match-all)
110 packets, 14080 bytes <===== voice increase 100 packet
5 minute offered rate 2000 bps, drop rate 0 bps
Match: ip precedence 2
Queueing
Strict Priority
Output Queue: Conversation 264
Bandwidth 128 (kbps) Burst 3200 (Bytes)
(pkts matched/bytes matched) 110/14080
(total drops/bytes drops) 0/0
Class-map: map-data (match-all)
20 packets, 2560 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: ip precedence 6
Queueing
Output Queue: Conversation 265
Bandwidth 1024 (kbps) Max Threshold 64 (packets)
(pkts matched/bytes matched) 20/2560
(depth/total drops/no-buffer drops) 0/0/0
Class-map: class-default (match-any)
61 packets, 4209 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any