Difference between revisions of "Windows ipconfig and route command"

From Ever changing code
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Hi. It's pretty funny talking about Windows and routing :0, however I need to document how to change a route metric when my Internet is from WLAN but LAN interface has just been configured by DHCP.
Hi. It's pretty funny talking about Windows and routing :0, however I need to document how to change a route metric when my Internet is from WLAN but LAN interface has just been configured by DHCP.
= Modify static route =
;BEFORE


  C:\>route print
  C:\>route print
Line 17: Line 21:
  Active Routes:
  Active Routes:
  Network Destination        Netmask          Gateway      Interface  Metric
  Network Destination        Netmask          Gateway      Interface  Metric
           0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.80     25
           0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.85     25
           <span style="color: blue">0.0.0.0          0.0.0.0         On-link        10.0.99.12     10</span>
           <span style="color: blue">0.0.0.0          0.0.0.0       10.10.10.1      10.10.10.2     10</span>
        10.0.99.0  255.255.255.128         On-link        10.0.99.12   266
        10.10.10.0  255.255.255.248         On-link        10.10.10.2   266
         10.0.99.12 255.255.255.255        On-link        10.0.99.12   266
         10.10.10.2 255.255.255.255        On-link        10.10.10.2   266
      10.0.99.127 255.255.255.255        On-link        10.0.99.12   266
        10.10.10.7 255.255.255.255        On-link        10.10.10.2   266
         127.0.0.0        255.0.0.0        On-link        127.0.0.1    306
         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.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
   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.80   281
       192.168.1.0    255.255.255.0        On-link      192.168.1.85   281
       192.168.1.80 255.255.255.255        On-link      192.168.1.80   281
       192.168.1.85 255.255.255.255        On-link      192.168.1.85   281
     192.168.1.255  255.255.255.255        On-link      192.168.1.80   281
     192.168.1.255  255.255.255.255        On-link      192.168.1.85   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        127.0.0.1    306
         224.0.0.0        240.0.0.0        On-link        10.0.99.12   266
         224.0.0.0        240.0.0.0        On-link        10.10.10.2   266
         224.0.0.0        240.0.0.0        On-link      192.168.1.80   281
         224.0.0.0        240.0.0.0        On-link      192.168.1.85   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        127.0.0.1    306
   255.255.255.255  255.255.255.255        On-link        10.0.99.12   266
   255.255.255.255  255.255.255.255        On-link        10.10.10.2   266
   255.255.255.255  255.255.255.255        On-link      192.168.1.80   281
   255.255.255.255  255.255.255.255        On-link      192.168.1.85   281
  ===========================================================================
  ===========================================================================
  Persistent Routes:
  Persistent Routes:
Line 41: Line 45:
  < --- output omitted --- >
  < --- output omitted --- >


CHANGE is used to modify gateway and/or metric only.
;Command <code>route CHANGE</code> is used to modify gateway and/or metric only.


                                                           +50 metric change
                                                           +50 metric change
                   network      mask    interface        /
                   network      mask    interface        /
  C:\>route CHANGE 0.0.0.0 MASK 0.0.0.0 10.0.99.12 METRIC 50 IF 13
  C:\>route CHANGE 0.0.0.0 MASK 0.0.0.0 <span style="color: blue">10.10.10.2</span> METRIC 50 IF 13
                                                                \interface number from Interface List
                                                                \interface number from Interface List


 
;Verification
Verification, METRIC has been added +50 and it is now 60. The gateway is now 192.168.1.254 that belongs to my WLAN card.
METRIC has been added +50 and it is now 60. The default gateway is now 192.168.1.254 that belongs to my WLAN card has metric lower cost then Ethernet connection.


  C:\>route print
  C:\>route print
  < --- output omitted --- >
  < --- output omitted --- >
IPv4 Route Table
  IPv4 Route Table
  ===========================================================================
  ===========================================================================
  Active Routes:
  Active Routes:
  Network Destination        Netmask          Gateway      Interface  Metric
  Network Destination        Netmask          Gateway      Interface  Metric
           0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.80     25
           0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.85     25
           <span style="color: blue">0.0.0.0          0.0.0.0        On-link        10.0.99.12     60</span>
           <span style="color: blue">0.0.0.0          0.0.0.0        10.0.0.2      10.10.10.2     60</span>
        10.0.99.0 255.255.255.128         On-link        10.0.99.12   266
        10.10.10.0 255.255.255.248        On-link        10.10.10.2    266
         10.0.99.12 255.255.255.255        On-link        10.0.99.12   266
        10.10.10.2 255.255.255.255         On-link        10.10.10.2   266
         10.10.10.7  255.255.255.255        On-link        10.10.10.2    266
        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.85    281
      192.168.1.85  255.255.255.255        On-link      192.168.1.85    281
    192.168.1.255  255.255.255.255        On-link      192.168.1.85    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        10.10.10.2    266
        224.0.0.0        240.0.0.0        On-link      192.168.1.85    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        10.10.10.2   266
  255.255.255.255  255.255.255.255        On-link      192.168.1.85    281
===========================================================================
Persistent Routes:
  None
   < --- output omitted --- >
   < --- output omitted --- >
= Enable IP routing in Windows 7 =
This procedure should apply to other Windows OS incl. 2000/Vista/8 but it has been verified only on Win7.
# Open <tt>regedit</tt> as Admin
# Navigate to <tt>"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"</tt>
# Change <tt>IPEnableRouter</tt> to 1
# Run services->Routing and Remote->start
Reboot was not necessary after starting the service but please reboot first if it does not work.
;Verify
ipconfig /all
Windows IP Configuration
    Host Name . . . . . . . . . . . . : IP-C0#####0
    Primary Dns Suffix  . . . . . . . : corp.amazonworkspaces.com
    Node Type . . . . . . . . . . . . : Hybrid
    <span style="color: red">IP Routing Enabled. . . . . . . . : Yes</span>
    WINS Proxy Enabled. . . . . . . . : No
    DNS Suffix Search List. . . . . . : eu-####-1.ec2-utilities.amazonaws.com
                                        us-####-1.ec2-utilities.amazonaws.com
                                        ec2.internal
                                        eu-####-1.compute.internal
                                        corp.amazonworkspaces.com
                                        amazonworkspaces.com
<--- output omitted ----->
[[Category:Windows]]

Latest revision as of 18:58, 2 May 2015

Hi. It's pretty funny talking about Windows and routing :0, however I need to document how to change a route metric when my Internet is from WLAN but LAN interface has just been configured by DHCP.

Modify static route

BEFORE
C:\>route print
===========================================================================
Interface List
 17...7c e9 d3 e3 8d 84 ......Bluetooth Device (Personal Area Network)
 15...60 67 20 02 a2 d1 ......Microsoft Virtual WiFi Miniport Adapter
 14...60 67 20 02 a2 d0 ......Intel(R) Centrino(R) Advanced-N 6205
 13...00 21 cc ca c3 9f ......Intel(R) 82579LM Gigabit Network Connection
  1...........................Software Loopback Interface 1
 22...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
 23...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.1.254     192.168.1.85     25
          0.0.0.0          0.0.0.0       10.10.10.1       10.10.10.2     10
       10.10.10.0  255.255.255.248         On-link        10.10.10.2    266
       10.10.10.2  255.255.255.255         On-link        10.10.10.2    266
       10.10.10.7  255.255.255.255         On-link        10.10.10.2    266
        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.85    281
     192.168.1.85  255.255.255.255         On-link      192.168.1.85    281
    192.168.1.255  255.255.255.255         On-link      192.168.1.85    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        10.10.10.2    266
        224.0.0.0        240.0.0.0         On-link      192.168.1.85    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        10.10.10.2    266
  255.255.255.255  255.255.255.255         On-link      192.168.1.85    281
===========================================================================
Persistent Routes:
  None

IPv6 Route Table
< --- output omitted --- >
Command route CHANGE is used to modify gateway and/or metric only.
                                                          +50 metric change
                 network       mask    interface         /
C:\>route CHANGE 0.0.0.0 MASK 0.0.0.0 10.10.10.2 METRIC 50 IF 13
                                                               \interface number from Interface List
Verification

METRIC has been added +50 and it is now 60. The default gateway is now 192.168.1.254 that belongs to my WLAN card has metric lower cost then Ethernet connection.

C:\>route print
< --- output omitted --- >
 IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.1.254     192.168.1.85     25
          0.0.0.0          0.0.0.0         10.0.0.2       10.10.10.2     60
       10.10.10.0  255.255.255.248         On-link        10.10.10.2    266
       10.10.10.2  255.255.255.255         On-link        10.10.10.2    266
       10.10.10.7  255.255.255.255         On-link        10.10.10.2    266
        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.85    281
     192.168.1.85  255.255.255.255         On-link      192.168.1.85    281
    192.168.1.255  255.255.255.255         On-link      192.168.1.85    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        10.10.10.2    266
        224.0.0.0        240.0.0.0         On-link      192.168.1.85    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        10.10.10.2    266
  255.255.255.255  255.255.255.255         On-link      192.168.1.85    281
===========================================================================
Persistent Routes:
  None
 < --- output omitted --- >

Enable IP routing in Windows 7

This procedure should apply to other Windows OS incl. 2000/Vista/8 but it has been verified only on Win7.

  1. Open regedit as Admin
  2. Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"
  3. Change IPEnableRouter to 1
  4. Run services->Routing and Remote->start

Reboot was not necessary after starting the service but please reboot first if it does not work.

Verify
ipconfig /all
Windows IP Configuration 

   Host Name . . . . . . . . . . . . : IP-C0#####0
   Primary Dns Suffix  . . . . . . . : corp.amazonworkspaces.com
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : Yes
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : eu-####-1.ec2-utilities.amazonaws.com
                                       us-####-1.ec2-utilities.amazonaws.com
                                       ec2.internal
                                       eu-####-1.compute.internal
                                       corp.amazonworkspaces.com
                                       amazonworkspaces.com
<--- output omitted ----->