Category: Daily command

วิธีลบ iptables rules ออกทั้งหมด

สืบเนื่องจากที่ผมเขียนเรื่อง NAT ในวันก่อนวันนี้ก็เลยเอาเรื่องการ Flush rules ของ iptables มาฝากครับ

ตามนี้เลย

iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT

จะรันทีละบรรทัด หรือจะเอาไปทำเป็น Script ก็ได้ครับ

แหล่งข้อมูล : http://www.cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html

Leave a Comment January 28, 2011

วิธีทำ NAT แชร์เน็ตแบบรีบๆ บน Ubuntu

ตามนี้เลยครับ สำหรับใครที่ต้องการแชร์เน็ตแบบทันใจ

โดยให้ eth0 เป็นขาที่ต่อเน็ต และขา eth1 เป็นขา local ที่ต้องการจะแชร์เน็ต มาดูวิธีกัน

กำหนด IP ของ eth1 ของเครื่องแม่ที่ต้องแชร์เน็ตให้เป็น 192.168.1.1/24

กำหนด IP เครื่อง Client ที่ต้องการจะแชร์เน็ตให้เป็น 192.168.1.xxx/24 ในที่นี้ผมกำหนดเป็น 192.168.1.10/24 และชี้ Gateway มาที่เครื่อง 192.168.1.1 ส่วน DNS ก็ชี้ไปที่ไหนก็ได้ครับ ผมขอชี้ไปที่ 8.8.8.8 ของ Google ละกัน

มาถึงส่วน Script กันบ้าง

สร้างไฟล์ nat.sh จากนั้น Copy Script ด้านล้างไปวางแล้ว Save

#!/bin/bash #Express NAT Shell Script echo "1" > /proc/sys/net/ipv4/ip_forward iptables -P FORWARD DROP iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -o eth0 -j MASQUERADE iptables -A FORWARD -d 192.168.1.0/24 -j ACCEPT iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT iptables -A FORWARD -j DROP

จากนั้นกำหนดสิทธิ์ให้สามารถรันได้โดย

sudo chmod +x nat.sh

แล้วก็รันกันได้เลย

sudo ./nat.sh

ทดลองเล่นเน็ตจากเครื่อง Client กันได้เลยจ้า

1 Comment January 24, 2011

คำสั่งเกี่ยวกับ iscsi-initiator-utils

วันนี้เก็บเอาคำสั่งเกี่ยวกับ iscsi-initiator-utils มาเก็บไว้กันลืมครับ
ก็เป็นพวกคำสั่ง discovery target การ login เข้าใช้ target แล้วก็คำสั่งลบ target ที่ไม่ต้องการ
ตามนี้ครับ

