LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-02-2012, 06:42 PM   #1
vin_
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Rep: Reputation: Disabled
How to specify a gateway via mac address


Hello everyone, I'm in a network with two routers (let's say DEFAULT and NONDEFAULT) and both have the same IP address. What happens is that sometimes I'm connected DEFAULT and sometimes I'm connected to NONDEFAULT. This happens automatically, I'd like to specify my computer to connect only to the DEFAULT router by using the MAC address, but I wasn't successful on it. I also tried to block connections to NONDEFAULT by using iptables, but I had no success. The rules I used were:
-A INPUT -m mac --mac-source $MAC -j REJECT -p all
-A FORWARD -m mac --mac-source $MAC -j REJECT -p all

By the time:
I don't have physical access to any of the routers and I don't know their passwords to access the admin page and when I'm connected to the NONDEFAULT router, I simply can't access internet.
 
Old 08-02-2012, 08:14 PM   #2
vin_
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok I found a solution, I'm using arp -s $DEFAULT_IP $DEFAULT_MAC by typing that I put an entry manually in the OS. Now I want to optimize this solution, because if I disconnect my computer or if I shut it down, this entry will be made dynamically. Is there any way to hard code it ? I know I could put this command during boot time, but this won't solve the problem of disconnecting my computer from the network. I know this entry is stored in /proc/net/arp but I believe the entries in there are made by the own OS, so even if I create a file manually, those entries would be setup dynamically.
 
Old 08-03-2012, 04:40 PM   #3
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
You need to contact your network administrators as no two devices should actively be handling the same IP address. There are numerous systems for two routers to "pretend" to be the same IP but these rely on virtual MAC addresses as well as shared IPs. You are trying to work around a fault condition, better to fix the fault surely?
 
Old 08-03-2012, 04:46 PM   #4
vin_
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
I completely agree with you, but the problem is far more complicated than it seems, and there is no use of talking about it to the network administrators, I've been trying that for three weeks and nobody did anything, so I just made what I could to have access to internet. So if there is any way to set my entry in /proc/net/arp "forever" (without need to set it again if I disconnect) I'd appreciate that.

Thank you
 
Old 08-06-2012, 06:56 AM   #5
Gleylancer
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware+RHEL
Posts: 24

Rep: Reputation: Disabled
Two devices on a network with the same IP? On purpose? I want some of that stuff they're smoking. Someone should tell them that there are things in the world like VRRP/HSRP...

Back to your "problem". I don't see why you can't do a static arp entry at bootup. If your IP is dynamic, you can get it from ifconfig or the dhcpd and do a little bash script. The mac address shouldn't change at all.
 
Old 08-06-2012, 06:38 PM   #6
vin_
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
There is no problem to set it during boot time, the problem is when I disconnect my computer from the network, the entry is lost and then if I connect again it will search dynamically for the gateway and it could be any of the two routers, for this don't occur I must type the command once again.

Thank you
 
Old 08-07-2012, 05:43 PM   #7
ne pas
Member
 
Registered: Jul 2008
Posts: 55

Rep: Reputation: 23
You could place an executable script-file in /etc/network/if-up.d/ that will set your ARP table entry. Scripts in /etc/network/if-up.d/ and /etc/network/if-down.d/ are called in lexical order when ever an interface comes up or goes down respectively.

Last edited by ne pas; 08-07-2012 at 05:46 PM. Reason: grammar
 
  


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
Mac address problem at gateway side when it is connected to switch...... itrilok Linux - Networking 2 10-23-2011 12:34 AM
how do I find what MAC address web pages see as my MAC address rob.rice General 20 05-29-2010 02:08 AM
Router gateway address being picked up as primary DNS address under SuSe Hubmasterflex Linux - Networking 13 10-18-2008 01:40 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM

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

All times are GMT -5. The time now is 10:26 AM.

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