In my home setup, Raspberry pis are connected to synology nas over ethernet (Synology provides the iSCSI target) but the ethernet connection doesn’t provide internet. The Raspberry pis are connected to internet over wifi. In this post, we are going to see how to set the default gateway so that the pis can speak reach internet.

  • Open /etc/dhcpcd.conf,
  • Add the below statement to the file
      interface eth0
      metric 300
    
      interface wlan0
      metric 200
    
  • reboot
  • Now check the routing table with route -n
      Kernel IP routing table
      Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
      0.0.0.0         192.168.1.254   0.0.0.0         UG    200    0        0 wlan0
      0.0.0.0         10.0.0.2        0.0.0.0         UG    300    0        0 eth0
      10.0.0.0        0.0.0.0         255.255.255.0   U     300    0        0 eth0
      192.168.1.0     0.0.0.0         255.255.255.0   U     200    0        0 wlan0