I have a fresh installed raspberry pi 3 that is connected to my laptop via ethernet. I want my laptop to act as a router between the raspberry and internet.
I get the network and router configuration done so I can do
ping 18.104.22.168 on the raspberry and get answer back. But I can't get dns to work (
ping google.com gives
Temporary failure in name resolution).
Here are my configuration files on the raspberry :
# message about the file being used with dhcpcd source-directory /etc/network/interfaces.d dns-nameservers 22.214.171.124 126.96.36.199
# lot of stuff static domain_name_servers=188.8.131.52 184.108.40.206
Config on the laptop/router :
Linux Mint 18.04
card for internet connection : wlo1
card for rapsberry connection : enp2s0
Iptables commands used :
iptables -t nat -A POSTROUTING -o wlo1 -j MASQUERADE iptables -A FORWARD -i enp2s0 -j ACCEPT
With all that I tried on the pi I'm starting to think the issue is somewhere in the laptop/router configuration. So my question is shoud I install a DNS server on the laptop/router to forward the dns requests from the pi?
I found a lot of issues on this forum with same titles but a lot of them try to use the pi as a DNS server. I just it to access the net. (wifi not working and can't access directly to the home router with cable)
Please note that with the dns not working I can't install any packages (in particular I can't
nslookup on the raspberry)
EDIT : As the settings where not saved, I had to redo the commands after a restart and this time it worked, but I don't know exactly what I did differently that made it works.
Among all what I did on the laptop are :
dnsmasqthat I installed following random tutorials.
- changed iptable commands to only
iptables -t nat -A POSTROUTING -o wlo1 -j MASQUERADE(second is not needed because firewall has an ACCEPT policy on all chains)