Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/hosts and other related config file confusion
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
maxvenum
n00b
n00b


Joined: 02 Mar 2006
Posts: 10
Location: Milpitas, CA

PostPosted: Thu Mar 02, 2006 8:17 am    Post subject: /etc/hosts and other related config file confusion Reply with quote

Greetings!

I have been reading through the forums and web for a few days now, trying to understand how to properly set up my gentoo server's /etc/hosts, domainname, and hostname files (and probably some others I have forgotten). I am still relatively new to gentoo, and would appreciate any help people can give.

Here is my setup:

DSL modem on ppp0, eth0 connected to ppp0, eth1 connected to internal network. DSL ip is dynamic, internal network ips static. eth1 ip is 192.168.0.3, and eth0 is currently set to 172.0.0.1 (why is explained below). I have a dns address through dyndns: name.homelinux.com. My hostname is name2 (my other systems are name3, name4, etc.). I plan to run apache2 and a ftp server on this box. For apache2 and the ftp server, it seems to me that I should be using the dns address in the config files, but I have also heard that the dns address must be locally resolvable? How should I setup my /etc/hosts file, nssswitch.conf file, etc.? Have I left out any other pertinent information?

Here is a side issue: my dsl modem is set to 192.168.0.1 (I haven't seen how to change that to something other than 192.168.0.0/24), and I wanted to use 192.168.0.0/24 for my internal network with my internal ethernet card set to 192.168.0.3. However, if I do this, my gentoo server gets confused and will only talk to one interface, so I had to change my external ethernet card's ip address away from 192.168.0.3 to 172.0.0.1. I recently had the realization that I could simply change my internal network to 192.168.1.0/24, but I don't want to do this to avoid my own confusion and stupid mistakes (I have used 192.168.0.0/24 for years, and if I change that, I may not always remember that when I am working with my network--my brain will default to 192.168.0.0/24...) Is there anyway I can keep my internal network on 192.168.0.0/24?

Thanks,
Tobyn
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Thu Mar 02, 2006 8:40 am    Post subject: Reply with quote

Hi

I would simply plug your Modem to the switch, pull out the second nic out of the Server, and you will be able to use your old subnet! :wink:
pppoe is encapsulated, so it should not affect you lan!

For Apache and FTP, i would simply add your ddns-name to the 127.0.0.1 entry in /etc/hosts (do not wipe out localhost!)! This should do the job!

I hope this will help a bit!
_________________
Power to the people!
Back to top
View user's profile Send private message
maxvenum
n00b
n00b


Joined: 02 Mar 2006
Posts: 10
Location: Milpitas, CA

PostPosted: Thu Mar 02, 2006 9:22 am    Post subject: Reply with quote

You can plug the modem straight into the hub (hub, not switch--I have a 4-port wireless router)? I could get rid of one of my NICs? I did not realize that. Since you normally plug the modem straight into the computer's NIC, do you need a crossover cable from the modem to the hub? Is there any security problem doing it this way? Since the modem is now attached directly to my LAN, is there any reasonable way someone could get to my network without going through the computer hosting pppoe?


I have already added my ddns name to the 127.0.0.1 line in /etc/hosts but to no avail. I have tried different variations for that line. My current variation is:

127.0.0.1 name2@name.homelinux.com name2 localhost

My apache2 and ftp servers are running; I am able to access them using my ip address (both internal 192.168.0.3 and modem ip) from within the network. Though, now that I think about it, I haven't tried accessing my servers from outside my network. I will try that when I get to work in the morning.

Thanks,
Tobyn
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Thu Mar 02, 2006 9:43 am    Post subject: Reply with quote

Quote:
do you need a crossover cable from the modem to the hub?
yes, normally, but perhaps the hub switches automatically... try it, and if the light goes on, it will work! :wink:
Quote:
Is there any security problem doing it this way? Since the modem is now attached directly to my LAN, is there any reasonable way someone could get to my network without going through the computer hosting pppoe?
I would say no, as it is encapsulated... I had it that way for over 3 years and never ran into trouble...

you have an @ in your dns-name?!? there must be something wrong! I would try name2.name.homelinux.com...
But if you can reach it via your external adress, and your dyndns works, it should work, even without the /ets/hosts entry...
_________________
Power to the people!
Back to top
View user's profile Send private message
maxvenum
n00b
n00b


Joined: 02 Mar 2006
Posts: 10
Location: Milpitas, CA

PostPosted: Mon Mar 06, 2006 1:17 am    Post subject: Reply with quote

Thanks for the help. I saw many different variations on the hosts config file, and one of them used an @. I will see if trying name2.name.homelinux.com works any better. I was able to check my servers from work, and I am able to access both my ftp and apache2 servers using the ddns address. So, my problem is accessing my servers from within my network using the ddns address (using ip address works). I remember seeing some discussions on this forum, but I don't remember seeing if a real solution was found. Anyone have any advice on this? Would the easiest thing be to add a special rule in my iptables chains?

Thanks,
Tobyn
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 918
Location: Switzerland

PostPosted: Mon Mar 06, 2006 9:48 am    Post subject: Reply with quote

Quote:
I was able to check my servers from work, and I am able to access both my ftp and apache2 servers using the ddns address. So, my problem is accessing my servers from within my network using the ddns address (using ip address works).

Try to add your DDNS-Name on every host in lan to /etc/hosts with DDNS-Name and internal IP... Or even Better, if you have an internal-DNS, switch it there... Or you can modify iptables-rules but don't ask me how! :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum