Skip to main content

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::

code:
echo "1" /proc/sys/net/ipv4/ip_forward if not works try:: sysctl net.ipv4.ip_forward=1
add rule telling forward traffic specific port::
code:
iptables -t nat -a prerouting -p tcp --dport 1111 -j dnat --to-destination 2.2.2.2:1111
ask iptables masquerade:

code:
iptables -t nat -a postrouting -j masquerade
you redirect traffic specific network with, host only:

code:
# iptables -t nat -a prerouting -s 192.168.1.1 -p tcp --dport 1111 -j dnat --to-destination 2.2.2.2:1111
or whole network::
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

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support