1

I have a Zero W with a 4G module, to use the sim to access internet I did:

pi@raspberrypi:~ $ ip route
default via 10.111.100.1 dev wlan0 proto dhcp src 10.111.100.143 metric 302 
10.64.64.64 dev ppp0 proto kernel scope link src 10.82.126.194 
10.111.100.0/24 dev wlan0 proto dhcp scope link src 10.111.100.143 metric 302 
169.254.0.0/16 dev wwan0 scope link src 169.254.170.232 metric 203 

then:

sudo ip route del default via 10.111.100.1 dev wlan0
sudo ip route add default via 10.64.64.64 dev ppp0

and it works, but after reboot I get the original situation...

I tried to set auto ppp0 in /etc/network/interfaces

I tried to set metric in /etc/dhcpcd.conf

but none worked.how can I do that?

also I have a PPTP VPN, how can start it automatically on system boot?

I'm on Raspbian Buster

Miky
  • 173
  • 1
  • 4
  • 14
  • What operating system do you use? Do you respect the special issues using /etc/network/interfaces together with dhcpcd? – Ingo Jul 15 '19 at 15:01
  • I'm using Raspbian Buster, what do you mean with special issues? – Miky Jul 15 '19 at 19:26
  • Special issues are the note in /etc/nettwork/interfaces # Please note that this file is written to be used with dhcpcd and https://raspberrypi.stackexchange.com/a/41187/79866. – Ingo Jul 15 '19 at 22:56
  • I still didn't set up anything in /etc/network/interfaces and /etc/dhcpcd.conf, I disabled wifi which I won't need, but after boot I still have wlan0 as default route, also I don't know how to start sudo pon myvpn on boot – Miky Jul 16 '19 at 08:48
  • You did not set up anything in /etc/network/interfaces? But you wrote "I tried to set auto ppp0 in /etc/network/interfaces" and "I tried to set metric in /etc/dhcpcd.conf". – Ingo Jul 16 '19 at 09:30
  • yes but since it didn't work I came back to original files. anyway I solved adding route commands in /usr/src/reconnect.sh. now last thing is how to start vpn client on boot, I tried the script here https://prosindo.com/blog/2015/08/24/vpn-pptp-client-on-raspberry-pi/ and /etc/network/interfaces configuration here http://pptpclient.sourceforge.net/howto-debian.phtml but didn't work – Miky Jul 16 '19 at 09:47
  • You can't have more than one default network. That's the route the kernel uses to send packets that don't match any of the current subnets. – Dougie Dec 04 '21 at 09:53

1 Answers1

0

I don't know what's your setup and what you have tried. But with a default networking setup a ppp connection will give the interface ppp0 on the RasPi an ip address and a default route to the gateway of the ppp device by DHCP. So you should check why your ppp device isn't giving a default route.

In /etc/dhcpcd.conf you can also define static default routes with option static routers=. So ensure that all these options are commented to not overwrite the default route from the ppp device.

Look that /etc/network/interfaces does not contain any stanzas to configure ifupdown. This may have side effects to dhcpcd.

Ingo
  • 42,107
  • 20
  • 85
  • 197