How can I setup interfaces file to be able to connect the Raspberry pi to the internet (4g USB modem) and at the same time to a PC via SSH (ethernet).

My interface file look like this (/etc/network/interface):

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/dhcpcd.conf looks as follows:-

       interface eth0
       static ip_address=
       static routers=
       static domain_name_servers=

I am able to connect via SSH but I lose the internet connection.

  • AND I'm not sure I understand why you have a problem. I can connect to the internet and other local LAN PCs (as part of 192.168.1.*) from my Rpi. Can you restore to the std install? It should just work (or I don't understand you Q). (But this is still off-topic). Good luck! – shellter Mar 2 '17 at 19:19
  • I think I miss "auto eth0". i will try that (I asked to move this Q btw). – Rodrick Mar 2 '17 at 20:05
  • It doesn't work. I am not able to connect via ssh to a pc (ethernet) and have internet via 4g USB modem at the same time. – Rodrick Mar 2 '17 at 20:37
  • Please describe your minimal physical setup for this problem, i.e. externalnternetConnection->4GBUSBmodem->RPi->{PC1,PC2,...}.. (by editing your Q, don't add this info as a comment!! :-) ) . Don't you have a router or switch in there someplace? Good luck. – shellter Mar 2 '17 at 21:29
  • If you keep "auto lo" and add "auto eth0", does that solve your problem? Don't disable the loop back interface by removing "auto lo". – Anders Mar 2 '17 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.