Cannot use wifi to connect to internet when the ethernet card is set to static ip

Hi all,
I’ve been struggling with this for a couple hours. I want to set the ethernet interfaces to static ip but when i bring back the pi to my shop, i want it to connect to the wireless and get an address from the dhcp.

I’ve changed the /etc/network/interfaces files and the static ip works good. But when i come back to the shop, the pi connects to the wifi but it cannot access the internet… tried to ping 8.8.8.8 but it respond: From “lan static ip” : Destination host unreachable.

My interfaces file looks like this:

#interfaces(5) file used by ifup(8) and ifdown(8)
#include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

auto enxb827eb4a3250
iface enxb827eb4a3250 inet static
address 10.1.3.50
netmask 255.255.255.0
gateway 10.1.3.1
dns-nameservers 10.1.3.1 8.8.8.8 8.8.4.4

Am i missing something??

Thanks!

Given your mask, shouldn’t gateway and address be on the same subnet?
is it a typo? , your address should be 10.1.50.3 with gw 10.1.50.1 ?

Yes it was a typo!!
Thanks!

If that means it’s all working - good, and mark it solved.
If not, I suggest using commands ifconfig , iwconfig, and route when you think it should be working, to help dignosis
Derek

Oh :open_mouth: :open_mouth:!!!

No wonder why I don’t get any answer!!!

I meant it was a typo in the topic, not in my real config!!!

The problem still exist…

What OS are you using? Ubuntu MATE uses Network Manager, not Debian networking.

Can you explain what you mean, i’m just starting learning the whole linux world!!

Thanks

Frankly I don’t understand the fixation Pi users have for static IP addresses, but putting ANYTHING in /etc/network/interfaces is futile - this is used by old style Debian networking.

Network Manager is normally configured from the GUI (it can be done manually, but is complex). I presume there is an option for static IP address, but never use them.