LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-09-2008, 07:12 AM   #1
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Rep: Reputation: 0
Binding 2 NICs (MAC addresses) to 2 IP Addresses in same Subnet RedHat EL4.0


Hi,

I want to use simple configuration.

I want to bind IP1 with eth0 (MAC1) and IP2 with eth1 (MAC2),

I am RH Linux 4.0, with kernal 2.6

The issue in such a configuration is that, only one interface remains active at a time. AS Linux is assigning same MAC address to both IP addresses, i have verified it using arping.

Here eth0 and eth1 are connecting to different switches, IP1 and IP2 are in the same subnet.

I want ping results in such a way

using eth0 interface

ping IP1 should work
ping IP2 should not work

using eth1 interface
ping IP1 should not work
ping IP2 should work

and I should get correct MAC address for arping.

I have tried many things, but nothing works.

Please help me in this, if it is a known issue.

Thanks in advance,
Sandeep
 
Old 02-09-2008, 07:27 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
Quote:
I am RH Linux 4.0, with kernal 2.6
Just a note: you musta specify "RHEL" as "RH Linux" is different and you don't want to have loads of people telling you to upgrade.

Quote:
The issue in such a configuration is that, only one interface remains active at a time.
I'm sorry, you want only one interface active at a time, OR you don't want this, but that's what you get? Which is it?

How are you configuring the interfaces?
What does ifconfig say?

Technically, if you have two nics on one machine, and one is set to static IP1 and the other to static IP2, then you can ping them both. If you want one to be unpingable, either take the interface down, or block ping requests.
 
Old 02-09-2008, 07:44 AM   #3
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for your reply and suggestions.

> I'm sorry, you want only one interface active at a time, OR you don't want this, but that's what you get? Which is it?
This is what I get, I want both interfaces to be ACTIVE

I am configuring static entries in /etc/sysconfig/network-scripts/ifcfg files

> Technically, if you have two nics on one machine, and one is set to static IP1 and the other to static IP2, then you can ping them both. If you want one to be unpingable, either take the interface down, or block ping requests.

I agree both should be pingable, but through their own interface, and same MAC address should not be assigned to both IPs, as both have different NIC

I want ping results in such a way, when both interfaces are active

using eth0 interface

ping IP1 should work
ping IP2 should not work

using eth1 interface
ping IP1 should not work
ping IP2 should work
 
Old 02-09-2008, 11:04 AM   #4
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Original Poster
Rep: Reputation: 0
I have already tried setting for arp (setting arp_filter and accept_source_route), but that did not help
 
Old 02-11-2008, 05:46 AM   #5
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Original Poster
Rep: Reputation: 0
someone can help ??

or it is unresovable ??
 
Old 02-11-2008, 12:21 PM   #6
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Is it similar to arp flux ?
 
Old 02-11-2008, 03:45 PM   #7
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
they NICs should already have different MAC addresses..
you can verify with the command ifconfig -a the hardware mac address for each interface will be listed.
 
Old 02-13-2008, 03:48 AM   #8
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
Why don't you use ifconfig?
 
Old 02-18-2008, 05:11 AM   #9
skhira
LQ Newbie
 
Registered: Feb 2008
Posts: 7

Original Poster
Rep: Reputation: 0
ifconfig shows the correct mapping of the NICs to MAC addresses

It is about the MAC address assignment to IP Address, I have already explained that when I arping from remote side to IP1 and IP2, then I get response for both of IP addresses with same MAC address.
 
Old 02-20-2008, 03:58 PM   #10
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
Why don't we start again, by having you provide some more info...
ifconfig -a

route -n

arp -n

Might help us get a clearer picture of what it is exactly that you are doing.
I'm unclear on whether these two NICs are on the same network, on different networks, etc.. I don't understand why you are using two NICs in the first place.. Are you routing, bridging, binding, other ? A clearer understanding of what you are trying to accomplish, why and how would help us help you..
 
Old 02-20-2008, 05:08 PM   #11
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 16
Sounds like it could be a routing issue.

Providing eth1 and eth0 connect to the same network (which I assume they do) you need to setup a routing table such as -

ip route add default via gateway.com src eth0.eth0.eth0.eth0 dev eth0 # replace with ip in octets
ip route add default via gateway.com src eth1.eth1.eth1.eth1 dev eth1 # replace with ip in octets

Its possible at the moment one of the routes that is selectable is to send the packet out via eth0 even if the device the IP is attached to is eth1 since the route is valid.

I assume at the moment its something like

ip route add default via eth0.eth0.eth0.eth0

You can mimic this behaviour by adding a GATEWAY= assignment to the ifcfgs script dont assign the gateway in /etc/sysconfig/network .

Last edited by Deleriux; 02-20-2008 at 05:09 PM.
 
Old 02-23-2008, 06:22 PM   #12
jetole
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 2
Linux does reply on ARP on all NIC by default, if you have two NIC on separate lan then you never see this and it doesn't change anything. An arp reply on WAN and LAN for a request on LAN doesn't do anything to WAN and there is a credible reason apparently but I forget however it is listed somewhere in the kernel documentation , I think in /usr/src/linux/Documentation/networking/ip-sysctl.txt. Also in that same document it mentions arp_filter which is used when you want to have two NIC on the same subnet, it says so right in the doc, arp_filter should be set to 1 but not for just one device but for all devices which is either /proc/sys/net/ipv4/conf/all/arp_filter or "sysctl -w net.ipv4.conf.all.arp_filter=1" sans the quotes or net.ipv4.conf.all.arp_filter=1" in /etc/sysctl.conf. Also another one too look at is arp_ignore which I would set to 1. 2 sounds good but tends to cause problems in most boxes with 2+ NIC on a subnet.

Also, just so we are all clear, having an arp reply with the wrong mac causes sheer hell because machines only focus on the first MAC they see and if you are sending data to the wrong MAC then you are sending data to the wrong IP address. Additionally, when I started seeing this problem I had groups of "gurus" on #iptables in freenode telling me the kernel does not do arp replies on all interfaces. Well it is documented in the text file I just listed and I think the reason why is also in there too so routing has nothing to do with it.

Now that I have my own arp worked out and hopefully that helps you as well, I need to figure out how to create a situation where a IP only replies off the NIC that is assigned that IP despite having two NIC with route to host.
 
Old 02-23-2008, 06:39 PM   #13
jetole
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 2
I think delerluxs command may have just helped me with my second issue since it seems to specify the device that the IP has to leave from after what I just RTFM'd
 
Old 02-24-2008, 09:16 PM   #14
jetole
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 2
worth looking at: http://lartc.org/howto/lartc.rpdb.multiple-links.html
 
  


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
Mapping IP addresses to MAC addresses basilio Linux - Networking 17 09-12-2007 02:48 AM
Lan subnet and mac addresses firewall Ungluun Linux - Networking 1 12-20-2006 11:18 AM
2 nics getting base addresses confused skbranch3 Slackware 2 05-31-2006 03:42 PM
Binding multiple IP Addresses to same NIC Harlin Linux - Networking 4 10-26-2005 06:10 AM
Binding multiple IP addresses to a nic card Natalie Linux - Networking 9 08-12-2003 09:27 PM


All times are GMT -5. The time now is 12:24 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration