How to install a loopback interface in Linux for GNS3.


After successful installation of GNS3, we will install loopback adapter on our Ubuntu, Centos, Redhat and Fedora systems, so that we can telnet into your routers.

Loopback tap installation on Ubuntu
user@admin-desktop:~$ sudo –i
root@ admin-desktop:~#apt-get install uml-utilities
root@ admin-desktop:~#modprobe tun
root@ admin-desktop:~#tunctl             This will create loopback interface tap0
root@ admin-desktop:~#ifconfig tap0 10.100.100.100 netmask 255.255.255.0 up
root@ admin-desktop:~#ifconfig            verify that tap0 is up and given ip is assigned.


If you want to add one more loopback interface
root@ admin-desktop:~#tunctl             This will create loopback interface tap1
root@ admin-desktop:~#ifconfig tap1 10.100.101.100 netmask 255.255.255.0 up

********************************************************************************
 
Loopback tap installation on Centos/Redhat/Fedora
We need tunctl which is not available in our local repositories. So we’ll have to add RPMForge repository. Steps to add this repo is given here
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge (Steps are the same for other 2 distros as well)

Ok lets install tunctl

[user@admin ~]$ su
Password: (Type in your root password here)
[root@admin /]# yum install tunctl
[root@admin /]# modprobe tun
[root@admin /]# cd /usr/sbin
[root@admin sbin]#./tunctl           This will create loopback interface tap0
[root@admin sbin]# /sbin/ifconfig tap0 10.100.100.100 netmask 255.255.255.0 up
[root@admin sbin]# /sbin/ ifconfig     verify that tap0 is up and given ip is assigned.

If you want to add one more loopback interface
[root@admin sbin]#./tunctl                 This will create loopback interface tap1
[root@admin sbin]# /sbin/ifconfig tap1 10.100.101.100 netmask 255.255.255.0 up

Change the ip with ifconfig according to your requirement.


Run GNS3 with root privileges, or you won’t be able to add these tap interfaces to GNS3.
Fire up GNS3


Drag the cloud onto the work-board and right click on it, Select Configure. Then Select NIO TAP, type tap0, press Add. Click Apply & ok. Now connect it to your router. 

 Important: Add these lines to iptables

sudo iptables -I INPUT -j ACCEPT -i tap0
sudo iptables -I OUTPUT -j ACCEPT -o tap0


Happy Learning :)




Share your views...

5 Respones to "How to install a loopback interface in Linux for GNS3."

Kalifornia411 said...

Dude you rock ~!!


November 13, 2011 at 11:28 AM
Babu said...

These tap interfaces are removed automatically during restart. What can be done to resolve it.


January 15, 2012 at 1:28 PM
Renato said...

This works fine, thanks a lot!


June 5, 2012 at 2:02 AM
crox sx said...

How to make it persistent so it will survive reboot ???


March 7, 2013 at 7:32 PM
YungSld said...

Thanks A lot .. This was Very Helpfull.. But i want to assign An IPv6 address to tap0 i.e 2001::1/64 how can i do that plz help ...


August 12, 2014 at 7:18 PM

Post a Comment

 

Contributors

Our Partners

DISCLAIMER: This site does not store any files on its server. I only index and link to content provided by other sites. All the files are from internet. In case of any query/objection regarding copyright or privacy, please inform me at Contact me and leave your comment here. I will immediately respond to you.