• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

DNS issues while using serial for internet

TechEdison

Well-known member
I decided to use the method found in a reply on my thread/tutorial for using serial for internet on a mac. This shows details on how to use a Raspberry PI instead of a mac to achieve the same result.



Everything went just fine, but again, I cannot access any outside domains. MacWeb returns "cannot resolve host".

I could be missing several things, but I am not nearly educated enough to solve this problem. I've checked, and the raspberry pi does have internet. Here are the contents of my PPPd script:

pi@FireWebServer ~ $ cat /usr/local/bin/runpppd
#!/bin/bash

echo Waiting on ttyUSB0
while [ ! -c /dev/ttyUSB0 ]; do
sleep 1
done

echo Starting ppd
/usr/sbin/pppd \
/dev/ttyUSB0 \
57600 \
debug \
noauth \
local \
passive \
xonxoff \
nodetach \
ms-dns 8.8.8.8 \
192.168.0.200:192.168.0.138
echo Restarting PPPd
cd /
sudo ./usr/local/bin/runpppd


When I try to access a site, the RiPi's ethernet LED does not appear to be doing anything, which could mean a forwarding issue as well...

Any help would be greatly appreciated, and would further help with testing and development of my site "NoCSS".

 

TechEdison

Well-known member
I may have fixed it with a few iptables rules:

#first do this
sudo echo "1" > /proc/sys/net/ipv4/ip_forward

#then these
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80




I have no idea if this is the correct way to do it, but it worked for me.

 

epooch

Well-known member
What system is crashing? The Raspberry Pi or the Mac?  What Mac/System/Browser are you using?

When you are saying that outside domains are not resolving, I assume that no packets are getting through, not just that DNS isn't working (like it is a symptom, not the actual problem). Some ping tests to ip addresses would narrow down the issues.

Assuming it is a routing problem, for linux PPPd, you usually need to add the options:

# Enables IP forwarding on linux
ktune
# Add an entry for the peer to this system's ARP table.
proxyarp 


to get everything working.  This will allow Raspian to do NAT, forward the packets to your network, and will update the arp tables so packets intended for your Mac will go to your Raspberry Pi.  You are sort of doing this manually in your script, but it is built into PPPd, and it does work.

see https://ppp.samba.org/pppd.html for details about these settings. 

 
Last edited by a moderator:

TechEdison

Well-known member
Cool, thanks! I also discovered the common failure was sites (of mine) using 000webhost. It should work fine now.

 
Top