วันจันทร์ที่ 18 มิถุนายน พ.ศ. 2555

Window : Add Routing

วิธีดูตาราง Routing Table
1.Start
2.Run
3.พิมพ์ cmd ลงในช่อง run
4.ในหน้าจอ command line พิมพ์ route print
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.2     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link       192.168.1.2    281
      192.168.1.2  255.255.255.255         On-link       192.168.1.2    281
    192.168.1.255  255.255.255.255         On-link       192.168.1.2    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link       192.168.1.2    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link       192.168.1.2    281
===========================================================================

การอ่านตาราง
- Gateway ที่มี network destination เป็น 0.0.0.0 จะเป็น Default gateway.
  คือ ถ้าไม่พบเน็ตเวิร์คปลายทาง(network destination)กำหนดไว้ในตาราง คอมพิวเตอร์จะส่งแพคเกจนั้นๆออกไป โดยผ่านไปทาง Default gateway

- Computer จะส่งแพคเกจแบบ multicast(224.xxx.xxx.xxx -240.xxx.xxx.xxx)
ออกไปยังเน็ตเวิร์คปลายทาง 224.0.0.0 โดยผ่านไปทางอินเตอร์เฟส 192.168.1.2
และ Loop back อินเตอร์เฟส (127.0.0.1)

กำหนดเส้นทาง(Routing) ใน Windows Routing Table
Routing Table เป็นตัวกำหนดเส้นทาง ที่แพ็กเกจทั้งหมดจะไป เมื่อออกจากระบบ ซึ่งแพคเกจทั้งหมดจะถูกส่งไปยัง Router หรือ Switch และจากนั้น จะออกไปยังอินเทอร์เน็ต

ในบางกรณีที่อาจมีเครือข่าย ที่ต้องการไปถึง การกำหนดค่าเครือข่าย จึงจำเป็นต้องกำหนดเส้นทางเพิ่ม โดยการเพิ่มเส้นทางเข้าไปใน Windows Routing Table


Syntax:
route ADD xxx.xxx.xxx.xxx MASK xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx
Means:
route ADD “network” MASK “subnet mask”  “gateway ip”


เช่น , ถ้าเครื่อง อยู่บนเน็ตเวิร์ค 192.168.1.0 และ gateway คือ 192.168.1.10
ต้องการจะกำหนดเส้นทางไปยังเน็ตเวิร์ค 10.10.10.0/24  สามารถกำหนด คำสั่ง เพิ่ม route ดังนี้ :
route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.10
Routing table จะมีผลทันที และ แพคเกจทั้งหมดที่จะไปยังเน็ตเวิร์ค 10.10.10.x  จะถูกส่งผ่าน ไอพี 192.168.1.10.
Routing Table จะเปลี่ยนให้ และทำงานให้จนกว่าจะมีการ Reboot ถ้าต้องการให้มีผลถาวรให้เพิ่ม -p :
route -p ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.10



C:\>route /?

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

C:\>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น