LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2009, 03:58 AM   #1
ezalpar
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
port forward


Hi

I have a port forward using iptables (tcp/443) and it's OK. But I can't access any web site that using https. I set my port forwarding with this commands:
iptables -A PREROUTING -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.60.2
iptables -A FORWARD -p tcp -m tcp -d 192.168.60.2 --dport 443 -m state --state NEW -j ACCEPT

thanks in advance for any help
 
Old 11-26-2009, 05:00 AM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
you can't access it from WEB or from LOCAL network?
 
Old 11-26-2009, 05:50 AM   #3
ezalpar
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I can't access https from LOCALNET
 
Old 11-26-2009, 07:23 AM   #4
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
Found on google: http://serverfault.com/questions/741...ip-nat-problem
I either suggest add your hostnames to /etc/hosts as 127.0.0.1 (or your gray IP on the localnet, 192.168.60.2) or setup a DNS server on router and add your domain there and also point it to local IP of your serv so it will be available on all localnet without hacks around /etc/hosts.
i use both methods here. i have server behind NAT(i am NOW behind the NAT with several sites available from internet) and i run recursive DNS on my router(and also it has my domain's records).

Last edited by Web31337; 11-26-2009 at 07:26 AM.
 
Old 11-26-2009, 01:57 PM   #5
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by ezalpar View Post
Hi

I have a port forward using iptables (tcp/443) and it's OK. But I can't access any web site that using https.
What is OK then?

Quote:
Originally Posted by ezalpar View Post
I set my port forwarding with this commands:
iptables -A PREROUTING -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.60.2
iptables -A FORWARD -p tcp -m tcp -d 192.168.60.2 --dport 443 -m state --state NEW -j ACCEPT
I think you have to check manual for iptable rules.
 
Old 11-26-2009, 11:09 PM   #6
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
sorry. misread. but note that info also, if you'll experience that troubles.

this is my config that works: i had same trouble, i could not access ports i forward myself on the net.
Code:
# HTTP:HTTPS
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 443 -j DNAT --to 192.168.60.2
iptables -A FORWARD -p tcp -i ppp0 -d 192.168.60.2 --dport 443 -j ACCEPT
my router is connected with PPTP so ppp0 is my interface with white IP, i guess you'll need eth0 if it's on the net. with this config i am able to contact any computer on the net on port 443.
 
Old 11-27-2009, 04:32 AM   #7
ezalpar
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
problem solved with adding -i eth1 (eth1 my external card) to my rule

thnaks for the answers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
If I forward a port in iptables, does the port have to be open on the firewall? qwertyjjj Linux - Server 4 08-06-2009 09:22 AM
how to port forward talusog Linux - Newbie 5 03-28-2007 01:57 AM
forward port to another on the same IP 5amYan Linux - Security 2 08-23-2005 11:26 AM
A way to forward an IP/Port to another system's IP/Port astroboy5714 Linux - Networking 6 01-26-2004 05:45 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 03:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration