reporter1

Untitled

Jan 10th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. You can set up the NAT table with additional inputs. The following script can help you solve the problem. You need to set the variables at the top depending on your system and your network.
  2.  
  3. # / Bin / bash
  4. #
  5. # Vvvvv-Change the following! - Vvvvv
  6. IPTABLES = / usr / sbin / iptables
  7. LAN_NETWORK = 192.168.0.0/24
  8. Server_ip = 192.168.0.2
  9. INTERNET_IP = 100100100100
  10. REMOTING_PORT = 8895
  11. REGION_PORT = 9000
  12. # ^ ^ ^ ^ ^-Edit the above! - ^ ^ ^ ^ ^
  13.  
  14. # First, the destination NAT: we'll redirect to the server all that goes to an external address via your ports,
  15. # Note: if you have a double NAT is working and that the router has no internal IP address, you will
  16. # Use a different set of lines with PREROUTING-DNAT - destination (-d) defined ... to the internet facing private address (the Internet address private?).
  17. $ IPTABLES-t nat-I PREROUTING-d $ INTERNET_IP-p tcp - dport $ REMOTING_PORT - jump DNAT - to-destination $ server_ip
  18. $ IPTABLES-t nat-I PREROUTING-d $ INTERNET_IP-p udp - dport $ REGION_PORT - jump DNAT - to-destination $ server_ip
  19. $ IPTABLES-t nat-I PREROUTING-d $ INTERNET_IP-p tcp - dport $ REGION_PORT - jump DNAT - to-destination $ server_ip
  20.  
  21. # Second, the source NAT: we need it returns the packets to your LAN clients in pasant first by the router,
  22. # Otherwise, the server will try to correspond directly with the client and the client will reject it.
  23. $ IPTABLES-t nat-I POSTROUTING-s-d $ $ LAN_NETWORK server_ip-p tcp - dport $ REMOTING_PORT - jump SNAT - to-source $ INTERNET_IP
  24. $ IPTABLES-t nat-I POSTROUTING-s-d $ $ LAN_NETWORK server_ip-p udp - dport $ REGION_PORT - jump SNAT - to-source $ INTERNET_IP
  25. $ IPTABLES-t nat-I POSTROUTING-s-d $ $ LAN_NETWORK server_ip-p tcp - dport $ REGION_PORT - jump SNAT - to-source $ INTERNET_IP
Advertisement
Add Comment
Please, Sign In to add comment