assigning IP & FTP addresses

Discussion in 'Installation/Configuration' started by swggy, May 12, 2007.

  1. swggy

    swggy New Member

    This is such a simple/basic question that either noone else needs to know the answer, or I can't find the answer on the forums because the search terms I would use are so general - so sorry if you've already answered, and please point me at the original answer.

    I'm trying to do something that requires PHP 5.0 & my internet web host only supports 4.0. So I used the CentOS 5.0 howto to install a webhosting system for myself (behind the router). Even though I'm a complete Linux newbie I got all the way through, and then found the instructions elsewhere to load ISPConfig which worked. Incredible!

    So I went into ISPConfig to create a site that I could access & develop, and this is my issue - what IP address should I use for this new site? and what address do I FTP into? I read through the ISPConfig doc and it didn't specify.

    I tried putting in the server's IP address just to see what happened, and predictably it returned the message
    I'd rather not share 192.168.1.101 - can I create a new address, like 192.168.1.140? It's not on the 'net, so I can use what numbers I want, true? What would I need to do for that? I tried adding it (I've got Webmin loaded) using the network configuration, but it wasn't recognised.

    Further, the site I created in ISPConfig - www.swggy.com - wasn't recognized either...I thought I'd at least get a splash screen or an 'under construction' placeholder, but I only get an error.

    Lastly, trying to FTP into the site was also a failure. I tried various configurations of addresses - ftp://ftp.swggy.com, ftp://www.swggy.com, ftp://swggy.com, ftp.swggy.com, ftp://192.168.1.101, etc - but nothing worked.

    Thanks for any help...
    swggy
     
  2. iam8up

    iam8up New Member

    I'm not familiar with ISPConfig, but the first thing I thought when I read that error is that it is using virtual hosts. Open up a prompt and ping those different hosts - ftp.swggy.com, www.swggy.com, swggy.com - and post if those resolve to this 192.168.1.101

    What I believe is happening is the IP is not set to a virtual host, while those different hosts (ftp.swggy.com) is, but your DNS server is not resolving them.

    I'm betting anything you're on a Linksys router using 192.168.1.1, the Linksys, as a dnsmasq. Use nslookup to see if your CentOS 5 box is running named and if so, set your DHCP server in your Linksys to use it for DNS.
     
  3. swggy

    swggy New Member

    Well, I have your answer, but I'm no furtherer forard ...

    1. yes, I'm behind a Linksys router - WRT54G.
    2. When I installed CentOS I named it 'server.myname.org'.
    3. I can't see anywhere in Linksys to tell it to use the server for DNS, but
    I've turned off DHCP there.
    4. I've pinged the various hosts and get the following from my Windows box:
    Code:
    C:\DOCUME~1\STEVE>ping www.swggy.com
    Ping request could not find host www.swggy.com. Please check the name and try again.
    
    C:\DOCUME~1\STEVE>ping 192.168.1.101
    
    Pinging 192.168.1.101 with 32 bytes of data:
    
    Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
    Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
    Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
    Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
    
    Ping statistics for 192.168.1.101:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    
    C:\DOCUME~1\STEVE>ping swggy.com
    Ping request could not find host swggy.com. Please check the name and try again.
    
    
    C:\DOCUME~1\STEVE>ping ftp.swggy.com
    Ping request could not find host ftp.swggy.com. Please check the name and try again.
    
    and this from the server using PuTTY:
    Code:
    [root@server ~]# ping www.swggy.com
    PING www.swggy.com (192.168.1.140) 56(84) bytes of data.
    From server.sgwilt.org (192.168.1.101) icmp_seq=1 Destination Host Unreachable
    From server.sgwilt.org (192.168.1.101) icmp_seq=2 Destination Host Unreachable
    From server.sgwilt.org (192.168.1.101) icmp_seq=3 Destination Host Unreachable
    
    --- www.swggy.com ping statistics ---
    6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5001ms
    , pipe 3
    [root@server ~]# ping 192.168.1.101
    PING 192.168.1.101 (192.168.1.101) 56(84) bytes of data.
    64 bytes from 192.168.1.101: icmp_seq=1 ttl=64 time=0.081 ms
    64 bytes from 192.168.1.101: icmp_seq=2 ttl=64 time=0.042 ms
    64 bytes from 192.168.1.101: icmp_seq=3 ttl=64 time=0.041 ms
    64 bytes from 192.168.1.101: icmp_seq=4 ttl=64 time=0.041 ms
    
    --- 192.168.1.101 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    rtt min/avg/max/mdev = 0.041/0.051/0.081/0.017 ms
    [root@server ~]# ping swggy.com
    ping: unknown host swggy.com
    [root@server ~]# ping ftp.swggy.com
    ping: unknown host ftp.swggy.com
    
    So ... how does one go about setting up a new ip address (in this case 192.168.1.140) and assigning it to www.swggy.com & ftp.swggy.com?

    Thanks...
     
  4. iam8up

    iam8up New Member

    You turned off DHCP on your Linksys? What is offering you DHCP? Or are you setting your IP addresses all statically?

    Do an ipconfig /all and paste that here. This will help greatly. What you've said proved my theory. Your hosts file nor DNS servers have those records for the different domains & subdomains. Once you get this issue resolved I'm betting that it will fix your "unable to FTP" problems.

    Those different hostnames, as far as your Windows box is concerned, are non-existant, which is why it says "could not find host". Again, use nslookup and see if your CentOS 5 box is running named or whatever DNS server.
     
  5. Leszek

    Leszek Member

    First of all in my opinion You don't need ISPConfig just to test php scripts.You can do it with a "simple" LAMP solution with an ftp server.

    You should use Your server's IP address for this site and the same address or domain name for ftp connections.
    You have typed the server's IP address in Your browser and saw a normal page saying that You can view the sites on the server by entering their domain names.This is because ISPConfig uses name based virtual hosts on Apache.
    If You enter the server's IP address with the port number specified You should connect to the ftp server,ex. 192.168.1.100:21 but I recommend using a typical and more convenient ftp client.Then You won't have to type the port number.

    You see that the IP is shared because virtual hosts can provide lots of sites using only one IP so You don't have to change anything.

    To use addresses like www.domain.pl to work You need a domain name or some modifications in Linux's /etc/hosts file and C:\SYSTEM\system32\drivers\etc for Windows XP.If You want to let everyone see Your site on the Internet the server will need a public IP address and port forwarding configured on Your router (if the server is on a LAN).Next thing You would need is a domain name.It's records can be configured on a dns server so that You can have addresses pointing to certain services on the server like ftp.domain.pl or mail.domain.pl etc.
     
    Last edited: May 13, 2007
  6. swggy

    swggy New Member

    Thenks for the response, iam8up.

    Remember, I'm a complete newbie, but my interpretation of your statement
    was that I should change something in the DHCP setting on the router. The only thing I can see to do here is to turn it off (although I turned it back on after I replied to you). And yes, I'm setting IP addresses statically - that is, I put the IP address 192.168.1.101 into the server when I built it, and can see the address doesn't (appear) to change. This I presume is because the LAN cable is plugged into the back of the router, and the router always assigns the same addresses to the hardwired ports.

    'ipconfig' is not recognised by bash, so I assume you meant run it on the DOS command under Windows:
    Code:
    Microsoft(R) Windows DOS
    (C)Copyright Microsoft Corp 1990-2001.
    
    C:\DOCUME~1\SWG>ipconfig /all
    
    Windows IP Configuration
    
            Host Name . . . . . . . . . . . . : office
            Primary Dns Suffix  . . . . . . . : myname.org
            Node Type . . . . . . . . . . . . : Unknown
            IP Routing Enabled. . . . . . . . : No
            WINS Proxy Enabled. . . . . . . . : No
            DNS Suffix Search List. . . . . . : myname.org
    
    Ethernet adapter Local Area Connection:
    
            Connection-specific DNS Suffix  . :
            Description . . . . . . . . . . . : VIA Rhine II Fast Ethernet Adapter
            Physical Address. . . . . . . . . : 00-16-EC-C5-69-EE
            Dhcp Enabled. . . . . . . . . . . : Yes
            Autoconfiguration Enabled . . . . : Yes
            IP Address. . . . . . . . . . . . : 192.168.1.100
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 192.168.1.1
            DHCP Server . . . . . . . . . . . : 192.168.1.1
            DNS Servers . . . . . . . . . . . : 192.168.0.1
            Lease Obtained. . . . . . . . . . : Saturday, May 12, 2007 3:10:26 AM
            Lease Expires . . . . . . . . . . : Sunday, May 13, 2007 3:10:26 AM
    
    C:\DOCUME~1\SWG>
    Running nslookup on Windows I get
    Code:
    C:\DOCUME~1\SWG>nslookup 192.168.1.101
    *** Can't find server name for address 192.168.0.1: Non-existent domain
    *** Default servers are not available
    Server:  UnKnown
    Address:  192.168.0.1
    
    *** UnKnown can't find 192.168.1.101: Non-existent domain
    
    C:\DOCUME~1\STEVE>
    and it gives the same response for 100 (the Windows PC).

    Running it on bash I get
    Code:
    [root@server ~]# nslookup 192.168.1.100
    Server:         192.168.1.101
    Address:        192.168.1.101#53
    
    ** server can't find 100.1.168.192.in-addr.arpa: NXDOMAIN
    
    [root@server ~]# nslookup 192.168.1.101
    Server:         192.168.1.101
    Address:        192.168.1.101#53
    
    ** server can't find 101.1.168.192.in-addr.arpa: NXDOMAIN
    
    [root@server ~]#
    
    There has to be something incredibly simple that I've missed - there always is. Thanks again...
     
  7. tristanlee85

    tristanlee85 New Member

    What you do is when creating the site, when you get to the drop-down menu to choose the IP address to use, make sure it's your internal (server's) IP).

    [​IMG]

    Then, go to the DNS manager, click on the domain, and click the "Records" tab. Your hosts listed there will have your internal IP (192.168.1.* or whatever). You must click on the IP address, and then change the A record IP address to your WAN address. That way, when people go to your site, the A record will point to your server, and once it gets to the server, it knows to use your internal IP address.

    [​IMG]
     
  8. iam8up

    iam8up New Member

    I should've been more specific...

    DNS is how you turn your www.swggy.com into 192.168.1.140. Your DHCP server is 192.168.1.1 as is you gateway, so you obviously have not turned DHCP off on your Linksys. The weird thing is, your DHCP server is offering 192.168.0.1 as your one and only DNS server - I don't see how you could be resolving names. What kind of a device is supply your Linksys with Internet? What ISP do you have?

    Code:
    C:\>nslookup
    Default Server:  [I]something[/I]
    Address:  192.168.0.1
    
    > server 192.168.1.140 [Your Linux box]
    
    > www.swggy.com
    *** [I]something[/I]
    Again, I think you need to change your Linksys DHCP server to offer 192.168.1.140 for a DNS server for your records. Besides this, you can disable DHCP on your Linksys and install/configure DHCP on your Linux box.

    If you don't know how to do this let me know, and in the meantime do this...

    Start -> Run -> notepad %SYSTEMROOT%\system32\drivers\etc\hosts

    At the bottom type...
    192.168.1.140 www.swggy.com
    192.168.1.140 ftp.swggy.com
    192.168.1.140 swggy.com

    Then save and exit. At this point test your ftp ftp.swggy.com - should work if I'm right. Let me know.
     
  9. iam8up

    iam8up New Member

    This would not do anything for him. His Linksys is not telling his Windows box to look at his Linux box for DNS.
     
  10. swggy

    swggy New Member

    Got it!

    OK I got it! I've gone back into ISPConfig and deleted the swggy site (and flushed the trash) and then added it from scratch.

    I could then access www.swggy.com in firefox if I run the browser on KDE on the server, but couldn't access it from Windows - pretty conclusive evidence that you were right about the XP setup not being able to find the name.

    I could also now ftp into swggy.com from the Linux box - oddly enough, by putting 'www.swggy.com' as the target, rather that 'ftp.swggy.com' which doesn't work at all. I couldn't ftp from the Windows box.

    Once I saw your latest on putting the domain with 'ftp' into the hosts file & did that, everything started working fine. Staggeringly simple as I knew it had to be.

    And since (I'm theorizing) the host file is checked before DNS lookup, that's why it's now working. I'm left with the question of how to add swggy to the BIND DNS server, but I don't need that for this project.

    So now I'm down to one problem that seems as if it should be easily fixable. When I try to access the pages with www.swggy.com it's looking for files in this directory:

    /var/www/web6/web

    ... and in fact displays the file /var/www/web6/web/index.html as my homepage, including the line "Welcome to www.swggy.com!" hardcoded.

    But when I upload files with ftp, they go into this directory:

    /var/www/web6/user/web6_swggy/web

    Now I know that Apache uses /var/www as the default base for users. ISPConfig adds the /web6 (because this is the 6th time I've built the setup in ISPConf, I guess). But ISPConf requires that a username is created and inserts the /user/web6_swggy string into the directory path.


    So the question now is - how to reconcile the 2 paths?
     
  11. swggy

    swggy New Member

    Well, I fixed that one, but I may have done something unwise in the process.

    I reasoned thusly: The ftp location

    /var/www/web6/user/web6_swggy/web

    seemed correct, in that it was set up for multiple possible websites/accounts; the www location

    /var/www/web6/web

    seemed as if it would cause a collision - every website in web6 would put its files in the same directory. So I concluded that the PROFTPD server's files were correct, and that Apache's were wrong - (not that Apache itself was wrong, just that ISPConfig's adjustment to it was wrong).

    So I went into Webmin's Apache server interface and found the virtual server for swggy.com - which said that the document root was indeed /var/www/web6/web. I changed it to be the same as the ftp directory, restarted Apache and got my web page.

    The thing that has me worried about this is that I think it unlikely that ISPConfig's interface to Apache is wrong, whilst I think it highly likely that I've hosed something somewhere. Further, any time I regenerate the entries in ISPConfig, the index will bump up and I'll have to go back into Apache and correct it. Finally, I'm aware that the thought of making any adjustments to Apache config files as a newbie is verging on lunacy.

    So my question from earlier remains ... what is the correct way to reconcile those two paths?

    Thanks for your help ...
    swggy.
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    As you guessed already, ISPConfig is configuring everything for you without the need to changing any configuration file or useing webmin :)

    You just missed to enable the "administrator" checkbox for the user that shall be the admin of the website. ISPconfig changes the home directory of this user then to be the root directory of the website.
     
  13. swggy

    swggy New Member

    That was it, thanks - I'm in business.
     

Share This Page