LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-05-2015, 11:50 AM   #1
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Rep: Reputation: Disabled
how i can create taptun or loopback in centos


hello guys
iwant create a taptun or loopback interface and share net from eth0 to this
please help me about this thanks
my os is centos 5
thanks
 
Old 04-06-2015, 08:28 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
While creating a tap/tun is fairly easy, I'm not sure what you are trying to achieve. Your wording seems to indicate that you want to bridge them.

Easiest way to make one, modprobe tun and then use tunctl to create it.

excerpt from man page
tunctl [-f tun-clone-device] [-u owner] [-t device-name]
tunctl [-f tun-clone-device] -d device-name

generally you won't need to use the -f option unless your tap/tun master is in an odd place

Last edited by estabroo; 04-06-2015 at 09:11 AM.
 
Old 04-06-2015, 10:06 AM   #3
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by estabroo View Post
While creating a tap/tun is fairly easy, I'm not sure what you are trying to achieve. Your wording seems to indicate that you want to bridge them.

Easiest way to make one, modprobe tun and then use tunctl to create it.

excerpt from man page
tunctl [-f tun-clone-device] [-u owner] [-t device-name]
tunctl [-f tun-clone-device] -d device-name

generally you won't need to use the -f option unless your tap/tun master is in an odd place
hi thanks for your replay
sorry for bad speak english
i do like this in windows that create a ms loopback interface and share internet from main interface to loopback
and want do this steps in centos
create a loopback interface and share internet too
i hope understand my mean
thanks
 
Old 04-07-2015, 03:04 PM   #4
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Can you make a network diagram showing what you'd like to do?

The reason I'm asking for a diagram is to help figure out what you'd like to do. Centos already has a network loopback, it's the lo interface. So I'm guessing your looking for something more like

Code:
computer A (eth0) <-> (eth1) Computer B (eth0) <-> Internet   where you want A to be able to get to the internet

Or

Computer B (eth0) <-> Internet                                    (eth0) Computer A
        (vpn tun) <---------------------------------------------> (vpn tun)
Though that last scenario would require A to have internet access already

Last edited by estabroo; 04-07-2015 at 03:21 PM. Reason: added examples
 
Old 04-07-2015, 03:28 PM   #5
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
hello ok sure
i have a software that need a loopback interface with internet so i do this in windows like this diagram
pictures diagram step by step and i want do this on the centos server

local area connection = main interface
local area connection 2 = loopback interface

http://uploads.im/b5YHo.png

http://uploads.im/903yf.png

http://uploads.im/7ZpXk.png


i want do look like this diagram work on the centos server
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	12
Size:	15.0 KB
ID:	18030   Click image for larger version

Name:	2.png
Views:	15
Size:	14.0 KB
ID:	18031   Click image for larger version

Name:	3.png
Views:	11
Size:	30.0 KB
ID:	18032  
 
Old 04-07-2015, 04:10 PM   #6
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
So does the Centos server have just one ethernet card hooked up or multiple?

If it's just a single interface then something like this would work. Using those pictures as the prefix you'd like this on.

Add an ip alias (this is your loopback equivalent)
Code:
  Temporary - ifconfig eth0:share 192.168.0.1 netmask 255.255.255.0
  Permanent - for centos you'll need to go into /etc/sysconfig/network-scripts and copy ifcfg-eth0 to ifcfg-eth0:share and update the device and ip information in that file
Turn on ip forwarding:
Code:
  Temporary - echo 1 > /proc/sys/net/ipv4/ip_forward or sysctl -w net.ipv4.ip_forward=1
  Permanent - edit your sysctl file, typically /etc/sysctl.conf, look for the line that says net.ipv4.ip_forward, switch it from a 0 to a 1
Tell your computer to masquerade for the other hosts:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

192.168.0.0/24 is the cidr notation for the prefix containing the ip address assigned to the ip alias eth0:share

You'll want to save that iptables stuff with something like - /sbin/service iptables save
so that it'll be there after a reboot. I'd try it out first to make sure it's doing what you want before saving it.


Then just tell the other computers sharing it that the Centos server aliased ip address (192.168.0.1) is their default route, which will vary depending on what OSes they are.

Last edited by estabroo; 04-07-2015 at 04:11 PM. Reason: fixed ip alias info
 
Old 04-07-2015, 04:26 PM   #7
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
ok thanks man
yes this diagram just have one loopback interface
this diagram should be work
i need test this and reply soon
again many thanks
 
Old 04-09-2015, 12:16 AM   #8
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
i do this diagram
so my software unfortunately cannot detect the loopback interface in linux (but in windows no have problem )
and i try add one more interface
im using vmware vsphere for my operation systems and add new virtual interface in normally detect and i continue to diagram
my diagram complete but still in linux have problem and not working
if you want i can send info for chek this and better understand my mean
thanks estabroo
 
Old 04-10-2015, 07:53 AM   #9
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Any information would be helpful. I don't know anything about vsphere so I probably won't be much help there.

Are you saying the Centos server is running in vsphere? If so, outside stuff won't see that ip alias unless the virtual ethernet is bridged in vmware
 
Old 04-21-2015, 04:12 PM   #10
mr-secret
LQ Newbie
 
Registered: Apr 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
ok look this link i want get this configure:

https://www.digitalocean.com/communi...sing-softether

all steps will be ok . i have problem just in step7
this guide say two ways for NAT and tech me for secure nat but i want use local brdige with dhcp server
please guide me for this
thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create two loopback interfaces rsousa05004 Linux - Newbie 3 07-28-2014 03:28 PM
Can't create partition on mdadm raid5 and images mounted over loopback emat Linux - Software 2 06-11-2011 01:23 PM
[SOLVED] How do I create a loopback disk image? judoka Linux - Newbie 10 08-18-2009 07:53 AM
mdadm, images over loopback, raid5, can't create partitions emat Linux - Software 1 05-03-2007 03:46 PM
How do I create a jffs2 loopback image? rjlee Linux - General 0 04-22-2006 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration