Click to See Complete Forum and Search --> : two nics, same ip subnet, different networks?
rocketpcguy
12-24-2005, 09:05 AM
i was thinking... if i have two separate nearby LANs, with each having the same ip subnet (192.168.114.x), and if i wanted them to connect to a single linux file server (no need for each networks to talk to each other), would it be possible?
as in, if a computer has two NICs, can both have the same IP subnet (192.168.114.x), but connected to different networks? or will ifconfig give me an error?
(the obvious way is to buy another computer with two NICs, put one NIC with the first network, and the second NIC crossovered with the file-server (private two-computer network+NFS), and the file server having its first NIC with that new computer, and second NIC with the second network, with both computers running the SAMBA server. but i want to know if this can be done without buying new hardware)
jumpedintothefire
12-24-2005, 10:00 AM
You would need to do policy source routing with iproute2. For less problems and a simpler setup, have the 2 lans ip addresses not overlap and split at an subnet boundry point. ie try and hand out dhcp addresses out in a specific subnet range, 128-159 for one, 160-191 for the other. Read up on iproute, setup the routing tables and use the to/from rules that are available to direct traffic to each group. Post the script that you come up with if you run into problems.
rocketpcguy
12-24-2005, 12:33 PM
the thing is, i cannot change the network setup/gateways at all (unless those guys come back).
having two ip addresses for each network would mean that nothing would have to change, and each network will see the same PC, without playing around with the DHCP or routing tables of the gateway.
jumpedintothefire
12-24-2005, 12:52 PM
With 2 ip addresses you would still need to do something like this: http://justlinux.com/forum/showthread.php?t=84253
Maybe that is all you need, but I don't think so.
rocketpcguy
12-24-2005, 01:20 PM
well, that post was for 2 ip addresses on the same subnet and same network. my problem, i think, is a bit different. here, its two completely different networks which happens to have the same number for the ip/subnet. its very easy if the numbers were different (eg. 192.168.114.x and 192.168.115.x), but i cant change the numbers (for about three-four months).
the samba/ftp file server needs to serve these two networks. so would iproute2 still be needed in my case?
jumpedintothefire
12-24-2005, 01:34 PM
The first part of the thread deals with what happens when you have 2 ip addresses on the same subnet, that still applies. Go ahead and try the 2 ip addresses, I'll bet out of the box only one will work, because of the arp handling, and network route in the main routing table. Yes, you need setup the alternate routing tables.
gtmtnbiker98
12-24-2005, 11:03 PM
If you have duplicate host IP addresses on different networks, it won't work, the packets will be dropped.
rocketpcguy
12-25-2005, 03:34 AM
sounds impossible to do with one pc. suppose if i set up advanced routing tables, and ping 192.168.114.210, which of the two networks would it go to? and would it setup an alternative arp cache for each network?
maybe i should just buy another pc?
gtmtnbiker98
12-25-2005, 12:07 PM
I wouldn't buy a new PC, I would just change the IP subnet of one of the networks. Assuming that the size isn't too large, you can do an IP subnet change utilizing DHCP in no time, but on the other hand, if this is a statically assigned network, then perhaps another box isn't out of the question. Let the situation dictate.
rocketpcguy
12-25-2005, 12:49 PM
like i mentioned, i do not have access to the dhcp servers, which means i cannot change anything.
i'll have to buy a new pc. i guess this new pc will run the same set of servers (samba,squid,ftp,etc) as the first, but the share will be a NFS mount point of the first server?
neuro4848
12-25-2005, 01:12 PM
How about asking the MOST obvious?
Are there 2 DHCP servers in each of these DIFFERENT networks?
I understand that they are 2 logical networks that happen to share the same subnet. I'm just trying to figure out what GW/DNS the DHCP server pushes, that is, if there IS one.
IF it happens to push the SAME information across both networks, why the need for 2 NiCs?
Follow me?
Alex Cavnar, aka alc6379
12-25-2005, 02:37 PM
You could run a bridge on the fileserver, and assign that bridge one IP Address.
From there, you could set up a firewall rule or something that blocks DHCP traffic from traversing the router. That'd be my thought, at least. I know FreeBSD and NetBSD can do this.
rocketpcguy
12-25-2005, 03:30 PM
Are there 2 DHCP servers in each of these DIFFERENT networks?
I understand that they are 2 logical networks that happen to share the same subnet. I'm just trying to figure out what GW/DNS the DHCP server pushes, that is, if there IS one.
yes, two dhcp servers (actually, two modem-routers) in each different network. there is no physical or any connection between these two networks. the GW is the router themselves (both 254).
IF it happens to push the SAME information across both networks, why the need for 2 NiCs?
huh?
You could run a bridge on the fileserver, and assign that bridge one IP Address.
good idea. thats what jumpedintothefire suggested, and i was about to do it, until i found out that i wont have access to the configuration for a long time. you see, the dhcp ip address overlap, so a bridge wont work.
neuro4848
12-26-2005, 12:29 PM
OK, you know what, for sh*ts and giggles...
Can you post the DHCP information each of those modem-routers push?
This is as simple as going to a workstation, executing an "ipconfig /all" command (if it is windows) or an "ifconfig -a" and a "route" command on an linux workstation.
I bet the only thing different would be the DNS server.
neuro4848
12-26-2005, 12:31 PM
You know what, come to think of it...
Why don't you just put 2 NiCs in the machine, disable IP relaying.
Set IPTables to stop DHCP requests / broadcast requests / blah, blah blah from getting across that box and be done with it?