On 06/26/2015 05:13 AM, Bob Proulx wrote:
notoneofmyseeds wrote:
>Bob Proulx wrote:
>
>I must say you have written a book here on this topic, Rob. I've learned a
>lot. I printed it out. To your questions now.
Sometimes people say I write too much. But the details are important.:-)
And this is a large book again with this message.
Thank you very much. I must say your responses have changed the way I
attend to reading forum posts. As is common, folks will skim through,
looking for a solution in a response. With yours, it's been very
different. I print them and read them away from the computer and all the
distractions. And as such I walk away more informed, and at times, my
problem becomes secondary, as I try to read, re-read and look for areas
to pursue, based on your writings, that will make me learn some more.
One thing with Linux is that there's so much going on, one needs the
discipline to focus on specific issues; that could be what one is trying
to accomplish at the moment, or a find a target interest. I feel like
both has happened in this thread. To be honest, reading your posts makes
me feel like, hey, I should invite this guy over for tea on Sunday
evenings, sit out and just talk; no computers around, just share ideas
and gain knowledge. Such, also, is the tone of your writing.
>I had a very long and nice response that I lost, as a result of an
>application crash.
LOL! I have been there many times myself!:-)
I've tried this time to ensure it does not happen again.
I am merging two messages from you so I can answer both here at the
same time.
> > ip addr show
>2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
> inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic eth0
>3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
> inet 10.10.10.6/24 brd 10.10.10.255 scope global dynamic wlan0
Gotcha. Although 192.168.1.2 is an unusual address to get from dhcp.
It would help to see the dhcp range the server issues.
And the other eth0 network is:
>2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
> inet 172.16.1.0/24 brd 172.16.1.255 scope global dynamic eth0
>3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group
default qlen 1000
> inet 10.10.10.5/24 brd 10.10.10.255 scope global wlan0
Again the 172.16.1.0 is an unusual address to get from dhcp. That is
the network address and I don't think this is correct. Have you
modified the dhcpd server configuration on that network to include the
entire range?
I think the next thing to start debugging is the dhcp server
configuration on each of those networks. Change the range to
something in the middle such as from 192.168.1.100-192.168.1.200 and
from 172.16.1.100-172.16.1.200 or some such range that does not
include the .0 network address and does not include the .255 broadcast
address. Don't assign those as host addresses.
We won't need to debug the dhcp servers on the two routers, as I've set
them to defaults, with very changes, such as changing the ip range for
one of them. I will get back to this later. I've changed quite a bit
around here, starting from scratch with dhcp; all set back to defaults,
with few modifications, such as ip address change. This, just to hone in
some more.
> > ip route show | tac
>172.16.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2
>169.254.0.0/16 dev wlan0 scope link metric 1000
>10.10.10.0/24 via 10.0.0.1 dev wlan0 proto static metric 1
>10.10.10.0/24 dev wlan0 proto kernel scope link src 10.0.0.5
>default via 172.16.1.1 dev eth0 proto static metric 1024
The route table is very telling of the problem. I think in this state
the wifi was connected first and then the wired network was connected
afterward. The wired network dhcp replaced the default route with its
own route default default via 172.16.1.1 dev eth0. That is the only
route listed in the above. It won't be out your wifi interface. If
your wifi interface is the only one with a route to the Internet then
obviously the above won't work.
I don't think it's the case that the wifi connects first, because I look
at the hardware light as the laptop boots and it does not come on until
much later. So I think the wired gets the default routes, as I presume
it first to 'get there' and keep that route. The wifi interface is the
only network with a router to the Internet.
You could probably do a manual repair with:
ip route replace default via 10.10.10.1 dev wlan0
I will respond to this later...
Aftering bringing up the wired interface, which will break the route,
the above would restore the working route out the wlan0 interface.
This is only a temporary measure. It is temporary because the
dhclient daemon will renew the dhcp lease and every time it does it
will rewrite the default route and break things again. But it would
probably assure you that this is exactly the problem and that things
can work with the right configuration.
> >Another question. Are all of the subnets on each of the networks
> >different? A subnet is something like 192.168.1.0/24. For example
> >having different subnets would mean 192.168.1.0/24 on one and
> >192.168.20.0/24 on another and 192.168.42.0/24 on the third. All
> >different.
>
>They are all different.
Good! That will make things much easier and simpler.
> >Now that you have learned this I have another question. Which
> >interface do you wish to keep as the default route?
>I assume the default route is the one that will take me online, in that
>case, the wifi.
Then the wifi will be the main interface and will hold eth0 default
route. The other interfaces should have the default route disabled.
Where exactly, or more precisely, how can the default route on the
Ethernet port be disabled? I had simply not included a gateway address
when I did this manually before. Is that how it's done?
>And this happens here, when ever the ethernet is connected, the wifi, which
>is the connection to the internet does not work. I remain connected to it,
>but can't go online. This would mean the lan is being used as the default
>route?
I think so. But unfortunately you missed providing the route data.:-(
I will try next time...more soon.
> >I think it likely that you have a default route problem which is why I
> >explained it in as much detail as I could above.
>I think you're right. The question now is who do I set it up. I've tried
>several configurations yesterday, none of which worked. For example, I set
>wlan0 to dhcp and set the ethernet static, providing all the details, ip,
>netmask, etc.
That should work. In fact I was going to suggest such a configuration
as being easier. Use dhcp on wlan0 but use a static ip configuration
on eth0. Could you repeat that test and tell us here what you are
doing?
Yes, and more on this soon now.
>I also changed the order, moving the wlan0 from top to bottom
>of the ethernet on the network/interfaces file.
The order the interfaces are listed in the interfaces file is not
significant. Changing the order won't do anything.
This is good to know. I must have misread something you said earlier
about the order.
>When both are connected or turned on, wlan0 (internet) and eth0 (lan), if I
>click on "Disconnect" on the lan in network manager, the wlan0 icon is
>automatically replaced by the comes on, if I had not turned it off. And if I
>click on Disconnect on the wlan0, the Ethernet stays off, if it was not
>connected. But if it was, connection is kept alive. If the wlan0 is on and I
>turned on the Ethernet, automatically, I loose Internet connection, but the
>wlan0 stays connected to the wifi.
Yes. I don't quite follow every word in the above but in general I
get the "feeling" of it and this feeling is that it matches what I
think is true. It is because both interfaces have dhcp and the wired
interface is replacing the default route and this default route is not
a useful route for you.
Yes, the wired interface default route is not useful for online. It is a
router that does not go online.
The root cause of the problem is that the two wired interfaces
apparently do not have a working route to the Internet. Correct? On
both of the wired interfaces there is a dhcp server that allocates
addresses and assigns a default route. But the wired networks don't
otherwise connect out to the Internet. Therefore the default route
assigned when the wired networks dhcp you and address is faulty.
For now, and as part of what I said earlier about changes, we limit this
to two networks; a wifi wlan0 that should go online and an ethernet eth0
that is on a local network. And let's see where we get with this simple
configuration. If good, then we have a template to add another network.
There is a dhcp server on the wired eth0 network. It assigns ip address,
etc, etc. But it does not connect to the Internet.
Literally I would say the root cause of the problem is in the dhcpd
server configuration where it is assigning a bogus default route.
Therefore at the lowest level one fix would be to stop them from
assigning a bugus default route.
Or, could it be that I simply do a manual configuration, and exclude the
default route. Am I mistaking the default route as the gateway? Same
thing, or different?
But what are you using for a dhcp server on these two wired networks?
Is it a smart system, such as a Debian server running a full featured
dhcpd server? I will guess not. Is it a dumb little blue consumer
electronics box with no configurability, and no way to turn that
feature off? I think that is most likely. Therefore I wouldn't try.
I'm using consumer grade routers. Not a full fledge debian dhcp server,
though you have planted a seed in my head. I could configure the router
in such a way that it does not hand out ip addresses and such, but I'd
like to keep that option open. Not doing so would require some log of
which machine was given which IP, etc. If the router can handle dishing
out ip addresses and managing that, I'd rather let that me. Except if
this can't be solved.
Instead I would side-step the issue and assign a static route to the
wired networks. To do this you need to know what the dhcp range is on
the two networks and pick an address outside that range. But even
that doesn't completely solve the problem because the two static
configurations need to be different. That is the original problem
that dhcp was invented to solve in the first place. If we avoid dhcp
then we have the original problem of needing to configure the static
addresses again.
For now, we stick with two networks.
Earlier you tried a static address but said things did not work for
you. Please try it again. Document what you tried in
/etc/network/interfaces and with the output of ip addr show and ip
route show. For starters something like this in /etc/network/interfaces.
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
The "allow-hotplug" is something new. You are able to see what I did and
have repeated, copied straight from the /etc/network/interfaces file.
> From all that I've read, this should be very simple and straightforward.
I don't think so. What you are trying to do is not usual. Connecting
simultaneously to two different networks, one of which is not fully
capable (the wired one), is not something that everyone does.
Therefore the default actions are not set up for you. You will need
to do something more than the normal simple thing.
Is the capability you want able to be configured simply? I don't
think so to that either. Because the standard dhcp client
configuration will want to set the default route and what you are
asking is a way to avoid setting the default route for one of your
interfaces. That can certainly be done but it is not a normal thing
to want to do. Can it be done? Yes. I would examine the dhclient
script /sbin/dhclient-script and understand how the hook scripts work
and figure out a way to have it set the default route for wlan0 but
not set the default route for eth0 when it wants to set 172.16.1.1 or
192.168.1.1 for routes. Is that simple? No because that means that
the script needs to modified upon every system upgrade that touches it.
What, Bob? I opened that file and it intimidated the crap out of me. I
don't even know where to begin to understand that script which Dan
Halbert started back in 1997. I'd have to learn first what it does, what
it's about, etc...just basic stuff, before I can begin to poke about
there, if ever.
>I've followed the rules, but no luck. All I want to do is connect to my
>local lan and the internet at the same time, without having to switch to the
>ethernet when I want to use the lan network, and the wifi when I want to go
>online. Am I the only one wanting to do this?
Pretty much, yes, you are one of the very, very few who want to do
this. Most people who want to do this would do it differently. Now
that I think I understand things better I can suggest something. I am
still not sure if I understand the wired networks. They don't connect
to the Internet. Right? But they still assign bogus default routes.
Right?
Yes, they don't connect to the Internet. Well, the one you're about to
see that I've reduced to now, does not.
If it were me I would be using a Debian dhcpd and would remove the
default route option from the config file. Then they wouldn't assign
a default route.
I don't think this is an option, the Debian dhcpd.
Or I would assign a static route and activate it manually when I
needed it. That would be a little more work but would keep things
simple enough for me.
Or I would read /sbin/dhclient-script and figure out what would need
to be done to avoid it setting a route on just those networks. I
would try to avoid this because it makes a burden for upgrades. It is
possible though.
================
Initially try this. Connect to wifi. Connect to either of the wired
networks. The manually fix the route. This is a temporary test to
verify that you and I understand what it is that you are trying to
do. Because remember that the dhclient will undo this every time it
renews the lease on the wired network.
ip route replace default via 10.10.10.1 dev wlan0
Bob
And here is what I've done...starting from new.
1. Network manager is still here.
2. reset dhcp, to a point, on both routers
3. both networks connected; wlan0 and eth0
4. output of ip add show:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
link/ether 00:16:d3:27:29:70 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 209sec preferred_lft 209sec
inet6 fe80::216:d3ff:fe27:2970/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
link/ether 00:13:02:b8:90:4d brd ff:ff:ff:ff:ff:ff
inet 10.0.0.6/24 brd 10.0.0.255 scope global dynamic wlan0
valid_lft 82075sec preferred_lft 82075sec
inet6 fe80::213:2ff:feb8:904d/64 scope link
valid_lft forever preferred_lft forever
And of ip route show | tac
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2
169.254.0.0/16 dev eth0 scope link metric 1000
10.0.0.0/24 via 10.0.0.1 dev wlan0 proto static metric 1
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.6
default via 192.168.1.1 dev eth0 proto static metric 1024
Manual configuration of network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto wlan0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
And rebooted.
Results:
A. Strange. Now the wifi is on and network manager tells me that the
ethernet is "not managed."
B. I did ifconfig:lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:89 errors:0 dropped:0 overruns:0 frame:0
TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:25756 (25.1 KiB) TX bytes:25756 (25.1 KiB)
wlan0 Link encap:Ethernet HWaddr 00:13:02:b8:90:4d
inet addr:10.0.0.6 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::213:2ff:feb8:904d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:203 errors:0 dropped:0 overruns:0 frame:0
TX packets:282 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:138993 (135.7 KiB) TX bytes:38097 (37.2 KiB)
And so this means now I can go online but can't use the local network. I
did not use your route command, seeing as this, at this point, was
unnecessary.
There were some errors I did not understand during reboot. If you need
me to find and send error logs, I will.
Thanks a lot, Bob.