[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: network configuration



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.

> 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 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.

> >   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.

You could probably do a manual repair with:

  ip route replace default via 10.10.10.1 dev wlan0

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.

> 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 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?

> 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.

> 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.

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.

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.

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.

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.

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

> 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.

> 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?

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.

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

Attachment: signature.asc
Description: Digital signature


Reply to: