Advertisement
hugol

Untitled

Oct 15th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.17 KB | None | 0 0
  1. iptables -F
  2. iptables -F -t nat
  3. iptables -X -t nat
  4. iptables -F -t filter
  5. iptables -X -t filter
  6.  
  7. iptables -A INPUT -i lo -j ACCEPT
  8.  
  9. iptables -A INPUT -i enp0s3 -j ACCEPT
  10.  
  11. iptables -A INPUT -i enp0s8 -s <publiczny_adres_ip_serwera> -j DROP
  12.  
  13. iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  14.  
  15.  
  16.  
  17. 1)
  18. sprawdzic mace
  19.  
  20. enp0s3
  21.  
  22. killall dhclient
  23.  
  24. ifconfig enp0s3 192.168.2.1 netmask 255.255.255.0 up
  25. ifconfig enp0s3 192.168.2.2 netmask 255.255.255.0 up
  26. ifconfig enp0s3 192.168.2.3 netmask 255.255.255.0 up
  27.  
  28. 2)
  29.  
  30. echo "1" > /proc/sys/net/ipv4/ip_forward
  31.  
  32. iptables -A FORWARD -i <interfejs_wewnętrzny> -o <interfejs_zewnętrzny> -s
  33. 192.168.xyz.0/24 -d 0/0 -j ACCEPT
  34.  
  35. iptables -A FORWARD -i <interfejs_zewnętrzny> -o <interfejs_wewnętrzny> -s 0/0 -d
  36. 192.168.xyz.0/24 -j ACCEPT
  37.  
  38. iptables -t nat -A POSTROUTING -s 192.168.xyz.0/24 -d 0/0 -j MASQUERADE
  39.  
  40. route add default gw <ip_routera>
  41.  
  42. echo "nameserver 8.8.8.8" > /etc/resolv.conf
  43.  
  44.  
  45.  
  46.  
  47. 3) PORT REDIRECT
  48.  
  49. iptables -A PREROUTING -t nat -i <interfejs_zewnętrzny> -p tcp -d <adres_IP_routera>
  50. --dport <nr_portu_na_routerze> -j DNAT --to-destination
  51. <adres_ip_komputera_wewnątrz_sieci>:<nr_portu>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement