I've got a server running Fedora 15. My end goal is to be able to forward any protocol over random port numbers (specified via iptables rules.) Let's say, for the time being, I want to forward port 12345 to a webserver inside the network. We'll say this webserver is 192.168.0.10:80 .
After adding a rule to iptables to open the port like so:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 12345 -j ACCEPT
I restart iptables, and run:
nmap -p 12000-13000 localhost
nmap doesn't show that the port is open/closed. I then define the port with semanage like so:
semanage port -a -t http_port_t -p tcp 12345
nmap still doesn't see the port.
If I then disable selinux completely, nmap shows the port as "closed".
I can't seem to find a way to open the port. I've been scouring the web for days, and i've not been able to solve the problem. I can provide any other piece of config data you'd like. Any suggestions?
EDIT: Added output of iptables -L -n -v
:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
641 3038K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
12 720 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 261 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:12345
1 52 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 663 packets, 3044K bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:12345