LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-17-2019, 03:51 AM   #1
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Rep: Reputation: Disabled
Question Is it possible to create a virtual/clone interface to map to another existing interface ?


Hello,

I would like to define a network interface, called "specific-network" for example, that corresponds to a real interface (like eth2) or a bonding (called bond0, that uses eth0 and eth1).

My idea is to use this virtual interface in an application's configuration, in order to be able to change the network interface that is really used (eth2 or bond0) without modifying application's configuration (the modification will be made in the OS configuration). My application uses ethernet frames, this is why I need configure the network interface to use.

I am running RHEL 6.8, and I didn't find any solution to achieve this (I've seen some redhat documentation on alias an clone interfaces, but this isn't exactly what I'm looking for).

Do you know if it's possible ? Does someone has an idea how to make this ?

(and sorry for my approximate english ;-) )
 
Old 06-17-2019, 03:31 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,702

Rep: Reputation: 143Reputation: 143
Does VLAN interface meet your requirement?
 
Old 06-18-2019, 03:34 AM   #3
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
I don't know, I will have a look at it.
Thanks
 
Old 06-18-2019, 04:06 AM   #4
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
Well, VLAN interface didn't fit my need.

To precise my need, I have a network, my host, and a specific equipment (communicating with protocol based on ethernet) which is only communicating with an application on my host. Because of the ethernet based protocol, my application need to know the device to use.

I would like my application to run in 2 differents cases with the same configuration :
- case 1 : my specific equipment is connected to the network, so my application must use bond0 (my host is connected to the network with a bonding),
- case 2 : my specific equipment is connected to my host, so my application must use eth2.

My idea is to create a virtual device to use in my application's configuration, and configure this virtual device as myNetwork=bond0 for case 1, or myNetwork=eth2 for case 2.

Is it more clear ? Do you have ideas ?
 
Old 06-18-2019, 08:07 AM   #5
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,224

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Why have you dismissed aliasing. We use it this way: The email server is at IP address 192.168.0.26, the web server is at IP address 192.168.0.27, the ssh server is at IP address 192.168.0.28, the dns server is at IP address 192.168.0.29.
There is only one NIC. All those addresses are "aliased" on that NIC.
One cannot get a web connection on 28 or a ssh connection on 26 or 27.
 
Old 06-18-2019, 09:19 AM   #6
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
My problem is not related to IP address : my host has one IP address and it's fine, so aliases don't helps me.

I want to use a unique interface name (let's say "specific-network") to access my ethernet equipment, whether this equipment is connected to the network or directly to my host.
 
Old 06-19-2019, 02:25 PM   #7
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,702

Rep: Reputation: 143Reputation: 143
You can try netns tool to build your private network over physical network.
 
Old 06-21-2019, 10:37 AM   #8
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
Interesting concept I didn't know !
I found this article to know what it is. I have to dig into it to see what I could use (it mentions virtual ethernet device, that could feeds my need).
Thanks !
 
Old 06-25-2019, 03:47 AM   #9
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
After reading the previous article, I searched for documentation on interface types and I found this page that gives an overview of the different interface types. Very instructive !!!
I made tests with a MACVLAN link in passthru mode, that I can build over eth2 or bond0, and it works fine :-).
I also found this code that allow me to use ifcfg-xxx files to create my MACVLAN link at boot.

I only get a side effect : the IP address initially affected to bond0 is no more usable when I create the MACVLAN link over bond0 (I suppose it's due to the passthru mode). So in this case I have to set the IP address on my MACVLAN link, and that's OK.

I did a test with the bridge mode of MACVLAN link, and my application that uses ethernet protocol didn't work, so I suppose my application needs to use the promiscuous mode on my new device (and I guess that the passthru mode permits promiscuous mode, opposed to the bridge mode which doesn't).

I also tried to create a new bond over eth2 and bond0, but I found that bond over bond is not supported by Linux. What a pity ! A bond with primary device eth2 would have been perfect : it would have used eth2 if the NIC is plugged, or bond0 in the other case.

So I've got a solution, but if I could let my IP address affected to bond0 it would be almost perfect. Do you have idea about it ?
Otherwise I will mark the post as resolved in few days.
 
Old 06-25-2019, 02:35 PM   #10
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,702

Rep: Reputation: 143Reputation: 143
Is the bond0 in bridge or router mode?
 
Old 06-27-2019, 07:27 AM   #11
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
I don't understand your question. My bond0 is in active-backup mode, I don't see how it can be in bridge or router mode.
 
Old 06-27-2019, 02:14 PM   #12
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,702

Rep: Reputation: 143Reputation: 143
For example, if there are two interfaces, eth0 and eth1, in your system, bond0 include eth0 and eth1.
Are eth0 and eth1 in bridge or router mode?
 
Old 07-02-2019, 04:50 AM   #13
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
Right, my bonding is over eth0 and eth1.
My config of eth0 and eth1 don't mention bridge or router mode. Here is the content of ifcfg-eth0 (my real bonding name is netdev-bond0, even if I called it bond0 in this thread) :
Code:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
BOOTPROTO=none
MASTER=netdev-bond0
SLAVE=yes
ONBOOT=yes
 
Old 07-09-2019, 02:44 PM   #14
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,702

Rep: Reputation: 143Reputation: 143
If no mention, it is in router mode. So now, we can go back your question. You can't set IP address on netdev-bond0, can you?
 
Old Yesterday, 11:05 AM   #15
Mac83
LQ Newbie
 
Registered: Jun 2019
Posts: 11

Original Poster
Rep: Reputation: Disabled
I can set IP address on netdev-bond0 and it works until I add my MACVLAN link over netdev-bond0 (I tested with a ping to the gateway).
My IP address is visible with ifconfig, but not working.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[CLOSE, DUPLICATE] Is it possible to create a virtual/clone interface to map to another existing interface ? Mac83 Linux - Networking 3 06-19-2019 12:26 AM
LXer: Open-spec SBC is a clone of a clone of a clone of a Raspberry Pi 3 LXer Syndicated Linux News 0 04-25-2018 04:56 PM
Unable to create Map in MOVE. Is it necessary to install SUMO to create Map in MOVE?? dalalami21 Linux - Software 3 02-01-2013 11:04 AM
Kernel virtual memory map TO Board memory map -----> Mapping !rajkums! Linux - Embedded & Single-board computer 0 10-18-2008 09:21 AM

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

All times are GMT -5. The time now is 04:33 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration