-1

I have setup a RPi as a VPN Gateteway, I have change some devices' (1 PC + 1 NAS) default gateway to point to RPI IP@ So far everything works fine.

I have setup port forwarding in my internet router to be able to reach my NAS from internet. And it used to work before I installed the RPI.

Pb is, when I try to connect to my NAS from an internet IP.... no response.

The issue comes from my routing rules I guess, but I'm noob at linux/rounting/RPI.

I am using only wired network connections to my Raspberry Pi.

This is my systemd dhcpcd status:

$sudo systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/system.slice/dhcpcd.service
           └─wait.conf
   Active: active (running) since Mon 2017-12-04 17:27:32 UTC; 22h ago
  Process: 333 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w (code=exited, status=0/SUCCESS)
 Main PID: 564 (dhcpcd)
   CGroup: /system.slice/dhcpcd.service
           ├─474 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
           └─564 /sbin/dhcpcd -q -w

Dec 04 17:27:26 raspberrypi dhcpcd[333]: eth0: rebinding lease of 192.168.1.24
Dec 04 17:27:26 raspberrypi dhcpcd[333]: eth0: probing address 192.168.1.24/24
Dec 04 17:27:27 raspberrypi dhcpcd[333]: eth0: soliciting an IPv6 router
Dec 04 17:27:31 raspberrypi dhcpcd[333]: eth0: leased 192.168.1.24 for 43200 seconds
Dec 04 17:27:31 raspberrypi dhcpcd[333]: eth0: adding route to 192.168.1.0/24
Dec 04 17:27:31 raspberrypi dhcpcd[333]: eth0: adding default route via 192.168.1.254
Dec 04 17:27:32 raspberrypi dhcpcd[333]: eth0: /sbin/resolvconf: 230: /lib/resolvconf/libc: cannot create /etc/resolv.conf: Operation not permitted
Dec 04 17:27:32 raspberrypi dhcpcd[333]: eth0: Too few arguments.
Dec 04 17:27:32 raspberrypi systemd[1]: eth0: Started dhcpcd on all interfaces.
Dec 04 17:27:39 raspberrypi dhcpcd[564]: eth0: no IPv6 Routers available
Warning: dhcpcd.service changed on disk. Run 'systemctl daemon-reload' to reload units.

This is my routing table:

$route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 
0.0.0.0         172.21.22.1     128.0.0.0       UG    0      0        0 tun0
default         192.168.1.254   0.0.0.0         UG    202    0        0 eth0
81.171.107.18   192.168.1.254   255.255.255.255 UGH   0      0        0 eth0
128.0.0.0       172.21.22.1     128.0.0.0       UG    0      0        0 tun0
172.21.22.0     0.0.0.0         255.255.254.0   U     0      0        0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0

Please help. Thank you


1st: Wired Connection

2nd: dhcpd output

3rd: enter image description here

Hi, Here is what I get:

$ lsattr /etc/resolv.conf

----i---------e---- /etc/resolv.conf

  • I think you'll need to show us exactly the rules that you're using... – Brick Dec 5 '17 at 13:35
  • 1st: Are the RPi network connections wired or wireless? ... 2nd On the RPi what is the output of sudo systemctl status dhcpcd ... 3rd On the RPi what is the output of sudo route ... Please update the question with the outputs. – RubberStamp Dec 5 '17 at 14:33
  • 1st: The RPI connection is wired – user77337 Dec 5 '17 at 16:12
  • 2nd: ● dhcpcd.service - dhcpcd on all interfaces Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: e Drop-In: /etc/systemd/system/dhcpcd.service.d └─wait.conf Active: active (running) since Mon 2017-12-04 17:27:32 UTC; 22h ago Process: 333 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w (code=exited, status=0/SU Main PID: 564 (dhcpcd) CGroup: /system.slice/dhcpcd.service ├─474 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iw └─564 /sbin/dhcpcd -q -w – user77337 Dec 5 '17 at 16:16
  • 1
    It seems there are some problems with the resolv.conf file attributes... what is the output of lsattr /etc/resolv.conf ... This time Please edit the question. Do not place new information in the comments. – RubberStamp Dec 5 '17 at 19:36
0

Your pi has 2 default routes: 0.0.0.0 (= default gw) with metric 0 (highest priority) to the tun0 interface. default with metric (202) to eth0 interface.

Since the default gateway to tun0 has the highest priority, your pi will route every (unknown) route to tun0.

I can't make up your complete setup from your post, but I think this might be your issue.

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.