LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   eth0 and Wi-Fi at the same time? (https://www.linuxquestions.org/questions/linux-networking-3/eth0-and-wi-fi-at-the-same-time-4175657385/)

czezz 07-14-2019 10:12 AM

eth0 and Wi-Fi at the same time?
 
Both eth0 and wlan0 interfaces get IP addresses from DHCP.
Although, only wlan0 is reachable from other hosts in the network.

Also, when I force to reach internet over eth0 it works:
Code:

ubuntu@ubuntu:~$ ping -I eth0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.208 eth0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=267 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=11.8 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 11.871/139.655/267.439/127.784 ms

However, if I try to reach any other hosts in the local network it fails
Code:

ubuntu@ubuntu:~$ ping -I eth0 192.168.1.135
PING 192.168.1.135 (192.168.1.135) from 192.168.1.208 eth0: 56(84) bytes of data.
^C
--- 192.168.1.135 ping statistics ---
20 packets transmitted, 0 received, 100% packet loss, time 19460ms


What am I doing here wrong? Shouldnt both interfaces be reachabled in LAN?

Code:

ubuntu@ubuntu:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.208  netmask 255.255.255.0  broadcast 192.168.1.255
        ether b8:27:eb:fa:37:26  txqueuelen 1000  (Ethernet)
        RX packets 5011  bytes 401254 (401.2 KB)
        RX errors 0  dropped 3  overruns 0  frame 0
        TX packets 229  bytes 21347 (21.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.185  netmask 255.255.255.0  broadcast 192.168.1.255
        ether b8:27:eb:af:62:73  txqueuelen 1000  (Ethernet)
        RX packets 843  bytes 75292 (75.2 KB)
        RX errors 0  dropped 3  overruns 0  frame 0
        TX packets 397  bytes 79104 (79.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ubuntu@ubuntu:~$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.1.1    0.0.0.0        UG    100    0        0 eth0
0.0.0.0        192.168.1.1    0.0.0.0        UG    600    0        0 wlan0
192.168.1.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan0
192.168.1.0    0.0.0.0        255.255.255.0  U    0      0        0 eth0
192.168.1.1    0.0.0.0        255.255.255.255 UH    100    0        0 eth0
192.168.1.1    0.0.0.0        255.255.255.255 UH    600    0        0 wlan0


business_kid 07-14-2019 12:05 PM

On the routing table, you have a default route to 192.168.1.1 from both, a route to the 192.168.1.0 network from both, and a route to 192.168.1.1 from both.

I presume 192.168.1.1 is your modem. I'd turn off wifi, because you don't need both, and eth0 will be faster. Wifi works because the first default is to wifi. Routing tables are read from the top down.

You can't have two default routes. One gets ignored.

czezz 07-15-2019 04:10 AM

Hmmm... new situation:

- From any host in LAN except the router (192.168.1.1) I can reach it ONLY via wlan0 (192.168.1.185) - that is 2nd entry in the routing table.
- However, from router (192.168.1.1), I can reach that host ONLY via eth0 (192.168.1.208) - that is 1st entry in the routing table.

The reason why I want to keep both interfaces up is to have a backup link (in case one is down).

ferrari 07-15-2019 04:23 AM

Quote:

The reason why I want to keep both interfaces up is to have a backup link (in case one is down).
Your wireless network connection should take over if/when eth0 goes down, as the default route will then be via wlan0.

ferrari 07-15-2019 04:25 AM

The default route with the lowest metric is the preferred default route ie eth0...
Code:

Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.1.1    0.0.0.0        UG    100    0        0 eth0
0.0.0.0        192.168.1.1    0.0.0.0        UG    600    0        0 wlan0


business_kid 07-16-2019 04:18 AM

Not the world's networking expert, but you need a route to 192.168.1.0 if you want to access your internal network. You don't want to be searching the web for your private network :-/.

ferrari 07-16-2019 04:47 AM

No, that's not needed. For hosts on the same subnet, ARP is used.

https://www.geeksforgeeks.org/comput...ork-arp-works/


All times are GMT -5. The time now is 09:14 PM.