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

Re: network problem



On Tue, Oct 05, 2021 at 10:00:45PM +0200, Pierre Frenkiel wrote:
> hi,
> I have the following problem on my laptop.
> my /etc/network/interfaces file contains:
>    auto enp0s1
>    iface enp0s1  inet static
>    address 192.168.1.10
>    netmask 255.255.255.0
>    gateway 192.168.1.1
> 
>    but after boot, ifconfig gives
> 
>    address 192.168.0.163
>    netmask 255.255.255.0
>    gateway 192.168.1.1

There is a *lot* to unpack here.  I'm not sure where to start.

Let's start here: that is *not* the output of "ifconfig" on Debian.
The ifconfig command, which is not installed by default, but is available
in an optional package, does not produce output that looks anything
like that.

Most particularly, it does not show any information about routing.  So
that "gateway" line that you claim it shows... that didn't come from
ifconfig, not even if you reformatted the hell out of it.

That leaves us to guess what you actually did, what the actual output
of ifconfig is, and why you're misleading us.

Now, let's assume for the sake of argument that you actually ran several
different commands, collated their output together in your head, and
rewrote it into this format.  Let's even assume that you did not make
any typos during this entire procedure.

This still leaves us with some questions.

1) What is the actual name of your network interface?

   The stanza in /etc/network/interface will only apply if the
   interface's name is enp0s1.  If it's not, then something else (perhaps
   network-manager) will take over and configure the interface.

The 192.168.0.163 address might have come from DHCP.  A fallback
configuration, like the one used by N-M, might be "run a DHCP client
and see if that works".

>    Then, networking works i.e. I can reach Internet, but of course
>    not my desktop and other devices 192.168.1.xx

2) What is your full routing table?  "ip route" under modern era tools,
   or "route -n" under the legacy tools.

It's not clear to me how you have working Internet access if your default
route is an address (192.168.1.1) that isn't on your subnet (192.168.0.0/24).

At the very least, you would need a route that leads you to the 192.168.0
network.  Perhaps you have one.  But you didn't show it.

Then, if for some reason you really *do* have a 192.168.0 address,
and a route to the 192.168.1 network, and a default gateway of 192.168.1.1,
and if all of this actually works, then... where did this routing table
get configured?

It's a mystery for sure.

You might want to look for log files that indicate what's happening.  They
could be in /var/log/ or you might need to use journalctl.

Meanwhile, use "ip addr" and "ip route" to see what your actual network
configuration is.  Don't reformat it.  Don't omit pieces of it.  Don't
mash the two together.


Reply to: