Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


migration_temporary_redirect

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
migration_temporary_redirect [2015/04/07 16:03] adminmigration_temporary_redirect [2015/04/07 16:09] – [Temporary redirect traffic to other host] admin
Line 1: Line 1:
 {{tag>[iptables networking linux]}} {{tag>[iptables networking linux]}}
 ~~TOC~~ ~~TOC~~
-=====Temporary redirect to other host===== +=====Temporary redirect traffic to other host===== 
-I've used the steps below to temporary redirect traffic during migration to another host. Tested on CentOS 6.x+I've used the steps below to temporary redirect IP trafficduring migration to another host. Tested on CentOS 6.x
  
-  * Enable forwarding:<code>sysctl net.ipv4.ip_forward=1</code> +  * Configure the kernel to allow forwarding:<code>echo 1 > /proc/sys/net/ipv4/ip_forward</code> 
-  * Forward port:<code>iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 2.2.2.2:443</code>+  * Route traffic to destination:<code>iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 2.2.2.2:443</code>
   * Allow forwarding: <code>iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT   * Allow forwarding: <code>iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
 iptables -A FORWARD -p tcp -d 2.2.2.2 --dport 443 -j ACCEPT</code> iptables -A FORWARD -p tcp -d 2.2.2.2 --dport 443 -j ACCEPT</code>
-  * Masquerade outgoing connection:<code>iptables -t nat -A POSTROUTING -j MASQUERADE</code>+  * Masquerade outgoing connections:<code>iptables -t nat -A POSTROUTING -j MASQUERADE</code>
   * Show active rules:<code>iptables -nvL -t nat</code>   * Show active rules:<code>iptables -nvL -t nat</code>
   * Delete rules:   * Delete rules:
migration_temporary_redirect.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1