[root@rac1 ~]# iscsiadm -m discovery -t sendtargets -p 10.30.1.140  #คำสั่ง discovery
10.30.1.140:3260,1 iqn.1994-05.com.redhat:rac1
10.30.1.140:3260,1 iqn.1994-05.com.redhat:rac2
[root@rac1 ~]#
[root@rac1 ~]# /etc/init.d/iscsi restart
Logging out of session [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Logout of [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
Stopping iSCSI daemon:
iscsid dead but pid file exists                            [  OK  ]
Starting iSCSI daemon:                                     [  OK  ]
                                                           [  OK  ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Logging in to [iface: default, target: iqn.1994-05.com.redhat:rac2, portal: 10.30.1.140,3260]
Login to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
Login to [iface: default, target: iqn.1994-05.com.redhat:rac2, portal: 10.30.1.140,3260]: successful
                                                           [  OK  ]
[root@rac1 ~]#
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3263    26105625   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10240    10485744   83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10240    10485744   83  Linux

Disk /dev/sdd: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       10240    10485744   83  Linux

Disk /dev/sde: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       10240    10485744   83  Linux
[root@rac1 ~]#
[root@rac1 ~]# iscsiadm -m node -p 10.30.1.140 -T iqn.1994-05.com.redhat:rac2 -o delete
iscsiadm: This command will remove the record [iface: default, target: iqn.1994-05.com.redhat:rac2, portal: 10.30.1.140,3260], but a session is using it. Logout session then rerun command to remove record.
iscsiadm: Could not execute operation on all records. Err 22.
[root@rac1 ~]#
[root@rac1 ~]# iscsiadm -m node -p 10.30.1.140 -T iqn.1994-05.com.redhat:rac2 -u   #คำสั่ง logout จาก target
Logging out of session [sid: 2, target: iqn.1994-05.com.redhat:rac2, portal: 10.30.1.140,3260]
Logout of [sid: 2, target: iqn.1994-05.com.redhat:rac2, portal: 10.30.1.140,3260]: successful
[root@rac1 ~]#
[root@rac1 ~]# iscsiadm -m node -p 10.30.1.140 -T iqn.1994-05.com.redhat:rac2 -o delete    #คำสั่งลบ target
[root@rac1 ~]#
[root@rac1 ~]# /etc/init.d/iscsi restart   #คำสั่ง restart iscsi-initiator-utils
Logging out of session [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Logout of [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
Stopping iSCSI daemon:
iscsid dead but pid file exists                            [  OK  ]
Starting iSCSI daemon:                                     [  OK  ]
                                                           [  OK  ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Login to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
                                                           [  OK  ]
[root@rac1 ~]#
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3263    26105625   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10240    10485744   83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10240    10485744   83  Linux
[root@rac1 ~]# iscsiadm -m node -p 10.30.1.140 -T iqn.1994-05.com.redhat:rac1 -u
Logging out of session [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Logout of [sid: 1, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
[root@rac1 ~]#
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3263    26105625   8e  Linux LVM
[root@rac1 ~]# iscsiadm -m node -p 10.30.1.140 -T iqn.1994-05.com.redhat:rac1 -l #คำสั่ง login เข้าใช้งาน target
Logging in to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]
Login to [iface: default, target: iqn.1994-05.com.redhat:rac1, portal: 10.30.1.140,3260]: successful
[root@rac1 ~]#
[root@rac1 ~]# fdisk -l    #คำสั่งแสดง partition

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3263    26105625   8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10240    10485744   83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       10240    10485744   83  Linux
[root@rac1 ~]#

1 Comment January 7, 2011

วิธีติดตั้ง Gyachi บน Ubuntu 10.10

Gyachi เป็น Yahoo Messenger สำหรับ Linux
สำหรับวิธีติดตั้งบน Ubuntu 10.10 ทำตามนี้ได้เลยครับผม

sudo add-apt-repository ppa:adilson/experimental sudo apt-get update sudo apt-get install gyachi

Leave a Comment January 2, 2011

รัน emesene บน root ได้ด้วยหรือ

หางหายกันไปเสียนาน ก็งานมันยุ่งนี่ ไม่ค่อยมีเวลามา update blog เลย วันนี้โอกาสดี เพิ่งเล่น msn คุยกะพี่โสทร ก็คุยกันนานเพราะไม่ค่อยได้คุยกันเท่าไหร่ ถามไปถามมาเรื่องใช้โปรแกรมอะไรเล่น msn กัน พี่โสก็บอกว่าแกใช้ amsn แต่ผมใช้ emesene แกบอกว่า emesene รันบน root ไม่ได้ พี่แก login root ตลอดแกบอกว่าขี้เกียจ sudo แล้วอยู่ พี่โสก็บอกมาว่าถ้าจะรัน emesene ด้วยด้วยต้องมี option ด้วยตามนี้ emesene –i-know-that-running-emesene-as-root-is-bad แหม option อลังการดีแท้

เรามาลองดูกันว่าถ้ารัน emesene ด้วย root จะเกิดอะไรขึ้น

emesene as root

รันไม่ได้ แต่ถ้าคุณยอมรับความเสี่ยงก็ใช้ option –i-know-that-running-emesene-as-root-is-bad

มาดูการรันด้วยคำสั่ง

root@mrgill-laptop:~# emesene --i-know-that-running-emesene-as-root-is-bad

emesene on root

รันได้แว้ววว

ขอบคุณพี่โส สำหรับเนื้อหาบทความนี้

Leave a Comment November 29, 2010

วิธีการ Resize รูปภาพด้วย ImageMagick บน Ubuntu

สวัสดีครับ วันนี้ทำทิปการ Resize แบบ Batch resize ด้วยโปรแกรม ImageMagick มาฝากกัน สำหรับใครที่ใช้ Windows อยู่ก็คงคุ้นเคยกับการ Resize รูปภาพด้วยโปรแกรม ACDSee กันเป็นอย่างดี มาดูกันว่าต้องทำอย่างไรบ้าง

1. คุณต้องติดตั้งโปรแกรม ImageMagick ก่อนโดย

mrgill@mrgill-laptop:~$ sudo apt-get install imagemagick

เมื่อติดตั้งโปรแกรม ImageMagick แล้วคุณก็จะได้เจ้าโปรแกรม mogrify มาด้วย ซึ่งนี้แหละคือพระเอกของเราในวันนี้

2. มาเริ่มทำการ Resize ภาพกันเลยโดยให้คุณ Copy Directory ที่มีรูปภาพที่ต้องการออกมาเป็นอีก Directory นึง ตัวอย่าง

mrgill@mrgill-laptop:~$ cp -r /media/d/Pic_Original_Size /media/d/Pic_Resize

3. ใช้คำสั่ง mogrify ในการ resize กันได้เลยโดยใน Directory ผมจะมีไฟล์รูปภาพ .JPG อยู่

mrgill@mrgill-laptop:~$ cd /media/d/Pic_Resize
mrgill@mrgill-laptop:~$ mogrify -resize 640 *.JPG

ขั้นตอนด้านบนคือผมทำการ Resize รูปภาพที่ผมถ่ายมาซึ่งมีขนาด 2592×1944 px ให้กลายเป็นเป็น 640×480 px ทั้งหมด (*.JPG)

ลองนำไปใช้กันดูครับผมว่ามันสะดวกกว่ามานั่ง Scale Image กับ The Gimp นะ อิอิ

September 18, 2010

Daily Tips : วิธีเปิด X Windows มากกว่าหนึ่งหน้าจอ

วันนี้ได้รับ News letter จากเว็บ cyberciti.biz ฉบับนึงมีบทความน่าสนใจเรื่อง Linux / UNIX: Run Multiple X Sessions ผมเลยคลิกตามไปดู ก็เป็นเรื่องการ Start X Windows ของ Linux ขึ้นมาอีก Session นึงนั่นเอง Vivek เค้าเขียนบอกไว้ว่า ปกติแล้วเวลาที่เราเปิด Linux ขึ้นมาแล้วเข้าหน้า X Windows แล้ว X Windows นั้นจะอยู่ที่ Screen 0 เราสามารถ Start X Windows เพิ่มเติมได้อีกโดยการกำหนดหมายเลข Screen ต่อท้าย

ซึ่งมีขั้นตอนดังนี้
1. กด CTRL + ALT + F1 เพื่อเข้าหน้า Console tty1 แล้วกรอกข้อมูล login ให้เรียบร้อย
2. รันคำสั่ง startx

mrgill@mrgill-laptop:~$ starx -- :1

3. หากต้องการรัน X Windows เพิ่มอีก Session ก็ให้กด CTRL + ALT + F2 แล้วกรอกข้อมูล login ให้เรียบร้อยเหมือนเดิม จากนั้นรันคำสั่ง startx

mrgill@mrgill-laptop:~$ starx -- :2


เราก็จะมี X Windows 3 Session นั่นก็คือ Session ที่ Screen 0 – 2

4. หากต้องการสลับหน้าจอกับมาที่ Screen 0 ให้กด CTRL + ALT + F7
หากต้องการเปลี่ยนมาที่ Screen 1 ให้กด CTRL + ALT + F8
และถ้าอยากกลับมาที่ Screen 2 ก็กด CTRL + ALT + F9

เราสามารถรัน X Windows ได้สูงสุดถึง 6 Session คือ login เข้า tty1 – tty6 ได้โดยการกด CTRL + ALT + F1 ไปจนถึง F6 แล้วใช้คำสั่ง startx ตามด้วย Screen id ตามตัวอย่างด้านบน
และเรียกเข้า X Windows ได้โดยกด CTRL + ALT + F7 ไปจนถึง F12

เป็นทิปที่ผมเองก็เพิ่งรู้และได้ทดสอบแล้วว่าใช้งานได้จริง

แหล่งข้อมูล : http://www.cyberciti.biz/faq/running-multiple-x-sessions/

5 Comments April 28, 2010

Daily Tips : การเปลี่ยนชื่อไฟล์พร้อมกันที่ละหลายๆ ไฟล์

วันนี้พี่ที่บริษัทโทรมาเพราะมีปัญหาแตกไฟล์ที่ archive ไว้ไม่ได้เพราะติดปัญหาชื่อไฟล์มีเครื่องหมายโคลอน ” : ” อยู่ในไฟล์ด้วย เพราะ shell script ที่ผมเขียนไว้ให้ archive ไฟล์ตั้งให้มันสร้างชื่อไฟล์เป็นชั่วโมงและแสดงนาทีโดยผมเลือกใช้ ” : ” กั้นระหว่างหน่วยชั่วโมงและนาที ผมลอง ssh เข้าไปดูแล้วก็พบว่ามีไฟล์เยอะมากครั้นจะนั่ง rename ทีละไฟล์ก็คงลำบากแน่ๆ ก็เลย เข้า google แล้ว search วิธีการ rename ไฟล์ที่ละหลายๆ ไฟล์ก็ไปเจออยู่ที่ http://www.cyberciti.biz/tips/renaming-multiple-files-at-a-shell-prompt.html ทำตามเสร็จก็เลยคิดว่าเอามาเขียนไว้กันลืมด้วยดีกว่า

สมมติว่าผมมีไฟล์ file_XX:xx.txt อยู่ ซึ่งผมสร้างมาโดยคำสั่ง touch

mrgill@mrgill-laptop:~/lab_command$ ls file_15:35.txt file_16:30.txt file_18:55.txt

ถ้าหากผมใช้คำสั่ง rename หรือ mv ในการเปลี่ยนชื่อไฟล์ file_XX:xx.txt ให้เป็น file_XX_xx.txt ก็คงต้องทำ 3 ครั้ง แต่ด้วยวิธีต่อไปนี้เราสามารถเปลี่ยนชื่อไฟล์ทั้งหมดให้เป็น file_XX_xx.txt ได้ในคำสั่งเดียว โดย

mrgill@mrgill-laptop:~/lab_command$ rename "s/\:/_/g" *.txt

เมื่อ ” \: ” คือสิ่งที่เราต้องการจะเปลี่ยน และ ” _ ” คือสิ่งที่เราจะเอามาแทน ” : ” และ *.txt คือนามสุกลของไฟล์ที่เราต้องการจะเปลี่ยน
ผลที่ได้คือ

mrgill@mrgill-laptop:~/lab_command$ ls file_15_35.txt file_16_30.txt file_18_55.txt

ลองนำไปประยุกต์ใช้กันดู

6 Comments March 23, 2010

Daily Command : ใช้แรมไปเท่าไหร่หนอ

หลายครั้งครับที่อยากรู้ว่าตอนนี้เครื่องเราใช้แรมไปเท่าไหร่ ก็ลองใช้คำสั่งง่ายๆ อย่าง free ดูครับ

mrgill@mrgill-laptop:~$ free -m total used free shared buffers cached Mem: 1498 1466 32 0 109 825 -/+ buffers/cache: 531 966 Swap: 3153 0 3153

(more…)

Leave a Comment March 8, 2010

Daily Command : วิธีดู DHCP Information บน Ubuntu Desktop

ค้างคาใจอยู่นานแล้วครับสำหรับวิธีดูข้อมูล DHCP กรณีที่เราเป็น dhcp client ปกติ ifconfig ก็ดูได้เฉพาะว่าเราได้ ip อะไรแต่ดู gateway ไม่ได้

root@mrgill-laptop:~# ifconfig eth1 eth1 Link encap:Ethernet HWaddr 00:13:ce:34:94:ff inet addr:10.2.80.140 Bcast:10.2.80.255 Mask:255.255.255.0 inet6 addr: fe80::213:ceff:fe34:94ff/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:607200 errors:80 dropped:80 overruns:0 frame:0 TX packets:588053 errors:0 dropped:4 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:365549369 (365.5 MB) TX bytes:203281968 (203.2 MB) Interrupt:17 Base address:0xa000 Memory:b0101000-b0101fff

ครั้งจะไปดูใน /var/lib/dhcp3 ก็มีข้อมูลเยอะเสียจนไม่รู้ว่าอันไหนเป็นอันไหน

root@mrgill-laptop:/var/lib/dhcp3# ls -al total 84 drwxr-xr-x 2 root root 4096 2010-02-01 09:47 . drwxr-xr-x 73 root root 4096 2010-01-22 01:37 .. -rw-r--r-- 1 root root 1488 2010-01-23 12:49 dhclient-03fb849f-aed0-4560-8cb5-dd5336518d93-eth1.lease -rw-r--r-- 1 root root 497 2010-01-05 21:23 dhclient-03fb849f-aed0-4560-8cb5-dd5336518d93-wlan2.lease -rw-r--r-- 1 root root 10165 2010-02-01 17:46 dhclient-09f271e2-8327-47aa-a2b3-7d9e596d9953-eth0.lease -rw-r--r-- 1 root root 1100 2010-02-02 17:11 dhclient-1fe06dc5-f1ae-49c0-a8a7-4a8b41f72551-eth1.lease -rw-r--r-- 1 root root 1508 2010-01-19 17:31 dhclient-30ebb2f0-bfa4-45a2-ac06-23ec48487e7e-eth1.lease -rw-r--r-- 1 root root 992 2009-11-01 12:53 dhclient-36406c67-cbfa-471f-8ebf-6e41d6921e98-eth0.lease -rw-r--r-- 1 root root 767 2010-02-01 21:30 dhclient-55dee4d2-623f-445a-9b86-6bfd388aef8c-eth1.lease -rw-r--r-- 1 root root 769 2010-01-20 09:59 dhclient-55dee4d2-623f-445a-9b86-6bfd388aef8c-wlan2.lease -rw-r--r-- 1 root root 550 2009-12-17 22:08 dhclient-6ac2d0b1-a5d9-4ec9-825c-ccaaee54ff0e-eth1.lease -rw-r--r-- 1 root root 994 2009-10-23 20:32 dhclient-6ac2d0b1-a5d9-4ec9-825c-ccaaee54ff0e-wlan1.lease -rw-r--r-- 1 root root 497 2009-10-23 21:39 dhclient-6ac2d0b1-a5d9-4ec9-825c-ccaaee54ff0e-wlan2.lease -rw-r--r-- 1 root root 2475 2009-11-06 18:09 dhclient-7abf6b67-2f25-47c0-b9fb-fdc29501b75e-eth1.lease -rw-r--r-- 1 root root 448 2010-02-01 09:55 dhclient-845ea4c4-871f-4a1d-91e1-19b7c0cc5fe3-eth1.lease -rw-r--r-- 1 root root 550 2010-01-21 23:09 dhclient-98188c5a-e7d5-4515-8379-e00bd5274d85-eth1.lease -rw-r--r-- 1 root root 409 2010-01-28 10:42 dhclient-bcf946a9-63ac-411a-903f-7e0b3cfbbd6a-eth1.lease -rw-r--r-- 1 root root 0 2010-01-19 14:36 dhclient-cf8c29be-461b-4a22-abd6-b079d28eb017-eth1.lease -rw-r--r-- 1 root root 1030 2010-02-01 17:50 dhclient-d7e573a1-b0f6-408c-9ddc-8150ed91f473-eth1.lease -rw-r--r-- 1 root root 1100 2010-02-02 20:45 dhclient.leases

วันนี้เลยนำคำสั่ง nm-tool มาฝากครับ(ที่จริงคลิกดู information ที่ NetworkManager ก็ได้)

root@mrgill-laptop:~# nm-tool NetworkManager Tool State: connected - Device: eth1 [Auto mrgill_wifi] --------------------------------------------- Type: 802.11 WiFi Driver: ipw2200 State: connected Default: yes HW Address: 00:13:CE:34:94:FF Capabilities: Speed: 54 Mb/s Wireless Properties WEP Encryption: yes WPA Encryption: yes WPA2 Encryption: yes Wireless Access Points (* = current AP) truewifi: Infra, 00:02:CF:94:60:E0, Freq 2412 MHz, Rate 54 Mb/s, Strength 27 *mrgill_wifi: Infra, 02:23:69:3A:F9:AE, Freq 2412 MHz, Rate 54 Mb/s, Strength 98 WPA WPA2 true_homewifi: Infra, 00:13:49:E4:26:9C, Freq 2437 MHz, Rate 54 Mb/s, Strength 65 WEP IPv4 Settings: Address: 10.2.80.140 Prefix: 24 (255.255.255.0) Gateway: 10.2.80.254 DNS: 10.2.80.254 - Device: eth0 ----------------------------------------------------------------- Type: Wired Driver: 8139too State: unavailable Default: no HW Address: 00:C0:9F:EE:19:BA Capabilities: Carrier Detect: yes Speed: 10 Mb/s Wired Properties Carrier: off

จากคำสั่งดังกล่าวเราก็จะเห็น Gateway และ DNS ด้วย

Leave a Comment February 2, 2010


Chat

Recent Entries

Random Posts

Social Network

Tag Cloud

Calendar

May 2012
S M T W T F S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Twitter: imrgill

RSS LinuxToday

RSS HowToForge

RSS UbuntuClub

RSS Blognone

RSS PowerWindowsBlog

Tag

Categories

Archives

Blogroll

Meta

Get Adobe Flash player