Same IP for WLAN and ethernet on Linux

4

I have a laptop running Lubuntu 13.04. I use ssh -X to log into my server and start programs there that I view on my laptop. When I pull the ethernet cable, the laptop switches to WLAN but my ssh -X windows turn black. My IP changes due to the switch, and this disrupts the ssh connection.

My router is unable to give two different MACs the same IP.

So, is it possible to set a fix IP for both wlan0 and eth0?

Torsten Bronger

Posted 2013-08-31T08:13:29.980

Reputation: 358

Answers

4

It's impossible to have same IP address on two different interfaces on any network device (computer,router,...) in L3 operation mode (default operation mode of interfaces on computer is L3 mode, as router interfaces).

To have same IP, you must bridge your interfaces.

SuB

Posted 2013-08-31T08:13:29.980

Reputation: 706

DHCP server could give same IP to both interfaces if it received Client ID, and client could then choose the better interface on which to present the IP. If interface changes, it can send Unsolicited ARP (a.k.a Gratuitous ARP) to inform ARP caches of the new MAC and switches would know the port where the new MAC is to be reached. Support and configuration required in different servers and clients is then something I'm not familiar with, yet.

– Marko Kohtala – 2016-10-25T11:52:07.697

@kohtala : I think that simple DHCP Servers like those are implemented in Modem Routers does not support Client ID but some devices like Mikrotik routers support that. – SuB – 2016-12-02T18:12:55.820

4

I'm not sure keeping the same IP will help but this might just work:

  1. Connect with cable and set your IP address manually.
  2. Pull the cable and set the the same IP address manually and also change the MAC address to your Ethernet MAC.
  3. Disable DHCP on the WiFi router (I assume that you connect to the same router via cable and wireless).

Setting the IP address can be done in the network manager if you're using a typical Gnome setup.

You don't necessarily have to disable DHCP, my router has options to give DHCP addresses e.g. only above 192.168.0.10. So I can set manual addresses 192.168.1.[2-9] and DHCP addresses will start from 192.168.1.10. In such a situation you could try setting both your wired and wireless IP to 192.168.1.5.

Emil Vatai

Posted 2013-08-31T08:13:29.980

Reputation: 161