2

I have two laptops both of which are running CentOS 7. Both are connected to a wireless access point for Internet connectivity. I also have connected them to each other through a switch as a lab for my RHCSA exam.

The problem is that whenever I connect them through the switch, they lose internet connectivity. The wireless connection is working, they have their IP addresses but no internet connectivity.

To bring back the internet connectivity I have to disable the Ethernet adapters through nmcli command.

I just have started using LINUX so I must be missing something.

EDIT: This is the kernel routing table while the problem exists:

# route
Kernel IP routing table
Destination    Gateway      Genmask      Flags  Metric Ref Use  Iface
default        gateway      0.0.0.0         UG   100    0   0   enp0s25
default        gateway      0.0.0.0         UG   600    0   0   wlo1
10.10.10.0     0.0.0.0      255.255.255.0    U   100    0   0   enp0s25
192.168.43.0   0.0.0.0      255.255.255.0    U   600    0   0   wlo1
  • 1
    This could be because of the routing table routing IP packets are sent to the other laptop instead of the Internet via WiFi. While it is not working, please post the output of the route command on both machines. – Ned64 Nov 4 '17 at 9:44
1

The problem is that your kernel routes IP packets by default to the other laptop instead of through the Wi-Fi card.

Your routing table has two default routes (i.e. paths any IP packet may take to any destination):

Kernel IP routing table
Destination    Gateway      Genmask      Flags  Metric Ref Use  Iface
default        gateway      0.0.0.0         UG   100    0   0   enp0s25
default        gateway      0.0.0.0         UG   600    0   0   wlo1

So, both the enp0s25 (Ethernet, cable) and the wlo1 (Wi-Fi) are available for arbitrary destinations. Which one should the kernel send the packet to? It will try the one with the smaller metric number first. That way, your Ethernet card (and thereby, the other laptop) gets the packages destined to the Internet.

Solution: Remove the default route to enp0s25, by using a command like:

sudo route del -net 0.0.0.0 netmask 0.0.0.0 enp0s25

The other route (wlo1) needs to stay untouched. The existing 10.10.10.0 route will still force IP packets to the other laptop to use the Ethernet interface.

Hope I got the syntax of route correct. Please try and let me know!

-2

That worked. When you mentioned about the route option, I, on my own, added the default route of the Internet Access Point to the Ethernet adapter configuration but still it didn't worked. That means it was the metric that was counted and not the IP Address of the default GW.

  • ... and vote the solution up if you believe it is correct (which it seems to be). – Ned64 Nov 5 '17 at 9:28

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.