LinuxQuestions.org
Visit Jeremy's Blog.
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 02-17-2014, 10:44 AM   #1
Flowsen
LQ Newbie
 
Registered: Sep 2011
Posts: 29

Rep: Reputation: Disabled
Question Having multiple NICs with same IP/subnet


Dear Community
Does anyone has an idea how this issue could be solved:

wlan0: IP 10.0.0.2, Server IP 10.0.0.1
wlan1: IP 10.0.0.3, Server IP 10.0.0.1
wlan2: IP 10.0.0.4, Server IP 10.0.0.1

Is there any way I can connect to all three servers (10.0.0.1) simultaneously over TCPIP without changing the subnet or ip?

My thought was to create some kind of virtual IPs and specify routing options based on specific interface.
For example

virtual IP 11.0.0.1 -> wlan0:10.0.0.1
virtual IP 12.0.0.1 -> wlan1:10.0.0.1
virtual IP 13.0.0.1 -> wlan2:10.0.0.1

Is this possible or is there any other soloutions that lets me connect to the server 10.0.0.1 in each network (wlan0/wlan1/wlan2). Connection needs to be established only in one direction towards the server and the networks do not need to be routed among themselves.

any help would be appreciated

Kind Regards
Flowsen

Linux version 2.6.32-5-amd64 (Debian 2.6.32-48squeeze1) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Feb 25 00:26:11 UTC 2013
 
Old 02-17-2014, 10:56 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,559

Rep: Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600
Do you have a server with three NICS that you want to access as 10.0.0.1 or do you have a workstation with three NICS that you want to use to access Server 10.0.0.1, or do you have three NICS in a server and want to have three separate networks each with the same subnet?

You could look at NIC Bonding, however if you're looking to combine three NICS on the same IP to get 3XSpeed then your network switch has to also be capable or doing this.
 
Old 02-17-2014, 11:00 AM   #3
Flowsen
LQ Newbie
 
Registered: Sep 2011
Posts: 29

Original Poster
Rep: Reputation: Disabled
I have a client that has three NICs.
The three servers on each NIC all have the IP 10.0.0.1. These are completely isolated networks and even three different servers.

The only thing I need to achive is to connect to all these server from my client at the same time.
 
Old 02-17-2014, 11:18 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,559

Rep: Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600
Ok, so your network topology is like this:
Code:
+-----------------------------+
|           Client            |
| NICA       NICB       NICC  |
+----+----------+----------+--+         
     |          |          |
     |          |          |
+----+---+ +----+---+ +----+---+
|SVR A   | |SVR B   | |SVR C   |
|10.0.0.1| |10.0.0.1| |10.0.0.1|
+----+---+ +----+---+ +----+---+
That's a good one.

Yes, looks like you'll have to set up three hosts definitions and route the packets accordingly, are you also cursed with the same IP address on each interface on the client side?
 
Old 02-17-2014, 11:22 AM   #5
Flowsen
LQ Newbie
 
Registered: Sep 2011
Posts: 29

Original Poster
Rep: Reputation: Disabled
yes, thats exactly the network topology.
Luckily I can have DHCP turned off and NICA, NICB, NICC can have different IPs.
So there should be no IP conflict.

What do you propose for routing? iptables with ipv4 forwarding?


PS:

Using curl and specifing the interface works well. I am able to connect each server. Anyone has an idea how to specify virtual IPs and route them to the specific interfaces?

Last edited by Flowsen; 02-17-2014 at 12:02 PM.
 
Old 02-17-2014, 02:53 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,358

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
You could create a virtual ip on each computer outside of the original subnet.

192.168.x.x x+1 x+2 for example and then use the 10.0.0.1 server to bridge those. Seems rather odd.
 
Old 02-17-2014, 03:13 PM   #7
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348

Rep: Reputation: Disabled
Quote:
Originally Posted by Flowsen View Post
Using curl and specifing the interface works well.
It works because the application (curl) allows you to specify which interface to use. Most applications have no such setting/parameter.

By assigning different addresses in the 10.0.0.0/24 IP network to three different interfaces connected to different, physical networks, you're telling the PC:
  • "The same network, 10.0.0.0/24, exists in three different places" (which is an invalid configuration), and
  • "The IP address 10.0.0.1 may refer to any of three different hosts, depending on which interface you use" (which is also not a valid configuration)
The only network which may appear in multiple places simultaneously, is the link-local network (169.254.0.0/16). You should not try to do something similar with a different IP network.

Quote:
Originally Posted by Flowsen View Post
Anyone has an idea how to specify virtual IPs and route them to the specific interfaces?
I'd recommend assigning secondary addresses in different networks to each of these servers. You can then configure each wlan interface with another address in that same network.

Last edited by Ser Olmy; 02-17-2014 at 03:14 PM.
 
Old 02-18-2014, 12:53 AM   #8
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
To make your netowrk configuration simplier i'd suggest following:

1. Create 3 virtual machines with two network interfaces each

