2

I'm using my server as NAT/router, which works well. But now I'm trying to forward port 3478, which I can't get to work.

eth0 = public interface
eth1 = private network

$ cat /proc/sys/net/ipv4/conf/eth0/forwarding
1
$ cat /proc/sys/net/ipv4/conf/eth1/forwarding
1

Then to forward port 3478 to 10.0.0.7, I read somewhere that I should run

iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 3478 -j DNAT --to-destination 10.0.0.7:3478
iptables -A FORWARD -p tcp -d 10.0.0.7 --dport 3478 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

I also ran

ufw allow 3478

But testing port 3478 with http://www.canyouseeme.org/ doesn't work. Any idea what I have done wrong?

Magellan
  • 4,451
  • 3
  • 30
  • 53
Markus Hedlund
  • 1,127
  • 2
  • 19
  • 33

1 Answers1

1

I use port forwarding (and working) on Ubuntu server with:

#NAT:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 3478 -j DNAT --to 10.0.0.7

#FORWARD:
iptables -A FORWARD -p tcp -i eth0 -d 10.0.0.7 --dport 3478 -j ACCEPT
Said Torres
  • 103
  • 3
laurent
  • 2,055
  • 16
  • 14