Install a loopback interface (TUN/TAP)

Hi there ,

I have an openSUSE 12.1, and I’m trying to install a loopback adapter, I need it for my VMs on VirtualBox.

I did the following to install a (TUN/TAP) …


modprobe tun
tunctl -t tap0
ifconfig tap0 172.16.1.21 netmask 255.255.255.0 up

till now it’s work fine, it’s added the (tap0) for my network. And the output of the ifconfig was :


eth0      Link encap:Ethernet  HWaddr 00:23:AE:3D:A9:F0  
          inet addr:192.168.1.21  Bcast:192.168.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3333 errors:0 dropped:2894 overruns:0 frame:0
          TX packets:304 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3135758 (2.9 Mb)  TX bytes:66155 (64.6 Kb)
          Interrupt:18 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1375 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1375 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:114022 (111.3 Kb)  TX bytes:114022 (111.3 Kb)

tap0      Link encap:Ethernet  HWaddr 36:24:15:2F:C3:A3  
          inet addr:172.16.1.21  Bcast:172.16.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)


,

But when I’m trying to restart the network service, the (tap0) removed and the output of the ifconfig after "rcnetwork restart) was :


eth0      Link encap:Ethernet  HWaddr 00:23:AE:3D:A9:F0  
          inet addr:192.168.1.21  Bcast:192.168.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3338 errors:0 dropped:2894 overruns:0 frame:0
          TX packets:322 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3136497 (2.9 Mb)  TX bytes:71283 (69.6 Kb)
          Interrupt:18 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1487 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1487 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:123258 (120.3 Kb)  TX bytes:123258 (120.3 Kb)


I installed it again but, it’s give me the same result, the (tap0) removed after restarting the network service.

Any idea !?

Hello,
ifconfig makes changes only temporarily.
Did you look at
files in /etc/sysconfig/network?

Thanks [mahol] for replay , and ya I looked at files in “etc/sysconfig/network” but I didn’t find the (tap0) there …

The output of “ls -l /etc/sysconfig/network” is :


-rw-r--r-- 1 root root 13894 May 24 23:27 config
-rw-r--r-- 1 root root  9964 May 24 23:27 dhcp
-rw------- 1 root root   216 May 22 18:07 ifcfg-eth0
-rw------- 1 root root   151 Mar  5 17:36 ifcfg-lo
-rw-r--r-- 1 root root 29394 Mar  5 17:36 ifcfg.template
-rw------- 1 root root   840 May 23 03:05 ifcfg-wlan0
drwxr-xr-x 2 root root  4096 May 12 10:17 if-down.d
-rw-r--r-- 1 root root   239 Mar  5 17:36 ifroute-lo
drwxr-xr-x 2 root root  4096 May 12 10:17 if-up.d
drwx------ 2 root root  4096 Oct 25  2011 providers
drwxr-xr-x 2 root root  4096 May 12 10:17 scripts

Even when I do “ifconfig tap0 up”, the output is :


tap0: unknown interface: No such device

Create a file there called ifcfg-tap0 look at ifcfg-eth0 contents and try to edit the new file accordingly then try the network restart. This post should also be helpful :slight_smile:
http://forums.opensuse.org/english/get-technical-help-here/network-internet/408932-q-opensuse-11-1-how-configure-tap-ip-persistent.html#post1951030

Thanks [glistwan] ,

Your replay was useful, but the tap0 didn’t work with NetworkManager, so I stop the NetworkManager and work with “ifup” ,

I creat a ifcfg-tap0 and edit it as :


BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='172.17.1.21/24'
MTU=''
NAME='TAP'
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
PREFIXLEN='24'
TUNNEL='tap'
TUNNEL_SET_GROUP=''
TUNNEL_SET_OWNER=''
TUNNEL_SET_PERSISTENT='yes'
INTERFACETYPE=tap


Thanks , and I’m sorry for late to replay …

Sorry forgot to mention that for those files to work you shouldn’t use NetworkManager. I don’t know how to do this with NetworkManager but I guess it’s possible. Glad to hear you got it working though :slight_smile: