It is currently Wed Nov 14, 2018 3:21 am


All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Tutorial: Connect to the Internet using GNS3 0.8.3.1 and OSX
PostPosted: Mon Dec 24, 2012 6:23 pm 
Offline

Joined: Tue Jul 17, 2012 1:34 pm
Posts: 214
How to connect to the Internet using GNS3 0.8.3.1 and OS X Mountain Lion

There seems to be a lot of confusion around setting up a live Internet connection using GNS3 running on Mac OS X Mountain Lion. This is mainly due to the fact that you cannot simply connect a GNS3 device node (like a router) to your Mac's Ethernet Interface. Instead you have to use a transitional interface, known as a tap device. This is a virtual Interface driver that has to be installed in OS X. Here's a quick and dirty rundown that should help clear things up.

Important Note: You cannot connect to the Internet using Wi-Fi and GNS3. Your Mac must have a physical Ethernet connection to the Internet.


Let's begin...

1> Turn off your Mac's Wi-Fi antenna. Attatch an Ethernet cable from your Mac to your Internet router or cable modem.

2> Download and Install OS X TunTap drivers from h**p://tuntaposx.sourceforge.net/

3> Verify your Mac's IP settings.

This information can be obtained using System Preferences and Network, or ifconfig and netstat -r. Here's my MacBook Pro's network settings. I'll be using these settings for this example. You'll need this information from your PC to set things up properly.

My MacBook (example):

IP Address: 10.1.10.139 /24 (Interface en0)
Gateway: 10.1.10.1
DNS: 8.8.8.8


4> Elevate unix permissions on the dynamips app. This step allows dynamips to connect to the tap drivers.

sudo chown root /Applications/GNS3.app/Contents/Resources/dynamips*
sudo chmod 4755 /Applications/GNS3.app/Contents/Resources/dynamips*




5> Create your GNS3 Lab:

Open GNS3. Add a Router and a Cloud node to your workspace. Double-click the Cloud node to configure it with the tap interface. Click C1, NIO TAP and type /dev/tap0 in the field provided. Click Add, Apply and OK.

Now create an Ethernet link between your router and the cloud.

Example:
R1 F0/0 <----Ethernet link----> C1 nio_tap:/dev/tap0


6> Configure the TAP Interface with an IP address in OS X:

Configure interface tap0 with the dummy network you're using in GNS3 (172.16.1.0 /24 for this example). You can perform this step only after a link has been made in GNS3 from a device node to a Cloud node configured with /dev/tap0 (otherwise tap0 does not show up in OS X's ifconfig). Open the OS X Terminal app and type the following commands:

sudo ifconfig tap0 172.16.1.1 255.255.255.0 up

Type ifconfig to verify your tap0 settings, then use ping to test the interface from the OS X Terminal:

$ ping 172.16.1.1


7> Configure your GNS3 Router:
Go back to GNS3, open a Console to the router, and add the following commands:

enable
config t
int f0/0
ip address 172.16.1.100 255.255.255.0
no shut
exit
ip route 0.0.0.0 0.0.0.0 172.16.1.1
ip domain-lookup
ip name-server 8.8.8.8



8> Test your tap0 interface connection from your GNS3 router using a ping command. If you get a reply then you're nearly done. If you don't get a reply, verify you've properly added an IP address to your tap0 interface and that it's on the same subnet as the connected Ethernet interface on your GNS3 router (open Terminal and type ifconfig tap0). Also, make sure the Ethernet interface on your GNS3 router is up (use show ip interface brief).

R1# ping 172.16.1.1


9> Lastly, configure forwarding and NAT in OS X between the TAP Interface and your real Ethernet Interface. This step bridges your GNS3 lab on tap0 to the real world on your Mac's Ethernet interface (en0 in this example). Rebooting your Mac will undo these settings.

Note: 10.1.10.139 is the IP address of my Mac's en0 Interface. You will need to adjust the IP address and Interface name settings to match your computer.


sudo sysctl -w net.inet.ip.forwarding=1

sudo sysctl -w net.inet.ip.fw.enable=1

sudo natd -alias_address 10.1.10.139 -interface en0 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss

sudo ipfw add divert natd ip from any to any via en0



10> At this point you're done. The last thing you need to do is test connectivity. Ping tap0's IP address, then ping your Mac's Ethernet Interface, then the Internet gateway address, and finally ping an internet site.

Example:
R1# ping 172.16.1.1
R1# ping 10.1.10.139
R1# ping 10.1.10.1
R1# ping google.com



_________________
J.Neumann, GNS3 Contributor & Forum Moderator (Minion ID: sin.zx81.1981ad)
Author: Cisco Routers for Small Business (Apress)


Top
 Profile  
 
 Post subject: Re: Tutorial: Connect to the Internet using GNS3 0.8.3.1 and
PostPosted: Sun Nov 17, 2013 10:35 am 
Offline

Joined: Sun Nov 17, 2013 10:28 am
Posts: 1
Hi, fantastic user guide thank you very much! Strange that nobody in the last year didn't leave a positive comment since this is a very useful guide on tap config on osx.

I've a question for you: during the nat configuration you have provided (in the osx os) you need to put the current IP address of the network interface (in this case the e0). Do you know if there is an automatic way to pass only the interface name and leave to the command to take automatically the ip address assigned? I'm thinking when I'm moving or travelling with my laptop and I need to change manually the command: it would be nice to have it automatically configured.

Thank you again for your great support.

Marco


Top
 Profile  
 
 Post subject: Re: Tutorial: Connect to the Internet using GNS3 0.8.3.1 and
PostPosted: Thu Aug 21, 2014 12:16 am 
Offline

Joined: Thu Aug 21, 2014 12:03 am
Posts: 1
Congrats!!!!

You help me a lot. Very helpful your post.




Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO