LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 02-27-2006, 02:38 AM   #1
t3kn0lu5t
LQ Newbie
 
Registered: Aug 2003
Location: Indiana
Distribution: Debian recently from FreeBSD
Posts: 28

Rep: Reputation: 15
Question 2 interfaces, same subnet, conflict.


I've discovered a problem with my Debian setup. I have a server with two interfaces connected to my router, both interfaces have ips on the same subnet, and when they are both up I can't get pings or ssh back from either IP.. to illustrate.

y.z.149.121 - Router, routing y.z.149.120/nm255.255.255.248
|
|--y.z.149.123 sparkplug - eth0
|
|--y.z.149.122 ts1 - eth1
|--y.z.149.124 ts1 - eth0


After setting all this up and getting back home from the datacenter I noticed I couldn't ssh into either IP. I couldn't get a ping back either.. I was able to ssh into sparkplug, and from there I could ssh into either ts1 IP, and could ping as well. I also noticed if I shut down a single interface on ts1, then everything started working normally for the other interface.

So since I don't know a whole lot about routing I figured that's where the problem probably is. Here is some background info.

/etc/network/interfaces:
Code:
auto lo
iface lo inet loopback

# The primary network interface
auto eth1
iface eth1 inet static
        address         y.z.149.122
        netmask         255.255.255.248
        gateway         y.z.149.121
        network         y.z.149.120
        broadcast       y.z.149.127

auto eth0
iface eth0 inet static
        address         y.z.149.124
        netmask         255.255.255.248
        gateway         y.z.149.121
        network         y.z.149.120
        broadcast       y.z.149.127
and ifconfig:
Code:
eth0      Link encap:Ethernet  HWaddr 00:D0:B7:48:D9:20
          inet addr:y.z.149.124  Bcast:y.z.149.127  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1080 (1.0 KiB)  TX bytes:0 (0.0 b)
          Interrupt:9 Base address:0xecc0 Memory:fdfff000-fdfff038

eth1      Link encap:Ethernet  HWaddr 00:B0:D0:46:40:30
          inet addr:y.z.149.122  Bcast:y.z.149.127  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3493 errors:0 dropped:0 overruns:1 frame:0
          TX packets:689 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:238519 (232.9 KiB)  TX bytes:93726 (91.5 KiB)
          Interrupt:5 Base address:0xec00

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:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)
and the output of route:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
y.z.149.120 *               255.255.255.248 U     0      0        0 eth1
y.z.149.120 *               255.255.255.248 U     0      0        0 eth0
default         y.z.149.121 0.0.0.0         UG    0      0        0 eth0
default         y.z.149.121 0.0.0.0         UG    0      0        0 eth1
I don't understand, I'm sure there's just something I'm missing. Any help is very appreciated.

Thanks.
 
Old 02-27-2006, 04:09 PM   #2
t3kn0lu5t
LQ Newbie
 
Registered: Aug 2003
Location: Indiana
Distribution: Debian recently from FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Still no takers? Bump
 
Old 02-27-2006, 04:54 PM   #3
drakebasher
Member
 
Registered: Aug 2004
Location: Proprio Qui
Distribution: Debian
Posts: 85

Rep: Reputation: 16
I don't hink you can have 2 NICs in one box with both on the same sub-net. I haven't seen anything definite to say that it is impossible, but whenever I have seen someone ask about that problem (as I did once), the solution is always the same: put them on different subnets. Or maybe this page has the answer.
 
Old 02-28-2006, 04:09 AM   #4
t3kn0lu5t
LQ Newbie
 
Registered: Aug 2003
Location: Indiana
Distribution: Debian recently from FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Well, I ended up solving the problem by aliasing, eth0 for one IP and eth0:0 for the other.

A coworker thought that maybe since I had two default routes that the system wouldn't know how to route outgoing traffic.

I would still like to know why this doesn't work.. just for future reference.
 
Old 02-28-2006, 09:01 AM   #5
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Your server is by default operating as a router. A router is an IP network boundary, therefore by definition putting two interfaces into the same subnet is a no-no.

And your co-worker is right. You have two routes for the connected network x.y.149.120 and two default routes. The server will simply use the first route-table match it finds in each case which will lead to unpredictable behaviour as you have found.

If you did this on a Cisco you would get Load Balancing, but on a linux box I'm not sure what happens but I'm not surprised by the behaviour your getting.

The only ways to use two nics to the same network is either bond both nics into a trunk or use one active and one standby to provide redundancy.
 
Old 02-28-2006, 09:39 AM   #6
t3kn0lu5t
LQ Newbie
 
Registered: Aug 2003
Location: Indiana
Distribution: Debian recently from FreeBSD
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks, that's what I wanted to know!
 
  


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
subnet jpostma Linux - Hardware 1 10-16-2005 02:11 PM
another subnet. bruse Linux - Networking 1 07-19-2005 12:35 PM
subnet scan spank Linux - Newbie 2 12-09-2003 03:58 PM
a /27 within a /24 subnet arnix Linux - Networking 1 07-16-2003 09:16 PM
Can IP from different subnet be configured on another subnet russell Linux - Networking 1 08-23-2002 01:47 AM

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

All times are GMT -5. The time now is 05:49 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
Open Source Consulting | Domain Registration