Port forwarding
Hi everyone
I want to forward http 9999 port from ppp0 interface (intenet connection) to port 80 on my local server 192.168.1.10. ppp0 ip is : 124.109.x.x Currently there is no rule for FORWARD, OUTPUT AND PREROUTING Rule for POSTROUTING IS: -A POSTROUTING -o ppp0 -j MASQUERADE routing is also enabled. |
why don't you change the port of your server on which it listens.
Regards. |
I have tried to change the port from 80 to 9999 but face similar problem. I have also allow this port from squid.conf file
|
Quote:
What exactly is your problem, in your this post you said that you want to forward the http 9999 port to http 80. And now you are saying that you tried to change port 80 to port 9999. Need some more info , what exactly you are doing, what is you setup ? |
Quote:
Ideally, you'd also want a FORWARD rule, with your policy set to DROP. The OUTPUT chain is irrelevant here. Example: Code:
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT |
YES I searched many examples and try all including your sample code. but still when i try to open http://124.109.x.x:9999/ it fails to forward the traffic to 192.168.1.10:80
|
Please post the output of:
Code:
iptables -nvL --line-numbers FORWARD Code:
iptables -nvL -t nat --line-numbers Code:
route -n Code:
ifconfig |
[root@server root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0D:56:FE:7D:E7 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:88301 errors:0 dropped:0 overruns:0 frame:0 TX packets:77997 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:78495179 (74.8 Mb) TX bytes:15476553 (14.7 Mb) Interrupt:28 Base address:0xdce0 Memory:fe8e0000-fe900000 eth1 Link encap:Ethernet HWaddr 00:50:BA:D9:4C:B2 inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:74942 errors:0 dropped:0 overruns:0 frame:0 TX packets:104755 errors:0 dropped:0 overruns:17 carrier:0 collisions:0 txqueuelen:1000 RX bytes:16123396 (15.3 Mb) TX bytes:102714434 (97.9 Mb) Interrupt:16 Base address:0x3c00 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1636 errors:0 dropped:0 overruns:0 frame:0 TX packets:1636 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:144722 (141.3 Kb) TX bytes:144722 (141.3 Kb) ppp0 Link encap:Point-to-Point Protocol inet addr:124.109.x.x P-t-P:58.65.175.x Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 RX packets:88035 errors:0 dropped:0 overruns:0 frame:0 TX packets:77729 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:76189959 (72.6 Mb) TX bytes:13440884 (12.8 Mb) **************************************************************************************************** **** [root@pcbserver root]# iptables -nvL FORWARD Chain FORWARD (policy ACCEPT 1403 packets, 92244 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT tcp -- ppp0 eth1 0.0.0.0/0 192.168.1.10 tcp dpt:80 state NEW 28 1326 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ************************************************************************************************* [root@pcbserver root]# iptables -nvL -t nat Chain PREROUTING (policy ACCEPT 7199 packets, 512K bytes) pkts bytes target prot opt in out source destination 0 0 DNAT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:9999 to:192.168.1.10:80 Chain POSTROUTING (policy ACCEPT 1521 packets, 103K bytes) pkts bytes target prot opt in out source destination 7413 448K MASQUERADE all -- * ppp0 0.0.0.0/0 0.0.0.0/0 Chain OUTPUT (policy ACCEPT 8378 packets, 514K bytes) pkts bytes target prot opt in out source destination |
[root@server root]# route -n
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 58.65.175.x 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 58.65.175.x 0.0.0.0 UG 0 0 0 ppp0 |
All times are GMT -5. The time now is 03:27 AM. |