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 04-05-2007, 03:04 PM   #1
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
two NICs on same subnet and ssh independently


I want to set my computer which has two NICs on the same subnet (for some reason).
I want to ssh eth0 and eth1 independently (if eth0 cable is unplugged, ssh to eth0 fail; if eth1 cable is unplugged, ssh to eth1 fail), so I use iproute2 to configure it.

# ip route add default via 172.20.11.10 dev eth0 tab 1
RTNETLINK answers: Network is unreachable
# ip route add default via 172.20.11.10 dev eth1 tab 2
RTNETLINK answers: File exists

Please help to fix this problem.

The setup are:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:50:98:38:AE
inet addr:172.20.11.242 Bcast:172.20.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:171 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:24983 (24.3 Kb) TX bytes:458 (458.0 b)
Interrupt:11 Base address:0x7000

eth1 Link encap:Ethernet HWaddr 00:00:50:98:38:AF
inet addr:172.20.11.199 Bcast:172.20.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:229 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:31971 (31.2 Kb) TX bytes:8351 (8.1 Kb)
Interrupt:9 Base address:0x9000

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)

# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.20.0.0 * 255.255.0.0 U 0 0 0 eth1
172.20.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 172.20.11.10 0.0.0.0 UG 0 0 0 eth0

# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME="rose"
GATEWAY=172.20.11.10

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
GATEWAY=172.20.11.10
IPADDR=172.20.11.242
NETMASK=255.255.255.0

# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
GATEWAY=172.20.11.10
IPADDR=172.20.11.199
NETMASK=255.255.255.0
DEFAULT=no
 
Old 04-05-2007, 04:02 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
You are trying to statically assign the same IP address to multiple active Ethernet interfaces at the same time. This won't work - you will generate an ARP storm (each interface claiming to associate its MAC with the IP).

"(for some reason)" - If you tell us what you are trying to accomplish, we may be able to help you.
 
Old 04-05-2007, 04:23 PM   #3
kcorupe
Member
 
Registered: Nov 2004
Location: Arizona
Distribution: Arch
Posts: 107

Rep: Reputation: 15
I'm assuming your trying to create some kind of fault tolerance. which would not make sense on the same machine, you would want to revert to another machine.

what macemoneta said is correct, you can't have two nics sharing one ip.
 
Old 04-05-2007, 04:32 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 327Reputation: 327Reputation: 327Reputation: 327
If the purpose is for fault tolerance (in this case, just a NIC or cable failure), you can use NIC bonding.
 
Old 04-05-2007, 04:34 PM   #5
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 171Reputation: 171
You can bond the two nics together. I cannot remember which mode. There is a fault mode, round robin (takes turns), aggregate (both act as one but requires special router/switch features) and three other modes I cannot remember.
 
Old 04-09-2007, 12:56 PM   #6
powah
Member
 
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by macemoneta
You are trying to statically assign the same IP address to multiple active Ethernet interfaces at the same time. This won't work - you will generate an ARP storm (each interface claiming to associate its MAC with the IP).

"(for some reason)" - If you tell us what you are trying to accomplish, we may be able to help you.
One reason is to increase the bandwidth of a server equipped with two full duplex interfaces which are on the same subnet.

I plan to do:
ip route del default
route add default gw 172.20.11.10 dev eth1
route add default gw 172.20.11.10 dev eth0

ip route add 172.20.11.0/24 dev eth0 table 2
ip route add 0/0 via 172.20.11.10 dev eth0 table 2
ip rule add from 172.20.11.242 table 2
ip rule add to 172.20.11.242 table 2

ip route add 172.20.11.0/24 dev eth1 table 3
ip route add 0/0 via 172.20.11.10 dev eth1 table 3
ip rule add from 172.20.11.199 table 3
ip rule add to 172.20.11.199 table 3

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_filter
echo 1 > /proc/sys/net/ipv4/conf/eth1/arp_filter

However, "SIOCADDRT: Network is unreachable" error occurred.
Please help.
Thanks.

# ip route
172.20.11.0/24 dev eth1 scope link
127.0.0.0/8 dev lo scope link
default via 172.20.11.10 dev eth1

# route add default gw 172.20.11.10 dev eth0
SIOCADDRT: Network is unreachable
 
  


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
no outgoing ssh connection in subnet with shorewall/squid linux_marine Linux - Networking 2 11-21-2006 02:30 PM
Why Nics Canceling SSH Comm. meping Linux - Networking 1 09-28-2005 12:45 PM
2 nics on the same subnet mask wrexy Linux - Networking 6 10-11-2004 05:33 PM
Using each head of a Matrox G400 independently w/ DirectFB ultrabomberman Linux - Hardware 4 07-06-2004 11:39 PM
Can't access ssh or httpd from outside subnet vortech Linux - Networking 1 10-03-2002 04:39 PM


All times are GMT -5. The time now is 05:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration