0

I know this is not a new question and it has been asked many times before. But, I could not find any documentation on how to do it on Ubuntu 19.04.

As any ordinary notebook computer I have a notebook with an Ethernet and a Wireless interface. I am using static local IP address on my Ethernet connection (because I am doing port forwarding from my router to my notebook). I want my notebook to have the same IP address whether it is connected to my LAN through Ethernet and/or Wireless. To do this (I think) I need to bond these two interfaces. In other words, regardless of how I connect my notebook computer to my LAN (i.e., using its wireless and/or Ethernet interface), the computer will use the same LAN IP address.

All the references I have found on the Internet are about older versions of Ubuntu. Newer versions of Ubuntu changed the way network configuration is done. So I tried to do this using Advanced Network Configuration tool (nm-connection-editor). However, after creating a new Bond virtual interface, the options to add "Bonded connections" in the Bond tab does not bring any Wi-Fi interface; only Ethernet, InfiniBand and other virtual connections are listed.

What am I doing wrong? Maybe I misunderstood the term. Maybe I am using it in the wrong way.


Note: Any other suggestions on how to use the same IP address on these two interfaces are welcome.

1
+50

What you want is a simple MAC address spoofing, meaning that instead of using the default and unique MAC address assigned to your card at the factory, you will want to broadcast a different number. When you reserve an ip address on your router, it reserves it based on the MAC address, so if they both appear to have the same address, your router will treat them as if they were the same card, and therefore will assign the same reserved ip.

You can do it either by changing the config files, or using the GUI. Since you want the simplest way, I'll cover the GUI.

Let's start by opening the GUI for the network manager. Open the terminal and run nm-connection-editor. An image with all the saved networks you have will open. Similar to the one below. Let's start by seeing the MAC address of both your wired card and your wifi card. You can check by selecting the network and clicking on the gear icon.

Network manager

The MAC address will be displayed on the Device Name box, either standalone or inside parenthesis, next to the device name. The image will be similar to the one below. The wifi one will be slightly different. Take note of the MAC address of both the WIFI card and the Ethernet card. You can also use ip addr command to get the MAC address.

enter image description here

If you noticed on the image above, there is a "Cloned MAC Address" box. This is the box you want to place the address you want your computer to give out every time it connects to this network.

If you want to spoof the WIFI mac to be the same as the ethernet one on this network, you simply copy the ethernet mac address, open the the wifi settings, and copy it on the "Cloned MAC Address" box, following the format XX:XX:XX:XX:XX:XX.

After saving, simply restart the network to make sure the router gets the new MAC. You can do this by using sudo systemctl restart NetworkManager.service. You can ensure that both interfaces are using the same MAC address with the command ip addr.

  • As I specified in my original question, I already use static IP addresses, because I do port forwarding on the router. So, I can easily put the same IP address on both interfaces using GNOME Network Manager. But, this does not seem right to me! Do I really need IP spoofing? What happens when both interfaces are active? – FedonKadifeli May 30 '19 at 8:04
  • 1) The reply was considering that you were assigning the static ip addresses using the dhcp table on your router, in which case the MAC spoofing would be required (my router only allows to reserve one ip per MAC), otherwise you would have different IP on each interface. If you are setting the static IP using the network manager (using the manual option), then you don't need to spoof the MAC. You can simply set both interfaces to the same IP. It is not a problem because they won't really be active at the same time, even though they might both appear on your router as connected. – Podesta May 30 '19 at 9:42
  • 2) If both interfaces are up, your machine will simply pick one (usually the Ethernet) and go with it. It will seamlessly switch between them, You can even check with nload. Ssh into the machine with both ethernet and wifi connected. You'll see the data being transferred using the cabled interface. If you disconnect it, it will automatically swap to the wifi interface. Again, they won't really be active at the same time, so it won't cause any conflicts or problems. Now, if you attempt to force two different machines to share the same IP or the same MAC in the same network, then you will – Podesta May 30 '19 at 9:47
  • 3) start experiencing problems, because your router will surely be very confused and not know how to properly handle it. You don't need to use network bonding for the objectives you expressed on your question. Network bonding can be very useful, but won't really help in your case, unless you want both interfaces active at the same time to increase throughput of data. Assuming you already have both interfaces with the same static IP, are you facing any problems, or did you not set it with fear of having problems and opted for trying the bonding? – Podesta May 30 '19 at 9:52
  • 4 and last..) Try simply setting them both to the same static IP, and see if you experience any issues. If you do, report back. Also, let me know if this wall of text was clear enough. – Podesta May 30 '19 at 9:53
2

You are looking to use the Cloned MAC address feature on the Wifi interface. Set your DHCP reservation against your tethered MAC interface.

As for how you set these, it depends on how you manage your network connection. The GNOME Network Manager presents the field for you. Use the tethered MAC address in the Wifi Cloned MAC address field.

If you are using /etc/network/interfaces and config files, you can set the hw value there.

Example:

pre-up ifconfig <interface> hw ether xx:xx:xx:yy:yy:yy

  • I was not able to follow your post @Mark :( – FedonKadifeli May 27 '19 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.