Beruflich Dokumente
Kultur Dokumente
closertorealgear.Therearemanywaystodothisbasedonwhatinternetconnectionyou
areusing.IfyoujusthaveanADSLmodem/routerconnectedtotheethernetportofyour
physicalmachinehavingaprivateIPaddressitisverysimpletogetyourlabtotheinternet.
ButifyouareusingaWiFiconnection/Datacard/adevicethatrequiresyoutoassigna
publicIPonthephysicalinterfacegettingyourlabtoaccesstheinternetrequiresafewmore
commandsinLinuxorafewmoreclicksinWindows.Apartfrommakingconfiguration
changestoyouroperatingsystemNAThastobeconfiguredontheemulatedrouterthat
connectstotheinternet.
ConnectingGNS3totheInternetScenario1
(PhysicalinterfacehasaprivateIPaddress)
Inthisscenarioyourphysicalmachineisconnectedtoamodem/routerusingaRJ45cable
andtheethernetportofyourcomputerhasaprivateIPaddressassignedmanuallyorvia
DHCP.
ThisisthesimplestmeansofconnectingGNS3totheinternet.OpenGNS3asan
administrator(Windows)byrightclickingitandselectingRunasadministratororasaroot
user(Linux)byusingthesudocommand.
jesin@ubuntu:~$ sudo gns3
Placeacloudnodeinyourtopology,rightclickselectconfigureandfromthedropdownlist
undertheethernettabselectLocalAreaConnectiononWindowsoreth0onLinuxand
clickOK.
Selectandaddthenetworkinterfaceofthe
physicalcomputer
Connectaroutertothiscloudusinganethernetlink,opentheconsoleoftherouterand
navigatetotheinterfacewhichisconnectedtothecloudnode.
R1>enable
R1#configure terminal
R1(config)#interface FastEthernet 0/0
Nowifthemodem/routerconnectedtothephysicalcomputerhasabuiltinDHCPserveruse
thefollowingcommandtoconfiguretherouterporttorecieveIPaddressviaDHCP.
R1(config-if)#ip address dhcp
elseassigntheastaticIPaddress
R1(config-if)#ip address 192.168.1.3 255.255.255.0
Bringthisinterfaceup
R1(config-if)#no shutdown
IfyouhadchoosetheDHCPwayofassigningIPaddressyouwillseethefollowingline
ConnectingGNS3totheInternetScenario2
(WiFiorphysicalinterfacehasapublicIPaddress)
YoursetupcomesunderthisscenarioifyourphysicalmachineusesWiFitocommunicate
withyourmodemoryouareusingamodemwhichassignsapublicIPaddressdirectlytothe
physicalinterfaceofyourcomputer.
Inthiscasedirectlyconnectingtheroutertothephysicalcomputersethernetportshownin
thepreviousstepdoesnotmakeitworkbecausetheGNS3routerwillalsobeneedinga
publicIPaddresstocommunicate.IncasethephysicalcomputerisusingWiFitheproblem
willarisebecauseasecuredWLANusesWPA/WEPhencetheGNS3routerwillfailto
communicatewithyourWiFirouteritself.
Linux
InLinuxwewillbecreatingaloopback(TAP)interface,connecttheGNS3routertoitand
configureNATusingIPTablestoforwardpacketsfromtheloopbackinterfacetothephysical
networkportofthecomputer.Apackageisneededwhichcanbeinstalledusingthe
followingcommands.
InRHEL/CentOSvariants:
yum install uml-utilities
InDebian/Ubuntuvariants:
apt-get install uml-utilities
Oncethepackageisinstalledrunthefollowingcommandsasroottocreatealoopback
interfaceandassignanIPaddresstoit.
tunctl -t tap0
ifconfig tap0 10.200.200.1 netmask 255.255.255.252 up
Entertap0undertheNIOTAPtabandclick
add
Thecloudisnowready,addaroutertothetopologyandconnectittothecloud,poweron
therouterandconfigureitsinterfacewithanIPaddressinthesamerangeastheIP
assignedtothetap0interface.
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface FastEthernet 1/0
R1(config-if)#ip address 10.200.200.2 255.255.255.252
R1(config-if)#no shutdown
Addadefaultroutesothattherouterknowswheretoforwardtheinternettraffic.
R1(config)#ip route 0.0.0.0 0.0.0.0 10.200.200.1
TrypingingapublicIPaddressandyoushouldgetareply.Pingingadomainnamewillfail
asDNSisnotyetconfigured.
Windows
MovingontoWindowstodothesamething,thefirsttaskistocreatealoopbackinterface.
Openrunandtypehdwwiz.exetoopentheAddNewHardwareWizard
OpentheAddHardwarewizardfromrun
ClicknextintheAddHardwareWizard
Selecttoaddyourhardwaremanuallyandclicknext.
ChoosetheoptiontoInstallthehardware
manuallyfromalist
UndercommonhardwaretypesselectNetworkAdapterandclicknext.
ChooseNetworkAdaptersunderCommon
hardwaretypes
UnderManufacturerselectMicrosoftandunderNetworkAdapterchooseMicrosoft
LoopbackAdapterandclicknext.
SelectMicrosoftundermanufacturerand
MicrosoftLoopbackAdapterundernetwork
adapter
Anewloopbackinterfacehasbeencreated
AnIPaddresshastobeassignedtotheloopbackinterfacenow.GotoStart>Control
Panel>NetworkandInternet>NetworkSharingCenter,fromtheleftpaneclickNetwork
Connections,rightclickyourinternetconnection(itcanbeaWLANconnection,dialup
connection,PPPoEconnectionetc)selectpropertiesandgotothesharingtab.
EnableInternetConnection
Sharingontheinterfacewhich
connectstotheinternet
Selectoptionsasshowninthescreenshotabove,theLocalAreaConnection3Ihave
selectedisthenameofthenewlycreatedloopbackinterfacewhichshouldbereplacedby
thenamedisplayedinyoursystem.ClickOKtwice,atthispointyourloopbackinterfacewill
beassignedanIPaddress(192.168.37.1/24),itisyourchoicetouseitorchangeit.Inthis
articleIwillbechangingit.RightclicktheLoopbackconnection,selectproperties,select
InternetProtocolVersion4,clickpropertiesandenteranIPaddress,subnetmask.
AssignanIPaddressandsubnetmask
totheloopbackinterface
YoumayhavetorestartyourcomputerforthisloopbackinterfacetoshowupinGNS3.Open
GNS3byrightclickingitandchoosingRunasadministrator,insertacloudnodeintothe
topology,rightclickselectconfigure
Addtheloopbackadapterfromtheconfigure
dialogboxofthecloudnode
Addaroutertothetopology,connectoneofitsethernetportstothecloudandstartthe
router.ItistimetoassignanIPaddresstothisinterface.
R1>enable
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface FastEthernet 1/0
R1(config-if)#ip address 10.255.255.2 255.255.255.252
R1(config-if)#no shutdown
Addadefaultrouteonthisrouter.
R1(config)#ip route 0.0.0.0 0.0.0.0 10.255.255.1
TrypingingapublicIPaddressandyoushouldgetareply.Pingingdomainnameswillresult
inanerrorasDNShasnotyetbeenconfigured.
ConfiguringDNSonCiscoIOS
NowthatroutersinGNS3areabletoconnecttotheinternetwontitbeniceifyoucoulduse
friendlydomainnamesinsteadofIPaddresses.DNScanbeconfigureintwoeasy
commandsgivenbelow.
R1(config)#ip domain-lookup
R1(config)#ip name-server 8.8.8.8 8.8.4.4