Skip to content

Instantly share code, notes, and snippets.

@mkopa
Last active November 30, 2023 22:08
Show Gist options
  • Save mkopa/d8823ab80c6a7bd07b9d93edff0f34ac to your computer and use it in GitHub Desktop.
Save mkopa/d8823ab80c6a7bd07b9d93edff0f34ac to your computer and use it in GitHub Desktop.

Revisions

  1. mkopa revised this gist Nov 30, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions script.txt
    Original file line number Diff line number Diff line change
    @@ -26,12 +26,12 @@ On Host:

    sudo sysctl -w net.ipv4.ip_forward=1

    sudo ip addr add 10.0.5.1/24 dev enp3s0
    sudo ip addr add 10.0.5.1/24 dev enp4s0
    sudo iptables -A FORWARD -o enp4s0 -i ppp0 -s 10.0.5.0/24 -m conntrack --ctstate NEW -j ACCEPT

    sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
    sudo iptables -t nat -F POSTROUTING
    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    sudo iptables -t nat -A POSTROUTING -o enp4s0 -j MASQUERADE


    sudo stty -F /dev/ttyUSB0 raw
  2. mkopa revised this gist Nov 30, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion script.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ sudo stty -F /dev/ttyUSB0 -a
    sudo pppd -detach /dev/ttyUSB0 19200 10.0.5.2:10.0.5.1 noauth local debug dump defaultroute nocrtscts persist maxfail 0 holdoff 1


    // raspberry pi disable wifi: $ sudo rfkill block wifi
    // raspberry pi disable wifi: $ sudo rfkill block wifi && sudo ip link set wlan0 down

    sudo vim /etc/rc.local
    echo "Starting pppd..."
  3. mkopa revised this gist Nov 30, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions script.txt
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ On client:
    1.
    add:
    nameserver 8.8.8.8
    nameserver 1.1.1.1

    to /etc/resolv.conf

    2.
  4. mkopa renamed this gist Nov 30, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. mkopa created this gist Nov 30, 2023.
    36 changes: 36 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    On client:

    1.
    add:
    nameserver 8.8.8.8
    to /etc/resolv.conf

    2.
    sudo stty -F /dev/ttyUSB0 raw
    sudo stty -F /dev/ttyUSB0 -a
    sudo pppd -detach /dev/ttyUSB0 19200 10.0.5.2:10.0.5.1 noauth local debug dump defaultroute nocrtscts persist maxfail 0 holdoff 1


    // raspberry pi disable wifi: $ sudo rfkill block wifi

    sudo vim /etc/rc.local
    echo "Starting pppd..."
    sudo stty -F /dev/ttyUSB0 raw
    sudo stty -F /dev/ttyUSB0 -a
    sudo pppd -detach /dev/ttyUSB0 19200 10.0.5.2:10.0.5.1 noauth local debug dump defaultroute nocrtscts persist maxfail 0 holdoff 1


    On Host:

    sudo sysctl -w net.ipv4.ip_forward=1

    sudo ip addr add 10.0.5.1/24 dev enp3s0
    sudo iptables -A FORWARD -o enp4s0 -i ppp0 -s 10.0.5.0/24 -m conntrack --ctstate NEW -j ACCEPT

    sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
    sudo iptables -t nat -F POSTROUTING
    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


    sudo stty -F /dev/ttyUSB0 raw
    sudo pppd /dev/ttyUSB0 19200 10.0.5.1:10.0.5.2 proxyarp local noauth debug nodetach dump nocrtscts passive persist maxfail 0 holdoff 1