Thursday, October 8, 2015

How to connect devices running on GNS3 to Internet in Ubuntu/Deepin

Hello everyone, you may came in a situation where you will need to connect devices running on visualization environment like GNS3 to Internet, here are steps.

i. Launch gns3 on command line
➜  ~  sudo gns3

ii. Add devices
For this lab, am going to use one router Cisco router 7200 and Cloud which will be connecting gns3 devices to Internet via my laptop which is connected to Internet using Ethernet cable connected to router .


iii. Cabling and bridging Cloud to the to my Ethernet interface.

Right-click on Cloud and select configure, then add etho (which is interface of my laptop as generic interface of the cloud) and then Appy and save.


Now connect interface of the router to this generic interface of the cloud.
Now power on the router for further configuration.

iv. Router Configuration
Now login to the router for configuration

➜  ~  telnet 127.0.0.1 2001
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connected to Dynamips VM "R1" (ID 1, type c7200) - Console port
Press ENTER to get the prompt.
ROMMON emulation microcode.

 a. Configure interface
Configure the interface to obtain IP address via dhcp of my public router (you may assign static IP also if you prefer).


R1#show ip interface brief Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        unassigned      YES unset  administratively down down  
R1#
R1#config tEnter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface fastEthernet 0/0R1(config-if)#ip address dhcp
R1(config-if)#no shutdown
R1(config-if)#
R1(config-if)#

*Oct  8 13:06:28.963: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Oct  8 13:06:29.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#
*Oct  8 13:06:37.907: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.0.17, mask 255.255.255.0, hostname R1

R1(config-if)#
As you can see the interface is assigned 192.168.0.17 IP from the router dhcp

b. Configure default gateway
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1


Now you are able to access the internet from the router

R1#ping 8.8.8.8 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 160/169/196 ms
R1#
c. Further config to enable users to login to the router remotely, configure passwords and also dns configuration.

Dns configuration

R1(config)#ip domain lookup
R1(config)#ip name-server 8.8.8.8 8.8.4.4

Configure password to allow remote login

R1(config)#line console 0
R1(config-line)#transport preferred none
R1(config)#line vty 0 4
R1(config-line)#transport preferred none 
R1(config)#username admin secret admin@2015
R1(config)#enable secret admin@2015
R1(config)#service password-encryption 
R1(config)#aaa new-model
R1(config)#aaa authentication login default local
R1(config)#aaa authentication enable default enable
      R1(config)#exit
      R1#wr

Ping google.com to test DNS

R1#ping google.com
Translating "google.com"...domain server (192.168.0.1) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 41.220.141.187, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/16/28 ms
R1#


Now your good, the router is online, and anyone within your network can login.

Enjoy!!!!!.




No comments:

Post a Comment