0

I have a problem similiar to this

Ethernet and wifi together

I have connected a device to my LAN port which requires static ip address

I have given the LAN port a static IP address by modifying the dhcpcd.conf file and adding

interface eth0

static ip_address=192.168.1.5

static routers=192.168.1.2

static domain_name_servers=192.168.1.2

to it. Now, I can connect the device on LAN port if I type the 192.168.1.2 IP address in the browser. But when I use a 3G USB (eth1) dongle to connect the device (Rpi) to internet, I cannot access the LAN port. The USB modem and LAN port work fine independently but not simultaneously. It seems like the device on LAN port disables the USB 3G modem.

I found this question (Raspberry Pi Connect to 3G modem instead of ethernet) a bit related to my post, but I couldn't understand it properly. My knowledge of LINUX is very limited. Can somebody please help? Fyi, I am running Raspbian on RaspberryPi 3B.

ArkanSaaS
  • 21
  • 6
  • It's a little bit confusing for me. What is "your LAN port"? A raspi in addition to the device? Where is the USB dongle connected? On that with "your LAN port" or on the device? The device is connected to "your LAN port" and should get the USB dongle to connect to internet? Where is the problem? On the device? Please don't answer in a comment. Instead edit your question. – Ingo Mar 16 '18 at 23:17
  • This post solved my problem https://raspberrypi.stackexchange.com/questions/50664/should-wifi-be-turned-off-with-wired-connection Thank you very much – ArkanSaaS Mar 18 '18 at 16:15
  • Please can you self answer your question to finish it? – Ingo Mar 18 '18 at 17:31

1 Answers1

0

Seems like the LAN (eth0) has higher priority than the USB dongle (eth1 gateway 192.168.137.1). I checked this using

route -n 

Then I used

sudo route delete  default gateway 192.168.137.1 

and finally

sudo route add  default gateway 192.168.137.1

to place my eth1 above eth0. So the result is that my Rpi is able to connect to the internet as well as I can access the device connected to the Pi's LAN port.

ArkanSaaS
  • 21
  • 6
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Dec 16 '19 at 01:36