Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have set up a simple home network just to play around a little and learn the commands/configs for linux. My setup is like this (from the wall):
1. Cable Modem
2. Older PC with FC1 (eth0) -spoofed MAC addy to make it work correctly with ISP-
3. Second NIC (eth1)
4. Crossover Cable
5. Main Computer FC3 (eth0)
I have it set up with ipforwarding/masquerade on the router box. I can ping the router box (FC1) from the main box (FC3) and vice versa. I can connect to the Internet with the router box and ping by IP and Hostname. However, here's the problem. On the main box (FC3) I can ping by IP but not by hostname. I know that this is a DNS problem on the FC3 box, however I cannot nail it down to a specific cause. I have the nameservers set in the /etc/resolv.conf file..... they are exactly the same as the router box (which works perfectly). I can ping those name servers, but for some reason they won't resolve for me... All internal IPs are statically assigned, and the router box is set up to get the IP from my ISP via DHCP. I am pretty much at my wit's end, as resolv.conf is the only place that I can think of that handles the nameservers for the system. The only thing that I can think of would be that iptables on the FC3 box is blocking this traffic, however I don't think this is the case because I stopped the service and tried and no luck. I would appreciate any suggestions that anyone would be able to offer, and will post the output of anything needed (within reason hehe). Thanks in advance for any advice you can give to me!
one very easy way is there since ur network is very small.
just make the entries in /etc/hosts file for the hosts u want to ping..hopefully that will solve ur problem.
bye
Try typing the following at the command prompt
nslookup <enter>
server <enter>
After typing server and hitting enter look at what the IP address is of the name server listed. If it's anything other than your DNS server then there's a problem there. Once we know what the output is, we can work from there.
[root@main ~]# ping 216.109.112.135 ------IP of yahoo.com------
PING 216.109.112.135 (216.109.112.135) 56(84) bytes of data.
64 bytes from 216.109.112.135: icmp_seq=0 ttl=48 time=88.9 ms
64 bytes from 216.109.112.135: icmp_seq=1 ttl=48 time=102 ms
All the above files are from the FC3 box behind the router box, as the router box can access the Internet without problems. It definately has to be a DNS problem, but I can't figure out why or where..... Thanks for the help so far, I look forward to any suggestions you may have!
First of all after typing nslookup you were supposed to type "server" instead of yahoo.com. This way, we will know what DNS server is responding to your requests.
Well in either case it should still show my DNS servers, but here is what happens with the "nslookup server" command:
[root@main ~]# nslookup server
;; connection timed out; no servers could be reached
And, here's what happens when I ping my primary DNS server by IP, same with secondary:
[root@main ~]# ping 68.87.66.196
PING 68.87.66.196 (68.87.66.196) 56(84) bytes of data.
64 bytes from 68.87.66.196: icmp_seq=0 ttl=52 time=62.0 ms
64 bytes from 68.87.66.196: icmp_seq=1 ttl=52 time=66.2 ms
64 bytes from 68.87.66.196: icmp_seq=2 ttl=52 time=58.0 ms
64 bytes from 68.87.66.196: icmp_seq=3 ttl=52 time=57.2 ms
64 bytes from 68.87.66.196: icmp_seq=4 ttl=52 time=59.6 ms
And, on the router box while connected to the cable modem:
[root@router /]# nslookup server
Note: nslookup is deprecated and may be removed from future releases.
Consider using the 'dig' or 'host' programs instead. Run nslookup with
the '-sil[ent]' option to prevent this message from appearing.
Server: 68.87.66.196
Address: 68.87.66.196#53
Yes, I've tried disabling iptables on both machines at the same time by using "service iptables stop", then trying to access the Internet on the FC3 box with the same results. That's why I'm so confused, I don't see any reason why I would be able to ping by IP only and not be able to resolve hostnames.... there could be a routing problem from the FC1 box but from the research that I've done I just can't seem to find where and why.... Is there a different way I should be disabling iptables or is there another config file that sets up routes for DNS resolution? I have done a lot of googling and research and am mystified at this point..... Perhaps I should start over with the FC1 box and set up the masquerading, nat, and iptables rules again.... I've used numerous guides that I have found on the Internet to help me set everything up, perhaps by using so many different guides I have missed something or overwritten some rules somewhere.... Do you have any ideas on a specific guide to use that you know will work?
Thanks for all your ideas up to this point, I really appreciate all the help that you have been trying to give me!
First try setting PEERDNS=no in your eth0 config. If that doesn't work post your /etc/nsswitch.conf file for FC3 and just for the heck of it, post the output of ifconfig for FC1 and FC3.
Well, I just got back from vacation and removed FC1 from the router box to start fresh. It is now running FC3 the same as my main box. I set everything up (NAT and ipmasquerading) according to a guide I found at another linux forum site, and everything was back to the way it was.... ability to ping both machines from one another and hostnames not resolving on the main box. So, on a hunch, I shut down both firewalls and reran the ipmasquerading script I created on the router box and, to my suprise, I was able to browse the internet on both machines and ping normally from the main box. So, in effect, I have narrowed the problem down to the firewall on the router box. However, I am not very familiar with how to set up the firewall to allow hostname resolution and was wondering if anyone had suggestions on how to do so, as well as creating a good firewall..... this router box will be serving as my main firewall in the future and needs to be quite sound. I would appreciate any help diagnosing the firewall as it is now (to allow hostname resolution) and any suggestions on how to set it up for my needs..... any information needed can be posted when requested. I look forward to any suggestions that you may come up with! Thanks!
Originally posted by jneider23 Well, here are the results:
/etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.100.1 router.home.net router
192.168.100.2 main.home.net main
All the above files are from the FC3 box behind the router box, as the router box can access the Internet without problems. It definately has to be a DNS problem, but I can't figure out why or where..... Thanks for the help so far, I look forward to any suggestions you may have!
One of the problems that I can see is in .
/etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.100.1 router.home.net router
192.168.100.2 main.home.net main
You have a mismatch with these entries , the hosts file should contain
<ip address> <workgroup>.<compname> <alias>
So you really should be having an entry something like
127.0.0.1 localhost.localdomain localhost
192.168.100.1 home.router router
192.168.100.2 home.main main
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.