Thread: How to redirect network traffic to a new IP address using IPtables
hai,
new in networking field. can 1 please tell me how redirect network traffic new ip address using iptables. using baffalo router , rtos used dd-wrt.
basically, want connection going through router specific ip (say, 192.168.11.5) redirected ip (say, 192.168.11.7) outgoing connections made program attempting connect to192.168.11.5 instead connect 192.168.11.7.any appreciated![]()
enable ip forwarding::
add rule telling forward traffic specific port::code:echo "1" /proc/sys/net/ipv4/ip_forward if not works try:: sysctl net.ipv4.ip_forward=1
ask iptables masquerade:code:iptables -t nat -a prerouting -p tcp --dport 1111 -j dnat --to-destination 2.2.2.2:1111
you redirect traffic specific network with, host only:code:iptables -t nat -a postrouting -j masquerade
or whole network::code:# iptables -t nat -a prerouting -s 192.168.1.1 -p tcp --dport 1111 -j dnat --to-destination 2.2.2.2:1111
code:iptables -t nat -a prerouting -s 192.168.1.0/24 -p tcp --dport 1111 -j dnat --to-destination 2.2.2.2:1111
hope
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Networking & Wireless [other] How to redirect network traffic to a new IP address using IPtables
Ubuntu
Comments
Post a Comment