Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Where is my network !?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1691
Location: Switzerland (Romandie)

PostPosted: Tue Mar 12, 2019 7:38 pm    Post subject: Where is my network !? Reply with quote

[Moderator note: This post was attached to the 4 year old topic Where is my network !?. I split it out because the problems appear to be unrelated, and because the other thread was from 2015. -Hu]

I have 2 network interfaces, net.eth0 and net.wlan0. Both are working fine, but wlan0 is the only with internet access, and when I start eth0 (openrc system), the internet access get down. If I stop eth0, internet is up again.

It must be some simple to do configuration in order to tell net.eth0 than it must not take over the internet traffic when both are on, but I just cannot find it. Do you have any clue?

EDIT: Finally, I found it. In /etc/conf.d/net add 1 line per interface like:
Code:
metric_wlan0="90"
metric_eth0="100"

and the kernel will use the one with the lower metric value as default internet interface when both are up.
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1568
Location: Frankfurt, Germany

PostPosted: Wed Mar 13, 2019 1:12 pm    Post subject: Reply with quote

Most probably, a second default route is added when you start eth0.

Make sure that no default route is added when you start eth0. And remove the 'metric' workaround - it's not the right solution.

Please post:
  1. the output of 'netstat -rn' and of 'ifconfig -a' after you started both wlan0 and eth0.

  2. your file /etc/conf.d/net.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43803
Location: 56N 3W

PostPosted: Wed Mar 13, 2019 7:55 pm    Post subject: Reply with quote

Dominique_71,

Its probably worse than mike155 says.
If both interfaces are in the same subnet, like they would be with a domestic router, chaos is ensured.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1691
Location: Switzerland (Romandie)

PostPosted: Mon Apr 22, 2019 11:14 am    Post subject: Reply with quote

Sorry for the delay.
mike155 wrote:

the output of 'netstat -rn' and of 'ifconfig -a' after you started both wlan0 and eth0


Code:
# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
0.0.0.0         192.168.188.1   0.0.0.0         UG        0 0          0 eth0
127.0.0.0       127.0.0.1       255.0.0.0       UG        0 0          0 lo
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
192.168.188.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0

# ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.188.20  netmask 255.255.255.0  broadcast 192.168.188.255
        inet6 fe80::b2e1:20e:fb74:2924  prefixlen 64  scopeid 0x20<link>
        ether e8:40:f2:11:7c:42  txqueuelen 1000  (Ethernet)
        RX packets 6825  bytes 462180 (451.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19443  bytes 27492441 (26.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 1  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10377  bytes 732400 (715.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10377  bytes 732400 (715.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sit0: flags=128<NOARP>  mtu 1480
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::76de:2bff:fef7:ae8  prefixlen 64  scopeid 0x20<link>
        ether 74:de:2b:f7:0a:e8  txqueuelen 1000  (Ethernet)
        RX packets 9359666  bytes 12031956152 (11.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3005518  bytes 811890646 (774.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Quote:
* your file /etc/conf.d/net.


Code:
# cat /etc/conf.d/net
modules_wlan0="!plug wpa_supplicant dhcpd"
wpa_supplicant_wlan0="-Dnl80211 -qq"
config_wlan0="dhcp"
config_eth0="dhcp"
dhcpcd_eth0="-t 10" # 10 seconds time out
mode_wlan0="master"
#mode_wlan0="managed"
channel_wlan0="3"
#routes_wlan0="default via 192.168.1.1"
metric_wlan0="90"
metric_eth0="100"


EDIT: This is when both are up and running and internet is working fine on wlan0.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43803
Location: 56N 3W

PostPosted: Mon Apr 22, 2019 11:47 am    Post subject: Reply with quote

Dominique_71,

You have two default routes, that mostly won't work.
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
0.0.0.0         192.168.188.1   0.0.0.0         UG        0 0          0 eth0

but they are in different subnets which is a good thing.

Entries is the routing table are applied from the bottom up, so anything to 192.168.188.0/24 is sent over eth0.
Anything to 192.168.1.0/24 is sent over wlan0.
Anything to 127.0.0.0/8 is sent over lo.
All the rest is sent over eth0 as Destination 0.0.0.0 matches everything.

The Destination 0.0.0.0 over wlan0 can never be used.
If you remove that route, it will probably work but maybe not the way you intended.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1568
Location: Frankfurt, Germany

PostPosted: Mon Apr 22, 2019 12:07 pm    Post subject: Reply with quote

Dominique_71 wrote:

Code:
# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
0.0.0.0         192.168.188.1   0.0.0.0         UG        0 0          0 eth0


There are two default routes. That's like a traffic sign, saying both 'go left' and 'go right' at the same time.

A router or host should not have more than one default route (there are exceptions, of course). You tried to fix that with interface metrics, but that's not the right solution. The right solution is: make sure that no default route is added when eth0 is started:
  1. Can you configure eth0 with a static ip address?

  2. If you configure eth0 using DHCP, make sure that DHCP initializes only the IP address, the netmask and the broadcast address of that interface. DHCP must NOT set default routes, DNS configuration, NTP configuration, etc.

    You could try to add the parameter "--nogateway" in /etc/conf.d/net:
    Code:
    dhcpcd_eth0="--nogateway -t 10" # 10 seconds time out

    Does that help?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7170

PostPosted: Mon Apr 22, 2019 12:13 pm    Post subject: Reply with quote

He sure have two default routes, but not the same default routes, one for each interface.

So it's like having the traffic sign with "cycle go left" and "car go right" ; that's different.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43803
Location: 56N 3W

PostPosted: Mon Apr 22, 2019 1:04 pm    Post subject: Reply with quote

krinn,

Not quite. The idea of a default route is that's its a catch all.
Anything that gets here go that way -->
That's why on the first reached default route will be used.

Problems actually occur when a packet goes out of one interface and the reply tries to use the other.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7170

PostPosted: Mon Apr 22, 2019 2:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Anything that gets here go that way -->

I understand it more as "Anything that goes thru 'this' and goes somewhere we have no idea where, go that way -->"

The reply itself "should" never a problem, it fall under the rules of "mac address is in packet to reach destination", or no mac address and fall under DMZ rule.
The reply problem may comes from having a mac that you cannot reach it yourself (like getting answer thru eth that need to reach wlan and no bridge allow you to reach wlan from eth on your host).

The real issue people have is not the routing itself, is howto reach other interface, and a simple "ping -c1 vlanip" make it fail as only the wlan_router is able to reach wlan interface without proper bridging.

But maybe he have a value in not using internet with eth interface, else the simplest solve would be either bridging both together, or disable eth if really it's of no use.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1691
Location: Switzerland (Romandie)

PostPosted: Mon Apr 22, 2019 9:23 pm    Post subject: Reply with quote

It is a laptop. It have internet access only on wlan0. The printer is on eth0, which is up and running on the PC only when I use the printer.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7269
Location: Saint Amant, Acadiana

PostPosted: Mon Apr 22, 2019 9:36 pm    Post subject: Reply with quote

In that case just give your eth0 a static address in same subnet with printer and it will work. Printer needs a static address, too.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1691
Location: Switzerland (Romandie)

PostPosted: Mon Apr 22, 2019 10:53 pm    Post subject: Reply with quote

Jaglover wrote:
In that case just give your eth0 a static address in same subnet with printer and it will work. Printer needs a static address, too.

OK, I will try. The printer already have a static address. I cannot do that on the wifi router, it is why I use 2 routers. Dynamic ip address work out of the box only with OSX and some windows versions. As we have other laptops, it was much simpler to just use that second router with a static address for the printer.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7269
Location: Saint Amant, Acadiana

PostPosted: Tue Apr 23, 2019 2:13 am    Post subject: Reply with quote

Dominique_71,

routing and routers are needed to get out from your LAN, as long as your computer and printer are in the same subnet there is nothing to route.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3210
Location: Illinois, USA

PostPosted: Tue Apr 23, 2019 2:58 am    Post subject: Reply with quote

Jaglover wrote:
Dominique_71,

routing and routers are needed to get out from your LAN, as long as your computer and printer are in the same subnet there is nothing to route.

Yes, all the OP needs is a cheap four or five port unmanaged switch to plug both the printer and computer into. A third cable would go to the router for internet. This is the setup I had on my old printer. the new printer has only wireless and USB, a definite step backwards,
I no longer even use the switch built into my router. I have a sixteen port switch that every cable in the house connects to. One cable from the switch plugs into a single LAN port on the router.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43803
Location: 56N 3W

PostPosted: Tue Apr 23, 2019 8:42 am    Post subject: Reply with quote

Dominique_71,

On routers that will not provide a static IP you can often cheat by binding the MAC address of the network card to a fixed IP in the router.
The IP address is not static in the traditional sense but it never changes as the router always hands out the same IP, so it has the same effect.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3210
Location: Illinois, USA

PostPosted: Wed Apr 24, 2019 12:58 am    Post subject: Reply with quote

NeddySeagoon wrote:
Dominique_71,

On routers that will not provide a static IP you can often cheat by binding the MAC address of the network card to a fixed IP in the router.
The IP address is not static in the traditional sense but it never changes as the router always hands out the same IP, so it has the same effect.

I verify that this works on a DLINK DIR-655.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7269
Location: Saint Amant, Acadiana

PostPosted: Wed Apr 24, 2019 2:05 am    Post subject: Reply with quote

SOHO routers can do nothing to stop you from grabbing an IP address and communicating with other hosts in the same subnet. Of course, if you are careless you may create an IP conflict.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1691
Location: Switzerland (Romandie)

PostPosted: Tue May 14, 2019 9:07 pm    Post subject: Reply with quote

Jaglover wrote:
Dominique_71,

routing and routers are needed to get out from your LAN, as long as your computer and printer are in the same subnet there is nothing to route.


The wifi router is needed to get internet access, but it is not possible to mix static and dynamic ip on the LAN with it. As many of our friends want to use the wifi, it will be of no use for them if it is set to use static ip (I am not always here, and I just have other things to do than to manage static ip on this wifi). The other router is used only for the printer, and the 2 LANs are not even connected to each other.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7269
Location: Saint Amant, Acadiana

PostPosted: Tue May 14, 2019 9:14 pm    Post subject: Reply with quote

Why you need a router to connect printer? And technically speaking there is no such thing as wifi router. There is router and there is access point, even if they are built into same case they are still functionally separate units. Often there is also switch built into same box.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
genbort
n00b
n00b


Joined: 27 May 2019
Posts: 12

PostPosted: Mon Jun 03, 2019 4:19 pm    Post subject: Reply with quote

Wireless routers are available in the market.
And you could connect a printer with a bluetooth which is enough to printing.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43803
Location: 56N 3W

PostPosted: Mon Jun 03, 2019 4:30 pm    Post subject: Reply with quote

genbort,

There are things misnamed as wireless routers for sale, yes.

As Jaglover said they are usually a switch, a router, which is a piece of software and a wireless access point built into the same box.
Domestic 'wireless routers' are mostly only safe to use if the wireless access point is disabled.

Well, you wouldn't want wired and wireless on the same network would you?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6755
Location: Blighty

PostPosted: Tue Jun 04, 2019 10:27 am    Post subject: Reply with quote

NeddySeagoon wrote:
Well, you wouldn't want wired and wireless on the same network would you?


Why not?

I even assign the same IP to wired and wireless interfaces via DHCP.
dhcpcd will announce the "preferred" address via ARP to notify hosts which hardware address to send to.

This allows me to have one hostname for the laptop, regardless of which interface is actually live.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
alamahant
Tux's lil' helper
Tux's lil' helper


Joined: 23 Mar 2019
Posts: 92

PostPosted: Tue Jun 04, 2019 8:23 pm    Post subject: Reply with quote

You can have as many interfaces as you like.
However ONLY ONE should be assigned a default gateway.
If more than one have default-gateways in their definition files then network connectivity freezes for some reason.
You will not even be able to ping your router...
:D
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6755
Location: Blighty

PostPosted: Tue Jun 04, 2019 8:39 pm    Post subject: Reply with quote

alamahant wrote:
You can have as many interfaces as you like.
However ONLY ONE should be assigned a default gateway.
If more than one have default-gateways in their definition files then network connectivity freezes for some reason.
You will not even be able to ping your router...
:D


On Linux this is not true. You can have many default gateways, split by metric. Lowest metric is the default default route.
The same logic applies to subnets.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum