On 04/09/2013 05:36 AM, forensick wrote:
>
> Djh-novell, thanks for the answer!
> djh-novell;2545971 Wrote:
>> forensick wrote:
>>
>>> 2)After learning in some detail the lan procedures of apache, I then
>>> want to implement it in the internet. Because I don’t have the time
>>> (unfortunately) to go where the static ip address is, I thought that
>> it
>>> would be close to implement it using no-ip, which site will somehow
>> be
>>> connected to the pc with apache.
>>
>> You mean that your web server will be somewhere that you are not? (i.e.
>> probably hosted somewhere?) That’s not really a problem as long as you
>> have ssh access to it, or some equivalent. It is important to be able
>> to
>> access a client (browser) that is in a different place to the server on
>> the Internet, so as to check that DNS, and firewalls, and routing etc
>> are all working properly.
>
>
> Sorry I was a little abstract there. I meant, that the final server wil
> be with a static ip address, but I don’t have the time right now to
> set it up as it will be(at the place which have the static ip). So I
> have to “play” with dynamic addresses(at home), although as I can
> understand it will be a little harder.
A few random notes:
Just because you have dynamic IP address one one network normally does not
mean you are prevented from assigning an IP address statically/permanently
to a machine on that network. What happens then? The machine comes up,
binds its IP address, and generally things move along normally. Worst
case, the DHCP server has assigned, or will assign, the same IP to another
system. Sometimes things just work nicely, especially in home networks
where wireless is common, and sometimes one of the two machines will lose
connectivity. Often the DHCP service will detect the duplicate and hand
out something else, if the IP was assigned before DHCP gave it out.
Chances are good that you do not have 200+ machines at home, so just give
out a higher IP address that is unlikely to be given out via DHCP, or
configure DHCP to give out only part of the range (for my system that’s
0-10, since I will likely never have ten dynamic devices on my network at
home) and then the rest are available for you to assign statically.
Also, just to be as clear as possible, for your basic system Apache httpd
does not care, almost at all, about the IP address. Your /etc/hosts file
on the Apache httpd-running server is irrelevant and spending time
tweaking it is not getting you anywhere. All that matters, when it comes
to inter-machine communication, is that layers one, two, three, and four
all work (ignoring layer seven, as it’s irrelevant to this point). In
reverse order:
Layer 4 (TCP): Port (by default) 80 must be listening, unblocked, and
reachable via layer three.
Layer 3 (IP): The IP address, whatever it is, must get to the destination
box (Apache httpd server). This happens via layer two when on the same
network/segment.
Layer 2 (MAC/LLC): The switch/hub involved needs to be able to send the
encapsulated IP data to the right port, usually either by broadcasting
(hub) or by relying on the MAC address (switch). Connecting from the port
to the machine is handled by Layer one.
Layer 1 (physical): Wires must be connected.
Based on your description, all four layers work nicely since, at some
point, you are able to get to the server from a client. Hooray, and now
the next thing you are talking about is all about name resolution (DNS,
layer seven) and accessing the web service (HTTP, layer seven). The HTTP
part already works (the page loads when you specify the correct IP
address) so from there you are either back to using IP addresses directly
or using DNS, whose purpose is to get you an IP address indirectly. Pick
one, use it, move on. In your case for a test system it may be worthwhile
to just use an IP address, preferably a static IP address, but again
Apache httpd really does not care. Look in the httpd.conf or listen.conf
file (/etc/apache2 or somewhere under here) and look for a ‘Listen 80’
line. This basically states that httpd is configured to listen on port
80, but on all addresses, no matter what address is bound to the server.
As a result httpd does not care about the locally-bound address, or
whether it was static or dynamic. There are cases where the IP does
matter, but not in a case as basic as this one, so ignore it for now. You
can confirm that Apache httpd does not care about which IP address is
bound via the netstat command on the server side; chances are good you
will see it bound to 0.0.0.0 (all address) instead of 192.168.1.3 (your
machine’s specific address):
Code:
netstat -planet | grep :80
All you seem to have working is the ability to reliably access your server
from your clients. To do that you have two good choices, and countless
less-good choices (assuming you are able to access the IPs for this
network directly):
- Setup a static IP address for the server and refer to it directly.
- Setup a dynamic IP address for the server and find it to refer to it
directly.
If/When you move to a remote site outside of your local network things
become more interesting, but not terrible if you are using a static IP
address on your home network. The various no-ip services are usually made
to work based on your gateway’s IP address being dynamic, which is not
related to whether or not the internal devices on your internal network
are static or dynamic, so do not confuse the two or you will cause
yourself a lot of needless frustration.
Let’s see where you go from here before typing too much more. To start
out, use static IPs and be sure you understand how access to that server
works, with or without some form of name resolution and then go from there.
Good luck.