Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I have a web server setup on my computer, and wish to be able to access this both from the internet AND my LAN. The problem is that if i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790

    Accessing websites on my computer and internet


    I have a web server setup on my computer, and wish to be able to access this both from the internet AND my LAN. The problem is that if i type my internet ip address of my router this doesn't work! Now i know i can just type localhost or the ip of my machine! But i'm trying to get phpBB viewable from both the LAN and the internet. But there's a setting in phpBB that doesn't allow this to be the case.... Now is there a way to tell my computer that when the internet side of my router is called just to goto local host at all? A mate suggested using a DNS server on my computer, but i can't figure this out, and i remembered today about the /etc/hosts file. What would i need to add in to this to get it to work?
    Code:
     <global ip> localhost
    doesn't work.....

    Any ideas?

    Thanks in advance!
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  2. #2
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    Add the address to your /etc/hosts file like so
    Code:
    127.0.0.1 http&#58;//my-domain.com

  3. #3
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    Quote Originally Posted by Giro
    Add the address to your /etc/hosts file like so
    Code:
    127.0.0.1 http&#58;//my-domain.com
    'http://my-domain.com' this being an internet address? The way people access my site is thru ip address, i not got an internet domain name. would i have to setup an internet domain name for this to work?
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Can you describe you network setup a bit more on detail? Especially, what kind of router is it and how have you set it up?

  6. #5
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    ok! I'm in a uni halls, with bout 10 computers on the network connected through switches. It doesn't matter bout the rest of the computers seeing the site as it's only me that will b usin it inside the lan. I got a D-Link DSL-504 router/ADSL modem/4-port switch. This connects the internet connection to the network. I have setup port forwarding on port 80 to my computer, and port 85 to a friends computer (for another web server). If you need more, let me know.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  7. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'm guessing this router is a NAT router, right?

    I don't know what IP mangling policy this D-Link router has, but since your symptoms very closely describe those you will get if you have a NAT router running Linux, it may very well be that that is the problem.

    See, when you try and connect to your own web server using the external IP of the router is that your computer sends a SYN packet to the router. The router, which has port forwarding set up, changes the destination address to that of the web server. Since the destination address is internal, it does, however, not attempt NAT and change the source address. That way, what your web server will receive is a SYN packet which has the destination address of the web server and the source address of the browser (which in your case would be the same address). Thus, when the web server responds, it sends a SYN,ACK packet to the address which was the source address in the original SYN packet. That is, it sends the response directly back to the browser. The browser doesn't expect a packet coming from the web server, though. It expects a resonse coming from the external IP of the router. Therefore, it simply disregards that response, since it has no idea what connection to map it to.

    When using a Linux router, this is very simple to fix by just making it perform DNATting as well as SNATting on the original SYN packet. I'm not sure that it's even possible to remedy using a hardware router, though. That is yet another reason why I'd never use a hardware router.

    NAT was never supposed to be, and IP wasn't ever designed to support it. Normally, it happens to work relatively good, but this is one of the problems that are caused by it. Let's hope that we all can migrate to IPv6 soon.

    What you could do is use one of those anonymous surfing sites to access your phpBB from inside the LAN. It will connect back itself, making the process just like someone from the outside connected to you.

  8. #7
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    What you could do is use one of those anonymous surfing sites to access your phpBB from inside the LAN. It will connect back itself, making the process just like someone from the outside connected to you.
    What do you mean by an anonymous surfing sites?

    I guess the EASIEST solution would be to host the forum elsewhere, but i have no money to do this.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  9. #8
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    I beleve Dolda is refering to sites like this -> http://anon.free.anonymizer.com/http://www.google.com

  10. #9
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Yeah, that's what I was thinking of. I usually use anonymization.net.

  11. #10
    Linux User
    Join Date
    May 2003
    Location
    CA
    Posts
    370
    what do you exactly mean by "source address of the browser"?? are you implying the source address from the machine where the browser is running?
    could you please be a bit clearer..much appreciated!!
    Fixing Unix is better than working with Windows.
    http://nikhilk.homedns.org/projects/index.html

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •