LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   spoofed mac address and conflicts (https://www.linuxquestions.org/questions/linux-networking-3/spoofed-mac-address-and-conflicts-508473/)

zzyborg 12-08-2006 03:18 AM

spoofed mac address and conflicts
 
here is my scenario:

MachineA -> eth0 -> MAC1

MachineB -> eth0 -> MAC1 (spoofed to the same MAC as MachineA)
MachineB -> eth1 -> MAC2

MachineB(eth0) connected to a remote network for PPP Over Ethernet (internet Link).

MAchineA(eth0) and MachineB(eth1) connected thru a cross linked cat 5 cable.

That is ,
eth0 in A and eth1 in B are on same network
eth0 in B is on another network.

My intention is to use both Machines A and B for internet link. but when i use MachineB for connecting to internet with eth0 with spoofed MAC address, my local network has problem . i am not able to ping to MachineB(eth1) from MachineA(eth0). Is this because of MAC address conflict ? I believe that same MAC address on two different network doesn't cause any conflicts . Please help me.

iamwilliam 12-08-2006 03:58 AM

Hi
I think you mean IP address (eg. 192.168.100.1)not MAC address.
Now to your problem, if MachineA IP(eth0) is the same as the MachineB IP (eth0). This means that MachineB (eth1) and MachineA(eth0)are on different networks. Therefore they cannot communicate.
To share the internet connection on MachineB(eth0),change MachineA(eth0)to be in the same network as MachineB (eth1). Then enable ip-forwarding and Masquerading on MachineB

zzyborg 12-08-2006 04:01 AM

Quote:

Originally Posted by iamwilliam
Hi
I think you mean IP address (eg. 192.168.100.1)not MAC address.

i meant MAC address *not* IP .

chort 12-08-2006 04:15 AM

Why on earth would you even want to configure two machines with the same MAC address? That doesn't seem to be any good reason to do that.

BTW machine B is going to have MAC1 in it's ARP cache when there's traffic on eth0, so of course that will cause problems.

In order to not cause problems the MACs would need to be on physically separate devices that are also in separate collision domains (i.e. differnet switches). That's not the cause since you're connecting two machines together that have the same MACs, regardless of which interface it's on.

zzyborg 12-08-2006 04:57 AM

Quote:

Originally Posted by chort
In order to not cause problems the MACs would need to be on physically separate devices that are also in separate collision domains (i.e. differnet switches).

i will make it clear once more .

i wanted to use MachineA to connect to internet in case of non availability of MachineB. i spoofed MAC on MachineB coz , the MAC is mapped on the ISPs server.

i spoofed MAC on one of the two NICs in Machine2 to same MAC as of MachineA. One card (eth0 with spoofed MAC) is connected to seperate physical network and other one (eth1) is in my local network . Both are having different network address too . Also its on entirely different switches.

i think the depiction below will help to understand it.

PHP Code:

Current configuration

  Machine A                 
 ___________              Machine B   
 
|         |              ____________  
 
|         |              |          |
 |  
eth0---|---|switch|---|-->eth1   |
 | (
MAC1)  |              |  (MAC2)  | 
 |         |              |          | 
 -----------              |   
eth0---|-------------> ISPPPP Over Ethernet)
                          |  (
MAC1)  |
                          ------------    

Some times i may go for :

 
Machine A
 ___________   
 
|         |   
 |         |   
 |  
eth0---|---> ISPPPP Over Ethernet)
 | (
MAC1)  |   
 |         |   
 -----------   

which resulted in same MAC address

if this still has got any problems , please suggest a work around :)

chort 12-08-2006 09:54 AM

Quote:

Originally Posted by zzyborg
i think the depiction below will help to understand it.

if this still has got any problems , please suggest a work around :)

I understand exactly what you're doing and I already told you it won't work. It doesn't matter that the interfaces with the same MAC are plugged into different switches. One of the machines has a MAC of another machine that it's directly connected to! If machine B has network traffic on eth0, it's going to have MAC1 cached as associated with the IP of mB/eth0. If it gets traffic from machine A it's going to send replies to machine B/eth0, not machine A/eth0 (because it has the MAC in it's cache already). Machine B is physically connected to itself, how could it not know about the MAC address that it has?

You cannot do this the way you have it architected.

It sounds like it doesn't fail-over without you making changes by hand any way, so don't spoof the MAC of the other machine unless that machine is down. You can write a script to ifconfig it with a different hw addr when you need to switch the connection (and switch it back when the first machine comes up!).

zzyborg 12-09-2006 04:21 AM

Quote:

Originally Posted by chort
You cannot do this the way you have it architected.

you are correct chort. i was able to do it on a windows box. but with a minor problem . when i connect to internet using machineA, the page is loaded after some refresh only . may be its because of the ARP caching you mentioned .

i wanted to use internet from machineA thru B :( ie, both the machines should be up. This may sound stupid but i have no other options.

so can you suggest me a better architecture for doing this .

osvaldomarques 12-09-2006 04:48 AM

Hi zzyborg,

I guess you could spoof another MAC address on machine A to use the configuration as you posted.

The kernel maintains an ARP table do decide where to send the message on an ethernet network. The machine B table must be confused as it thinks machine A has the same MAC address as its eth1.

By the way, what command did you use to spoof it?

Cheers,

Osvaldo.

MaizeNBlue2 12-09-2006 09:44 AM

Call me crazy, but isn't what they make routers for? It allows you to connect your internet into it and use that mac address for the ISP, then distributes the connection to multiple computers.

They aren't very expensive. I've had very little trouble with the Linksys BEFSR41 I maintain at work. You should really look into one.

-Josh-


All times are GMT -5. The time now is 09:31 PM.