Monday, November 5, 2007

Configuring Windows as PC router

It has been my obsession to connect my virtual machine to my physical local area network. I have tried it by using bridge connection but it couldn't. And yesterday i was doing my experience again, and this time i try to use router.

I configured my laptop (Windows XP Pro) to be a PC router which is connected to two of virtual networks running on VMware.

In the first network, 10.10.1.1/29, i run Windows Server 2003 Standard Edition which has IP address: 10.10.1.2/29 connected to the gateway 10.10.1.1/29 (VMware Network Adapter). Whereas, in the second network, 10.10.1.8/29, i run Debian GNU/Linux Etch which has IP address: 10.10.1.10/29 and connected to gateway 10.10.1.9/29.

After setting up all the network and also the routing table, i connected my laptop to the LAN at Software Engineering Lab on my college with IP address: 10.126.17.121/24 and gateway 10.126.17.1/24.


And the result is???


Shown at tcpdump: ping 10.126.17.1 from Debian

kresna:/home/fitrah# tcpdump -nt
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
arp who-has 10.10.1.9 tell 10.10.1.10
arp reply 10.10.1.9 is-at 00:50:56:c0:00:02
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 1, length 64
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 2, length 64
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 3, length 64
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 4, length 64
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 5, length 64
IP 10.10.1.10 > 10.126.17.1: ICMP echo request, id 9507, seq 6, length 64

8 packets captured
8 packets received by filter
0 packets dropped by kernel


It was failed, Nooo!!!


I didn't know what was the problem because i can't run windump from my laptop so i couldn't see the packets which moved between laptop and 10.126.17.1.24. But i had my assumption:


The ICMP packets sent from 10.10.1.10/29 could move to 10.126.17.1/24, BUT 10.126.17.1/24 couldn't reply because it didn't know where the network 10.10.1.8/29 is.

or

my routing table was wrong


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\M. Fithrah Muttaqin>route print
===========================================================================
Interface List
0×1 ……………………… MS TCP Loopback interface
0×2 …00 50 56 c0 00 02 …… VMware Virtual Ethernet Adapter for VMnet2
0×3 …00 50 56 c0 00 01 …… VMware Virtual Ethernet Adapter for VMnet1
0×10005 …00 0f b0 d2 b7 d0 …… Realtek RTL8139/810x Family Fast Ethernet NIC - Packet Scheduler Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.126.17.1 10.126.17.121 20
10.10.1.0 255.255.255.248 10.10.1.1 10.10.1.1 20
10.10.1.1 255.255.255.255 127.0.0.1 127.0.0.1 20
10.10.1.8 255.255.255.248 10.10.1.9 10.10.1.9 20
10.10.1.9 255.255.255.255 127.0.0.1 127.0.0.1 20
10.126.17.0 255.255.255.0 10.126.17.121 10.126.17.121 20 <— 10.126.17.121 255.255.255.255 127.0.0.1 127.0.0.1 20
10.255.255.255 255.255.255.255 10.10.1.1 10.10.1.1 20
10.255.255.255 255.255.255.255 10.10.1.9 10.10.1.9 20
10.255.255.255 255.255.255.255 10.126.17.121 10.126.17.121 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
169.254.0.0 255.255.0.0 10.10.1.1 10.10.1.1 30
224.0.0.0 240.0.0.0 10.10.1.1 10.10.1.1 20
224.0.0.0 240.0.0.0 10.10.1.9 10.10.1.9 20
224.0.0.0 240.0.0.0 10.126.17.121 10.126.17.121 20
255.255.255.255 255.255.255.255 10.10.1.1 10.10.1.1 1
255.255.255.255 255.255.255.255 10.10.1.9 10.10.1.9 1
255.255.255.255 255.255.255.255 10.126.17.121 10.126.17.121 1
Default Gateway: 10.126.17.1
===========================================================================
Persistent Routes:
None

But it's ok, there are still many ways, though i've not think yet. At least i have something to post in this blog.


Here is the way to configure Windows as a PC router:


By default, Windows can't forward incoming IP address, as a result it can't route IP address between networks.

But we could make Windows as a PC router by adding little modification on the registry.


Note:
On Windows 2000/NT we don't need to modify the registry because there is an option to make Windows as PC router
enter control panel> network > TCP/IP Properties > router > IP Forwarding


In order to know the changes before and after modifying windows registry, run ipconfig /all on command prompt. Before act as router, "IP Routing Enabled""false".
(on Windows IP Configuration section) should be


Here is windows registry modification:


1. Open windows registry editor

Start -> Run -> type regedit

2. Find this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

3. Change dword value IPEnableRouter to 1

4. Restart windows


After windows reboot, run ipconfig /all on command prompt, if "IP Routing Enabled" value is set to "yes", then Windows has been a PC Router. The next step is creating routing table by route command on command prompt.


That's all folks, don't forget to leave your comment yeah!

No comments: