Monday, September 16, 2024

ppp over ssh

**atlas
(apt install ppp)

*/etc/systemd/system/reversessh.service

[Unit]
Description=Reverse SSH connection
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/ssh -vvv -g -N -T -o "ServerAliveInterval 10" -o "ExitOnForwardFailure yes" -i /home/pi/.ssh/id_rsa -R 10022:localhost:22 pi@berry.public.ip

Restart=always
RestartSec=5s

[Install]
WantedBy=default.target

*/home/pi/wlanppp.sh

wlan="wlan0"
eth="ppp0"
sudo iptables -F
sudo iptables -t nat -F                                                                            
sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE                                         
sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT           
sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT                                                
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

**robin

*/etc/dnsmasq.d/custom-dnsmasq.conf

interface=eth0
bind-interfaces
server=1.1.1.1
domain-needed
bogus-priv
dhcp-range=192.168.2.2,192.168.2.100,12h


*/home/pi/atlasdoor.sh

sudo service dnsmasq start
ssh -L 10022:localhost:10022 -N -f -g berry.local
ssh -p 10022 pi@localhost bash /home/pi/wlanppp.sh

**misty

*/root/toatlas.sh

pppd updetach noauth silent nodeflate pty "/usr/bin/ssh -p 10022 root@192.168.2.1 /usr/sbin/pppd nodetach notty noauth" ipparam vpn 10.0.8.1:10.0.8.2
route del default
route add default gw 10.0.8.2


to copy from berry to misty, in atlas
scp -3r berry:/src atlas:/dst

sources:
https://github.com/arpitjindal97/raspbian-recipes/blob/master/wifi-to-eth-route.sh
https://wiki.archlinux.org/title/VPN_over_SSH#Using_PPP_over_SSH
https://serverfault.com/questions/449705/why-is-it-not-possible-to-use-two-remotes-for-rsync


No comments:

Post a Comment