Skip to main content
Add routing info
Source Link
RalfFriedl
  • 2.2k
  • 2
  • 12
  • 12

This is not specific to the PI.

Use this command:

iptables -t nat -A PREROUTING -p tcp -d 192.168.2.93 --dport 19132 -j DNAT --to 192.168.1.101:19132 

Replace tcp with udp if you need UDP.

The options -d and --dport specify the original destination host and port. DNAT means destination NAT, you want a different destination. --to sprcifies that destination. Table nat and chain PREROUTING is the place to do this.

Edit

You also need to make sure the there is a route back to the original host. The easiest way to do that is to point the default route on 192.168.1.101 to the address of the PI, that is the address of the PI on the eth0 interface.

This is not specific to the PI.

Use this command:

iptables -t nat -A PREROUTING -p tcp -d 192.168.2.93 --dport 19132 -j DNAT --to 192.168.1.101:19132 

Replace tcp with udp if you need UDP.

The options -d and --dport specify the original destination host and port. DNAT means destination NAT, you want a different destination. --to sprcifies that destination. Table nat and chain PREROUTING is the place to do this.

This is not specific to the PI.

Use this command:

iptables -t nat -A PREROUTING -p tcp -d 192.168.2.93 --dport 19132 -j DNAT --to 192.168.1.101:19132 

Replace tcp with udp if you need UDP.

The options -d and --dport specify the original destination host and port. DNAT means destination NAT, you want a different destination. --to sprcifies that destination. Table nat and chain PREROUTING is the place to do this.

Edit

You also need to make sure the there is a route back to the original host. The easiest way to do that is to point the default route on 192.168.1.101 to the address of the PI, that is the address of the PI on the eth0 interface.

Source Link
RalfFriedl
  • 2.2k
  • 2
  • 12
  • 12

This is not specific to the PI.

Use this command:

iptables -t nat -A PREROUTING -p tcp -d 192.168.2.93 --dport 19132 -j DNAT --to 192.168.1.101:19132 

Replace tcp with udp if you need UDP.

The options -d and --dport specify the original destination host and port. DNAT means destination NAT, you want a different destination. --to sprcifies that destination. Table nat and chain PREROUTING is the place to do this.