LinuxQuestions.org
Help answer threads with 0 replies.
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 07-12-2005, 03:28 AM   #1
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
iptables+FQDN


hello all
can i use fully qualified domain name or domain name only while applying
iptables firewall. i am going to use dnat so is this possible. my internet ip is 195.148.68.49 which is eth1 and the lan ip eth0 is 192.168.0.1. 192.168.0.200 is a webserver. Let's say i am hosting a web site named abc.com. on 192.168.0.200. This is a registered domain. then can i do the following??

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth1 -d www.abc.com --dport 80 -j DNAT --to www.abc.com:80
/sbin/iptables -A FORWARD -p tcp -i eth1 -d 192.168.0.200 --dport 80 -j ACCEPT
 
Old 07-12-2005, 03:59 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
A rule will load with as many ip numbers as it can find for the domain name..

Usually, many domains use one ip number, so it's better to make the rule with numbers.
 
Old 07-12-2005, 05:03 AM   #3
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Original Poster
Rep: Reputation: 30
then i think it will create a problem because

in the httpd.conf file i will be doing the following

<VirtualHost 192.168.0.200>
ServerName abc.com
DocumentRoot /var/www/html/abc
</VirtualHost>

Now let's say that i want to host one more site . Then in this case if my iptables rule will be in number then the first priority will be given to abc.com. Then i can't use DNAT for the other site. any solutions...
 
Old 07-12-2005, 07:54 AM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
No problem..

iptables handles the ip number forwarding to find the server, and the apache conf file handles the many virtual names in the server. Each virtual server definition will be for a different site, so rather than doing <VirtualHost 192.168.0.200> do <VirtualHost www.abc.com>
 
Old 07-12-2005, 08:02 AM   #5
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Original Poster
Rep: Reputation: 30
Thanks peter_robb

I will try it out.

But tell me if i can use FQDN for DNAT.
 
Old 07-12-2005, 08:10 AM   #6
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Sure can.. It will work..
Quote:
A rule will load with as many ip numbers as it can find for the domain name..
but expect strange results.. YMMV
 
  


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
Dnat+fqdn roopunix Linux - Networking 5 07-28-2005 08:13 AM
server FQDN help namboi Linux - Newbie 6 05-07-2005 02:20 PM
ip as my fqdn? sortia Linux - Networking 6 04-27-2005 09:46 AM
Fqdn ziox Linux - Networking 0 10-06-2004 05:46 PM
FQDN - not darb Linux - General 1 10-04-2004 03:57 PM

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

All times are GMT -5. The time now is 08:20 AM.

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