Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 19/20 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 19th December 2005, 01:15 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Interesting Problem with Router Hijacking Internal Traffic

Hey Guys

I'm using a Belkin Router at home which my server is behind the only problem with it is it doesnt allow (forgive me) I think its Loopback or something like that I saw on a webpage.

So everyone can view my sites great from the internet but if the router picks up any traffic from inside my home network (for instance if I type www.mydomain.co.uk) I just get the control panel for my router.

I can still view the default server by typing the local IP of the server but I also have virtual servers running and I need a way to test them.

Does anyone know how I can view sites on my virtual servers internally?

Thanks for taking the time out to read this - Karl
Reply With Quote
  #2  
Old 19th December 2005, 01:48 AM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
Quick and Dirty workaround...

Edit your /etc/hosts file and put in the internal address for the virtual host you want to test. Example:

192.168.100.10 www.myvirtualserver.com

Your hosts file will be read first when resolving the domain name and you will bypass your router to check out your virtual servers.
Reply With Quote
  #3  
Old 19th December 2005, 02:03 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Thank you so much for your reply.

Is that the hosts file on the server or the (windows) machine on my network that I'm developing sites on?
Reply With Quote
  #4  
Old 19th December 2005, 02:27 AM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
It is the hosts file on the machine you are trying to view the site from. So if your webserver is the Linux box and you are trying to test it/view it from your Windows machine you would want to edit the hosts file on your Windows machine.

Assuming Windows XP:
c:\windows\system32\drivers\etc\hosts
Reply With Quote
  #5  
Old 19th December 2005, 02:29 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Ah I see, but then wouldnt it just display the default site on the server?
How does it know to access the virtual host?

Thanks again for the reply
Reply With Quote
  #6  
Old 19th December 2005, 02:35 AM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
When your browser tries to connect it is still going to send the URL you type in the browser to your server, only when it tries to resolve the name of the site it will look it up in your hosts file and send the request to the internal IP of the webserver. The webserver will see the incoming name from the browser request and your virtual hosts will work fine.

I use this all the time when testing sites in a similar manner to what it sounds like you are trying to do.

Now, I have assumed one thing. That your webserver actually has an internal IP address and that your router in question forwards a public address back to your internal web server. Perhaps I assumed too much.
Reply With Quote
  #7  
Old 19th December 2005, 02:40 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Ive set up port forwarding if thats what you mean?

lol thanks again ive been stressing over this for days !
Reply With Quote
  #8  
Old 19th December 2005, 02:54 AM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
Quote:
Originally Posted by ServerTroubles
Ive set up port forwarding if thats what you mean?
Correct, I assume you have a router/firewall handling your Internet connection that is taking traffic directed to it on port 80 and forwarding it back to the Linux server on your internal LAN with an internal private address, perhaps a 192.168.x.x or 10.x.x.x address.

So if you update the hosts file on your internal machine it should point the domain name(s) in question to the 192.168.x.x or 10.x.x.x. address of the webserver.
Reply With Quote
  #9  
Old 19th December 2005, 03:02 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Well, it works a treat.. but its just passing everything to the default server.
Does this mean I have my virtual server set up wrong?
Reply With Quote
  #10  
Old 19th December 2005, 03:10 AM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
If your virtual servers are working for people outside your network then it is probably more likely that your hosts file isn't right.

Your hosts file entry should match the ServerName entry under your virtual hosts setup.

For example, say your internal IP of your webserver is 192.168.100.10 and your ServerName directive in httpd.conf is www.virtualserver.com.

Then your hosts file should look something like this:

192.168.100.10 www.virtualserver.com

Now if your virtual server setup isn't working from outside the LAN then there is probably something wrong with your virtual server setup.
Reply With Quote
  #11  
Old 19th December 2005, 03:18 AM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Thanks again mate, I sent you a PM
Reply With Quote
  #12  
Old 19th December 2005, 12:36 PM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Hi Guys

This is the virtual hosts section from my httpd.conf file can anyone see where i'm going wrong?

### Section 3: Virtual Hosts
#

# VirtualHost: If you want to maintain multiple domains/hostnames on your

# machine you can setup VirtualHost containers for them. Most configurations

# use only name-based virtual hosts so the server doesn't need to worry about

# IP addresses. This is indicated by the asterisks in the directives below.

#

# Please see the documentation at

# <URL:http://httpd.apache.org/docs-2.0/vhosts/>

# for further details before you try to setup virtual hosts.

#

# You may use the command line option '-S' to verify your virtual host

# configuration.


#

# Use name-based virtual hosting.

#



# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts






# Logs
































#

# Virtual hosts

#


# Virtual host Default Virtual Host

<VirtualHost *>







ServerSignature email


DirectoryIndex index.php index.html index.htm index.shtml
LogLevel warn
HostNameLookups off





</VirtualHost>




#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories).

#

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

#


<Directory "/">

Options FollowSymLinks


AllowOverride None




</Directory>



<Directory "/var/www/html">

Options Indexes Includes FollowSymLinks


AllowOverride None

Allow from all



Order allow,deny
</Directory>



<Directory "/var/www/icons">

Options Indexes MultiViews


AllowOverride None

Allow from all



Order allow,deny
</Directory>



<Directory "/var/www/cgi-bin">

Options ExecCGI


AllowOverride None

Allow from all



Order allow,deny
</Directory>



<VirtualHost *>

DocumentRoot /home/sites/mydomain.co.uk

ServerName www.mydomain.co.uk

<Directory "/home/sites/mydomain.co.uk">

allow from all
Options +Indexes

</Directory>

SuexecUserGroup user usergroup

</VirtualHost>



Thanks guys
Reply With Quote
  #13  
Old 19th December 2005, 01:53 PM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
In your httpd.conf file make sure the following line in uncommented:

NameVirtualHost *:80

Let us know how that goes.
Reply With Quote
  #14  
Old 19th December 2005, 02:07 PM
ServerTroubles Offline
Registered User
 
Join Date: Dec 2005
Location: Sheffield - UK
Posts: 28
Well, it wasnt in there so I added it into the start of the virtual hosts section.
But it still doesnt work, is it supposed to go further up?
Reply With Quote
  #15  
Old 19th December 2005, 02:26 PM
IronWolf Offline
Registered User
 
Join Date: Dec 2005
Posts: 198
I assume you restarted Apache after adding the line?

If so, try this as your Virtual Host:

Code:
<VirtualHost *:80>
   ServerName www.mydomain.co.uk
   SuexecUserGroup user usergroup
   DocumentRoot "/home/sites/mydomain.co.uk"
      <Directory "/home/sites/mydomain.co.uk">
       allow from all
       Options +Indexes
       </Directory>
</VirtualHost>
Reply With Quote
Reply

Tags
hijacking, interesting, internal, problem, router, traffic

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
interesting su problem joesmith Using Fedora 1 27th September 2008 10:46 PM
Traffic counter for an internal client and_woox Servers & Networking 1 9th April 2008 12:11 AM
pppoe router and internal network lose internet connection when ppp0 IP is changed ionutv202003 Using Fedora 0 21st November 2006 06:29 PM
Interesting FTP problem aaron01 Servers & Networking 1 13th March 2005 10:26 AM


Current GMT-time: 13:10 (Saturday, 26-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat