0

I have a Raspberry with eth0 (192.168.02 / static) connected to a router (Fritz Box @ 192.168.0.1). The Router has internet connection. The Raspberry has a mobile usb stick with ppp connect to the internet. Actually if ppp is not connected the internet access from the Raspberry is through the Router over eth0. If ppp is connected the internet access is via ppp. if i del the default route for eth0 there is no internet connection if ppp is not connected and if ppp is connected internet connection is through ppp. so far everything fine. but if restart the raspberry it again has internet connection through eth0. But i only want to allow the raspberry internet connection only via ppp. eth0 just for internal communication like ssh. any ideas how to configure that?

/etc/network/interfaces looks like: source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.178.2
netmask 255.255.255.0

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

0

Sounds like you want to get rid of a static route. Check your /etc/network/interfaces file for any route configuration. Comment these lines (add a # at the beginning of the line), save the file, reboot, and try again. But your Pi is more than likely getting this info via DHCP, I would suggest configuring the interface with static details (and without a route).

  • i get rid of the static routes. still have internet via eth0 after reboot. updated the question with /etc/network/interface content – swapfile Feb 15 at 14:31
0

If you don't want the Raspberry to have an connection when PPP is disconnected, remove the gateway from your network configurations. Probably you're using the file /etc/network/interfaces, so open it on a text editor and change it from

auto eth0
inet iface eth0 static
    address 192.168.0.1
    netmask 255.255.255.0
    gateway 192.168.0.1

to

auto eth0
inet iface eth0 static
    address 192.168.0.1
    netmask 255.255.255.0
    #gateway 192.168.0.1

You'll still able to access the raspberry on local network (192.168.0.0/24) but it won't have an internet connection if PPP is down.

  • thanks. i tried that.. but internet is still available in eth0. /etc/network/interfaces looks like: # Ethernet auto eth0 allow-hotplug eth0 iface eth0 inet static address 192.168.178.2 netmask 255.255.255.0 #gateway 192.168.178.1 #dns-nameservers 192.168.178.1 – swapfile Feb 15 at 14:18
  • Did you rebooted after changing the file? What is the output of " route -n" – JucaPirama Feb 15 at 14:27
  • yep, output is: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.178.1 0.0.0.0 UG 202 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 304 0 0 wwan0 192.168.178.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 if ppp not connected. – swapfile Feb 15 at 14:28
  • if ppp is connected its: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0 10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 169.254.0.0 0.0.0.0 255.255.0.0 U 304 0 0 wwan0 192.168.178.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 – swapfile Feb 15 at 14:29
  • but when i do: route del default route -n is still Destination Gateway Genmask Flags Metric Ref Use Iface 169.254.0.0 0.0.0.0 255.255.0.0 U 304 0 0 wwan0 192.168.178.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 but ping google over eth0 doesnt work. – swapfile Feb 15 at 14:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.