Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.