You are not logged in.

#1 2013-06-14 18:13:14

Nathan
Member
Registered: 2008-12-27
Posts: 34

Need hep forwarding port across interfaces

I have a raspberry pi running XBMC plugged into one interface over a crossover cable. Both have static IPs set up. I want to forward incoming traffic to the computer on port 8080 to the raspberry pi so I can control it from my phone. As it currently is, nothing can communicate with the pi besides the computer it is plugged into.

I tried various guides on how to forward ports but I couldn't get any of the iptables rules to work. I flushed between each attempt, but nothing did anything. The computer is plugged into the main router on enp3s0 and the pi on enp5s6.

Any help? I really have no idea what I'm doing.

Offline

#2 2013-07-29 05:31:13

sbmomeni
Member
Registered: 2013-07-26
Posts: 29

Re: Need hep forwarding port across interfaces

Did you try setting "net.ipv4.ip_forward = 1" in sysctl?
Also you can use ssh port forwarding (if you just want to forward one port) as follows:

ssh -L yourip:8080:127.0.0.1:8080 username@ip-of-the-XBMC-machine

Then you can connect to yourip:8080 instead of connecting to XBMC's ip.

Offline

#3 2013-07-29 05:35:17

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: Need hep forwarding port across interfaces

Including exactly what you've tried would help, because you've probably already tried this, but this is what should do it:

echo 1 > /proc/sys/net/ipv4/ip_forward 
iptables -t nat -I PREROUTING -i enp3s0 -p tcp --dport 8080 -j DNAT --to 192.0.2.1
iptables -I FORWARD -i exp3s0 -p tcp --dport 8080 -d 192.0.2.1 -j ACCEPT

Replace 192.0.2.1 with the actual IP Address of the Pi

Offline

Board footer

Powered by FluxBB