LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-14-2019, 10:12 AM   #1
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Rep: Reputation: 43
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
 
Old 07-14-2019, 12:05 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,140

Rep: Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307
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.
 
1 members found this post helpful.
Old 07-15-2019, 04:10 AM   #3
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43
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).
 
Old 07-15-2019, 04:23 AM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,779

Rep: Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139
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.
 
Old 07-15-2019, 04:25 AM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,779

Rep: Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139
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
 
Old 07-16-2019, 04:18 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,140

Rep: Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307Reputation: 2307
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 :-/.
 
Old 07-16-2019, 04:47 AM   #7
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,779

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

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fix:UDP packet send through vlan(eth0.4092), reaching at both eth0 and eth0.4092 arjuncr Linux - Networking 1 02-19-2019 02:37 PM
vnStat - if pointed to eth0 will it aggregate eth0 and eth0:1 alias stardotstar Linux - Networking 0 07-20-2010 07:49 PM
[SOLVED] Can DHCP server issue same IP for wlan0 and eth0 on same machine? linux_ Linux - Networking 6 05-26-2010 11:45 PM
Listen same port on eth0 and eth0:1 luckyluke09 Linux - Networking 3 10-11-2009 05:24 PM
prevent users to run the same script at the same time, on the same machine pvpnguyen Programming 2 09-05-2007 08:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration