วันอังคารที่ 4 กันยายน พ.ศ. 2555

การใช้งาน Static Route จดไว้หน่อย


ไม่แน่ใจว่า ใช้โปรแกรม access connection หรือเปล่า ถ้าใช้ก็ต้องตั้งไว้ว่า เวลาเปลี่ยนโปรไฟล์แล้ว ไม่ให้มัน disconnect. ด้วยน่ะครับ ไม่งั้นบางครับมันจะตัดไปเลย แต่ว่าส่วนใหญ่ถ้าต่อด้ายสายแลนไม่เป็นไร แต่ว่าถ้าเป็น wireless ไม่ได้เลยนะครับ มันจะ power off wireless เลย

เอาละครับ เริมกันเลยน่ะ

1. เริ่มด้นด้วย การเสียบสายแลนปกติก่อน เครื่องน่าจะได้ IP จากตัว DHCP Server ของบริษัท เช้น 192.168.1.79 255.255.255.0 GW 192.168.1.1
2. เสียบ aircard แล้วก็ connect ให้เรียบร้อย น่าจะได้ IP จากทาง ISP (DTAC, AIS, TURE) เช่น 212.12.13.23 255.255.255.224 GW 212.12.13.23 (ส่วนมาก มันจะให้ GW เป็นเครื่องเราเองเลย)
3. ที่นี่ก็ทำการ route add ตามนี่เลยครับ คิดว่าการใช้งาน server ที่ทำงาน เค้าน่าจะมี IP address range ที่ขึ้นต้นด้วย 192.168.x.x ทั้งหมด แต่ถ้าที่บริษัทใช้ตัวอื่นด้วย ก็ add เพิ่มได้ครับ พิมพ์ตามนี้เลย

route add 192.168.0.0 mask 255.255.0.0 192.168.1.1 --> อันนี้เป็นการบอกว่า ถ้าไปกลุ่ม IP 192.168.x.x ให้ผ่านทาง 192.168.1.1
route add 0.0.0.0 mask 0.0.0.0 212.12.13.23  --> อันนี้เป็นการบอกว่า ถ้าไปที่ IP อื่นๆทั้งหมด ให้ผ่านทาง 212.12.13.23

เท่านี้ก็สามารถเล่นเน็ทพร้อมกับการเข้าใช้งาน server ที่ทำงานได้แล้วครับ

route add 192.168.0.0 mask 255.255.0.0 192.169.17.1
ถ้าไป        192.168.0.0 255.255.0.0 ให้ไปทาง 192.169.17.1


route add 192.169.0.0 mask 255.255.0.0 192.168.17.1
route add 0.0.0.0 mask 0.0.0.0 212.12.13.23

***
command      One of these:
               PRINT     Prints  a route
               ADD       Adds    a route
               DELETE    Deletes a route
               CHANGE    Modifies an existing route

****
ถ้าWindows Vista ต้องใช้สิทธิ์ของ Admin ในการใช้คำสั่งน่ะครับ
รูปแบบ คำสั่งก็จะเป็น C:/> route add Mask -P ( -P หมายถึงให้มัน เป็น permanent ครับ Restart ก็ยังอยู่)

ตัวอย่างเช่น

C:/> route add 172.25.30.250 mask 255.255.255.255 192.168.9.5 -P

ถ้าต้องการลบทิ้งก็

C:/> route delete 172.25.30.250


***
Manipulates network routing tables.

ROUTE [-f] [-p] [-4|-6] command [destination]
                  [MASK netmask]  [gateway] [METRIC metric]  [IF interface]

  -f           Clears the routing tables of all gateway entries.  If this is
               used in conjunction with one of the commands, the tables are
               cleared prior to running the command.

  -p           When used with the ADD command, makes a route persistent across
               boots of the system. By default, routes are not preserved
               when the system is restarted. Ignored for all other commands,
               which always affect the appropriate persistent routes. This
               option is not supported in Windows 95.

  -4           Force using IPv4.

  -6           Force using IPv6.

  command      One of these:
                 PRINT     Prints  a route
                 ADD       Adds    a route
                 DELETE    Deletes a route
                 CHANGE    Modifies an existing route
  destination  Specifies the host.
  MASK         Specifies that the next parameter is the 'netmask' value.
  netmask      Specifies a subnet mask value for this route entry.
               If not specified, it defaults to 255.255.255.255.
  gateway      Specifies gateway.
  interface    the interface number for the specified route.
  METRIC       specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database
file NETWORKS. The symbolic names for gateway are looked up in the host name
database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,
(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only
matching destination routes are printed. The '*' matches any string,
and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Pattern match is only allowed in PRINT command.
Diagnostic Notes:
    Invalid MASK generates an error, that is when (DEST & MASK) != DEST.
    Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1
             The route addition failed: The specified mask parameter is invalid.
 (Destination & Mask) != Destination.


************************************************************************
Examples:

   > route PRINT
    > route PRINT -4
    > route PRINT -6
    > route PRINT 157*          .... Only prints those matching 157*

    > route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
             destination^      ^mask                   ^gateway metric^       ^
                                                                                      Interface^
      If IF is not given, it tries to find the best interface for a given
      gateway.
    > route ADD 3ffe::/32 3ffe::1

    > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2

      CHANGE is used to modify gateway and/or metric only.

    > route DELETE 157.0.0.0
    > route DELETE 3ffe::/32


************************************************************************ 

Examples 2

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.12.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

 
ข้อมูลจาก https://www.thaithinkpad.com/forum/index.php?topic=7257.0