This posts details how to connect GNS3 network to real networks. you can use this post for various scenarios, in fact whatever you can think of. So, say for example you have a physical router connected to your home network and you want to configure VPN between your router and ASA (or any other device) living in the GNS3 network for testing / lab purposes .OR you may also want to setup VPN / Routing between two GNS3 Networks living on two different PCs (these two PC must be attached to each other either directly or via hub / broadband router).
Here how it will look like for a normal home user as I suppose you will be doing this lab at home. Otherwise, you can use a hub/switch to connect two PCs together. If you are using home network, reserve the IP addresses used in the lab or use spare IP addresses such that you dont have a conflict. Or use an isolated hub/switch to connect devices together.
Connecting two GNS3 Networks
1. I will be using GNS with ASA running on it for both PCs. You can use a router if you like. Now, you will have to follow this Post below to get ASA running on GNS3 and to connect it to the host PC. You will have to configure PC1 and PC2 the same way. The only difference is of IP addresses that you will be using for PC1 and PC2 loopback address and ASAs interfaces running on these PCs. However, from the steps in post below you can stop at step 13 if you don't want ASDM loaded on the firewall.
PC 1 IP: 192.168.0.2/24
Loopback IP to connect to GNS3 running on PC1: 10.10.10.2/24
ASA1 Management Interface IP: 10.10.10.1/24
PC2 IP: 192.168.0.3/24
Loopback IP to connect to GNS3 running on PC2: 18.104.22.168/24
ASA2 Management Interface IP: 22.214.171.124/24
3. Follow this post below to configure both of your PCs to work as router. This step is required such that your PC can accept traffic from 192.168.0.0/24 subnet and pass it onto 10.10.10.0/24 or 126.96.36.199/24 subnet which are used to connect host operating system to GNS3.
2. After you have followed the Steps in two posts above with configuring ASAs with right IP addresses as detailed in Step 1 and configure PC as routers, you will go to next step by adding default routes to these devices.
On ASA1, you will use following command in global configuration mode
route management 0.0.0.0 0.0.0.0 10.10.10.2
One ASA2, you will use following command in global configuration mode
route management 0.0.0.0 0.0.0.0 188.8.131.52
3. On both PC, you will open command prompt as administrator and use following two commands. These will tell the PCs that to reach 10.10.10.0/24 and 184.108.40.206/24 what next hop IP address they should use.
PC1: route -p add 220.127.116.11 mask 255.255.255.0 192.168.0.3
PC2: route -p add 10.10.10.0 mask 255.255.255.0 192.168.0.2
4. With this done, you can try pinging 18.104.22.168 & 1 from PC1 and it should succeed. The same way you can try pinging from PC2 to 10.10.10.2 & 1 and it should succeed. Now that’s your two GNS3 network ready for your labs. If you want to play with routing or VPNs between firewalls or something else you can do that. Next step is to configure router attached to the network for the same.
Connecting GNS3 Network to Router
5. Continuing from step 4, attach and connect router to the hub / home router and configure its interface with IP address 192.168.0.4/25
ip address 192.168.0.5 255.255.255.0
6. Add routes for both GSN3 networks
ip route 10.10.10.0 255.255.255.0 192.168.0.2
ip route 22.214.171.124 255.255.255.0 192.168.0.3
7. Try pinging from router to both 10.10.10.1 & 126.96.36.199 and it should succeed.
That's you done with your full setup working. Its now upto to you to tweak this setup if you want to GNS3 on a PC to connect with a router. OR you don't want a router in the setup but just two GNS3 networks working together. Configurations are endless, its just you have to add routes to devices and it will all work a breeze. Need any help or questions, leave a message on the post.