2. Each first virtual interface bridge to corresponding NIC at the side of host and assign some address inside the VM (each can have 10.0.0.2 - now it`s three different machines)

3. Assign each second virtual interface a pair of addresses
- 192.168.0.1/30 at the host side and 192.168.0.2/30 at VM side in VM_A
- 192.168.0.5/30 at the host side and 192.168.0.6/30 at VM side in VM_B
- 192.168.0.9/30 at the host side and 192.168.0.10/30 at VM side in VM_C

4. Inside each VM create iptables rule to DNAT incoming connections to 192.168.0.2 (or 6 or 10) to 10.0.0.1

For each server you'll get something like this
Code:
+------------------------------
|
|         VNICA2
|            |
|       +----+----+
|       |  VM_A   |
|       +----+----+
|            |
|  bridge VNICA1 and NICA
|            |
|          NICA
+------------+-----------------
             |
        +----+----+
        |  SRV_A  |
        +---------+
Now server SRV_A will be accessible as 192.168.0.2, SRV_B - as 192.168.0.6 and SRV_C - as 192.168.0.10 - no misunderstandings, no collisions

Virtual machines can be created using UML (UserMode Linux) with minimalistic kernel and minimalistic busybox (all you need is shell, iproute2, iptables). It will use only few megabytes on your drive.
 
Old 02-19-2014, 08:15 AM   #9
rrdonovan
LQ Newbie
 
Registered: Nov 2011
Location: Ingleside, Texas
Distribution: openSUSE 12.1
Posts: 14

Rep: Reputation: Disabled
Say What?!

What you do is against the laws of our Computer God. First off, The same subnet is OK. but, the ip addressing is wacked.The last 3 numbers in an ip address xxx.xxx.xxx.(xxx), are reserved for the actual computer going online in the network. NO TWO computers can have the same ip address. How would the server know to only send data to one of the computers. You will get an onscreen error with two computers using the same ip address on the same net. What you can do is change the third set of numbers xxx.xxx.(xxx).xxx for each server. Example 192.168.0.1, 192.168.1.1, and 192.168.2.1. This would keep them in the same subnet with different ip addressing. This should give you about 252-3 computer connections per local net.

Master Rod
 
Old 02-19-2014, 08:38 AM   #10
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,559

Rep: Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600Reputation: 1600
Quote:
Originally Posted by rrdonovan View Post
The last 3 numbers in an ip address xxx.xxx.xxx.(xxx), are reserved for the actual computer going online in the network.
Only assuming a 255.255.255.0 hostmask. The rest of your post also contains misunderstandings about how Ethernet works.


At no point does the OP state that he wants to bridge the three separate networks, so what the OP is attempting to do (while I agree is "odd") should be achievable by assigning each of the remote servers an internal IP on his client machine and using NAT and routing to correctly route packets over the outgoing interfaces.
 
Old 02-19-2014, 09:10 AM   #11
Flowsen
LQ Newbie
 
Registered: Sep 2011
Posts: 29

Original Poster
Rep: Reputation: Disabled
Quote:
Now server SRV_A will be accessible as 192.168.0.2, SRV_B - as 192.168.0.6 and SRV_C - as 192.168.0.10 - no misunderstandings, no collisions

Virtual machines can be created using UML (UserMode Linux) with minimalistic kernel and minimalistic busybox (all you need is shell, iproute2, iptables). It will use only few megabytes on your drive.
That's exactly what I intended to do. But I thought it would be possible to just create virtual IPs instead of creating whole virtual machines. This is unfortunately not possible because its an embedded device with strictly bordered resources.

Quote:
What you do is against the laws of our Computer God. First off, The same subnet is OK. but, the ip addressing is wacked.The last 3 numbers in an ip address xxx.xxx.xxx.(xxx), are reserved for the actual computer going online in the network. NO TWO computers can have the same ip address.
Well as already mentioned the computers with the same IPs are on isolated non bridged networks. They wont conflict as little as average 192.168.0.1 homeserver running in your neighborhood. The inital question was how to tell the client with three NICs to talk to the servers with the same IP but in different networks.
As already mentioned PING, CURL etc. allow to bind to an interface, but not all application are able to do so.
 
Old 02-19-2014, 09:19 AM   #12
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
Quote:
Originally Posted by Flowsen View Post
That's exactly what I intended to do. But I thought it would be possible to just create virtual IPs instead of creating whole virtual machines. This is unfortunately not possible because its an embedded device with strictly bordered resources.
Probably it can be done by adding 3 different ip addresses to some other interface, marking connections accordingly to these addresses and using connmark-based routing rules, combined with DNAT, but it`ll be VERY unpredictable configuration.
 
  


Reply

Tags
ip, routing, subnet


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
Routing between two NICS on the same subnet. pwatk Linux - Networking 10 08-06-2010 05:39 AM
Shorewall, 2 NICs, Same Subnet mxracer95 Linux - Security 1 07-13-2009 01:40 PM
DHCP problems using multiple external NICs on same subnet Leffster Linux - Networking 2 11-18-2008 11:46 AM
two nics on one subnet on one machine mauricem Linux - Networking 2 04-27-2007 06:28 AM
2 nics on the same subnet mask wrexy Linux - Networking 6 10-11-2004 05:33 PM

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

All times are GMT -5. The time now is 07:04 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