Advertisement
Guest User

Untitled

a guest
Feb 27th, 2021
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #!/bin/bash
  2. # https://www.bitchute.com/channel/mechatroniac/
  3. # modified from https://github.com/arpitjindal97/raspbian-recipes/blob/master/wifi-to-eth-route.sh
  4. # Share Wifi with Eth device
  5. #
  6. #
  7. # This script is created to work with Raspbian Stretch
  8. # but it can be used with most of the distributions
  9. # by making few changes.
  10. #
  11. # Make sure you have already installed `dnsmasq`
  12. # Please modify the variables according to your need
  13. # Don't forget to change the name of network interface
  14. # Check them with `ifconfig`
  15.  
  16. ip_address="192.168.2.1"
  17. netmask="255.255.255.0"
  18. dhcp_range_start="192.168.2.2"
  19. dhcp_range_end="192.168.2.100"
  20. dhcp_time="12h"
  21. eth="eth0"
  22. wlan="wlan0"
  23.  
  24. sudo systemctl start network-online.target &> /dev/null
  25.  
  26. sudo iptables -F
  27. sudo iptables -t nat -F
  28.  
  29. ** Route DNS **
  30. sudo iptables -t nat -A PREROUTING -i $wlan -p udp --dport 53 -j REDIRECT --to-ports 53
  31.  
  32. ** Route TCP **
  33. sudo iptables -t nat -A PREROUTING -i $wlan -p tcp --syn -j REDIRECT --to-ports 9040
  34.  
  35.  
  36. sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE
  37. sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT
  38. sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT
  39. sudo iptables -A INPUT -i $eth -p tcp -m tcp --dport 22 -m start --start NEW -j ACCEPT
  40.  
  41. sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
  42.  
  43. sudo ifconfig $eth $ip_address netmask $netmask
  44.  
  45. # Remove default route created by dhcpcd
  46. sudo ip route del 0/0 dev $eth &> /dev/null
  47.  
  48. sudo systemctl stop dnsmasq
  49.  
  50. sudo rm -rf /etc/dnsmasq.d/* &> /dev/null
  51.  
  52. echo -e "interface=$eth\n\
  53. bind-interfaces\n\
  54. #put in your DNS server below if this doesn't work or if you don't know one you may replace the ip below with 1.1.1.1
  55. server=176.103.130.130\n\
  56. domain-needed\n\
  57. bogus-priv\n\
  58. dhcp-range=$dhcp_range_start,$dhcp_range_end,$dhcp_time" > /tmp/custom-dnsmasq.conf
  59.  
  60. sudo cp /tmp/custom-dnsmasq.conf /etc/dnsmasq.d/custom-dnsmasq.conf
  61. sudo systemctl start dnsmasq
  62. sudo service tor start
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement