Skip to content

Instantly share code, notes, and snippets.

@ktechmidas
Last active September 1, 2018 16:58
Show Gist options
  • Save ktechmidas/df1624fb2013e6c6fbcc4ca4b4464f4b to your computer and use it in GitHub Desktop.
Save ktechmidas/df1624fb2013e6c6fbcc4ca4b4464f4b to your computer and use it in GitHub Desktop.
iptables -t nat -A PREROUTING -p tcp -i ens5 --dport 80 -j DNAT --to-destination 10.116.23.86:80
----------------------------------------------------------------------------------------------------
- name: redirect http to web
iptables:
table: nat
chain: PREROUTING
in_interface: ens5
protocol: tcp
match: tcp
destination: 10.116.23.86
destination_port: 80
jump: REDIRECT
to_ports: 80
comment: Redirect web traffic to web server - http
---------------------------------------------------------------------------------------------------
target prot opt source destination
DNAT tcp -- anywhere anywhere tcp dpt:http to:10.116.23.86:80
REDIRECT tcp -- anywhere ip-10-116-23-86.ap-northeast-2.compute.internal tcp dpt:http /* Redirect web traffic to web server - http */ redir ports 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment