Linux : How to add loopback on ubuntu

Loopback tap installation on Ubuntu

Mostly i like to practice on GNS3 . SO i need to create multiple look back on my ubuntu Box ..

Here is the way

user@K:~$ sudo —i
root@ K:~#apt-get install uml-utilities
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libreadline5
Suggested packages:
user-mode-linux
The following NEW packages will be installed:
libreadline5 uml-utilities
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 210kB of archives.
After this operation, 741kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
libreadline5 uml-utilities
Install these packages without verification [y/N]? y
Get:1 http://archive.ubuntu.com/ubuntu/ lucid/main libreadline5 5.2-7build1 [147kB]
Get:2 http://archive.ubuntu.com/ubuntu/ lucid/universe uml-utilities 20070815-1.1ubuntu2 [63.3kB]
Fetched 210kB in 5s (37.4kB/s)
Selecting previously deselected package libreadline5.
(Reading database … 208995 files and directories currently installed.)
Unpacking libreadline5 (from …/libreadline5_5.2-7build1_amd64.deb) …
Selecting previously deselected package uml-utilities.
Unpacking uml-utilities (from …/uml-utilities_20070815-1.1ubuntu2_amd64.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Setting up libreadline5 (5.2-7build1) …

Setting up uml-utilities (20070815-1.1ubuntu2) …
* Starting User-mode networking switch uml_switch                                             [ OK ]

Processing triggers for libc-bin …
ldconfig deferred processing now taking place
root@K:~#
root@K:~#
root@K:~#
root@ K:~#modprobe tun
root@ K:~#tunctl This will create loopback interface tap0
root@ K:~#ifconfig tap0 10.10.10.100 netmask 255.255.255.0 up
root@ K:~#ifconfig verify that tap0 is up and given ip is assigned.

If you want to add one more loopback interface

root@ K:~#tunctl
Note : This will create loopback interface tap1
root@ K:~#ifconfig tap1 10.20.10.100 netmask 255.255.255.0 up

4 comments to Linux : How to add loopback on ubuntu

  • Nirav

    How can i remove the loopback interface?

  • SuB

    Use this to remove loopback ‘tap3′:
    tunctl -d tap3

  • zidane

    hello Kartook,
    I installed vmware workstation in ubuntu 12.04. but i am unable to ping the vm running in bridge mode. i havent created any loopback adapters in ubuntu with the same ip. please help me. how to overcome this problem..

    zidane@zidane:~$ ifconfig
    eth0 Link encap:Ethernet HWaddr 10:bf:48:04:90:2c
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:714438 errors:0 dropped:0 overruns:0 frame:0
    TX packets:501117 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:929465731 (929.4 MB) TX bytes:128868535 (128.8 MB)
    Interrupt:47 Base address:0xe000

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:17714 errors:0 dropped:0 overruns:0 frame:0
    TX packets:17714 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:7551373 (7.5 MB) TX bytes:7551373 (7.5 MB)

    vmnet1 Link encap:Ethernet HWaddr 00:50:56:c0:00:01
    inet addr:192.168.150.1 Bcast:192.168.150.255 Mask:255.255.255.0
    inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    vmnet2 Link encap:Ethernet HWaddr 00:50:56:c0:00:02
    inet addr:192.168.153.1 Bcast:192.168.153.255 Mask:255.255.255.0
    inet6 addr: fe80::250:56ff:fec0:2/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    vmnet3 Link encap:Ethernet HWaddr 00:50:56:c0:00:03
    inet addr:172.16.242.1 Bcast:172.16.242.255 Mask:255.255.255.0
    inet6 addr: fe80::250:56ff:fec0:3/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    vmnet4 Link encap:Ethernet HWaddr 00:50:56:c0:00:04
    inet addr:192.168.120.1 Bcast:192.168.120.255 Mask:255.255.255.0
    inet6 addr: fe80::250:56ff:fec0:4/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    vmnet8 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
    inet addr:172.16.84.1 Bcast:172.16.84.255 Mask:255.255.255.0
    inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:109775 errors:0 dropped:0 overruns:0 frame:0
    TX packets:144372 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    wlan0 Link encap:Ethernet HWaddr 94:db:c9:44:13:3f
    inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::96db:c9ff:fe44:133f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2370717 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2703043 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:1739726841 (1.7 GB) TX bytes:2213373448 (2.2 GB)

  • [...] Now when you run it you’ll encounter an interesting bug/feature in metasploit as in that metasploit doesn’t allow connections from 127.0.0.1. You can work around this by adding your own local loopback interface as explained here: http://www.kartook.com/2010/10/linux-how-to-add-loopback-on-ubuntu/ [...]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>