Skip to content

Instantly share code, notes, and snippets.

@ozten
Created June 8, 2012 17:21
Show Gist options
  • Select an option

  • Save ozten/2896996 to your computer and use it in GitHub Desktop.

Select an option

Save ozten/2896996 to your computer and use it in GitHub Desktop.
Mock Out OpenID HTTP traffic
iptables -t nat -F
YourIP=www.google.com
#YourIP=74.125.127.99
# 173.194.79.99
YourPort=80
TargetIP=192.168.186.138
TargetPort=8442
iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort
iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT \
--to-source $YourIP
iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort
YourIP=www.google.com
#YourIP=74.125.127.99
YourPort=443
TargetIP=192.168.186.138
TargetPort=8443
iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort
iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT \
--to-source $YourIP
iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort
iptables -L -t nat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment