• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

Problem connecting internet and networking 2 computers runninb Ubuntu

I have installed 2 computers with Ubuntu.

On the primary computer running Ubuntu, when i type http://www.google.co.in it shows a message that unable
to lookup the site so i am unable to surf the net.

Only once i was able to surf the net through the same computer.

Q1. I was unable to connect to the internet
I checked a few setting using as root:
/sbin/ifconfig -a and it showed the ip address, broadcast address and net mask appropriately set. for eth0
netstat showed all the configured ports.
I was able to successfully ping the network card. and /etc/resolv.conf showed me the ip address of the dns server

I was able to surf the internet from Microsoft XP running on the same pc.

To my surprise, /etc/sysconfig directory was no where to be found in the entire system.
Also, I could not find ifcfg-eth0, /etc/dhcpcd files anywhere in the system using locate or find commands.

Why Are system files that are present in Red Hat not present in Ubuntu and why am i not able to connect to web?

Q2: The other computer running Ubuntu runs internet only when the primary computer is running Microsoft XP, if the primary computer runs Ubuntu it cannot surf the net.

  • 8
  • 7
1 Solution
I'll write my solution to connect internet. I didn't use terminal for networking configuration.

first check the connection to your router. ping your adsl router/or whatever it is.

if it's ok, ubuntu has a networking tool.

click System-Administration-Networking

give your eth0 a proper static ip, gateway and dns address.

and then check again. try to ping gateway, dns server... and nslookup the site.

aman_grevalAuthor Commented:
As i mentioned, i have used ping and it is successfully pinging the router.

And also that once i was able to successfully connect to the internet.

I also peeked into the network configuration using /sbin/ifconfig -a and it showed me IP, Subnet and NetMask configured
and dns server? does it show your router as dns?

sometimes i couldn't resolve addresses, i don't know why.

but now i changed my dns server ip to my isp's dns servers.. and everything's fine now..
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

aman_grevalAuthor Commented:
"and dns server? does it show your router as dns?"
How do i do this?? In front-end or back-end command
the file that keeps your nameservers


edit it, and check the nameserver entries

if there's only one entry for nameserver showing your router ip
then add an additional

nameserver yourisp'sdnsserverIP

or you can change the original with this one..

use the fastest possible dns server

to determine the fastest ping them and look at the reply seconds.. the lowest is the best..

if you can't find your isp's dns server IPs, check them at your router configuration page.

you don't use dhcp i think? so make sure to fill the right ones into your resolv.conf
also check this link,there's a good tutorial.. it's a better solution for dns lookups, and make your connections faster than before..

aman_grevalAuthor Commented:
Is the ip address given by the ISP same as the dns server.

1. I inserted this ip address in /etc/resolv.conf
There was only one dnsname the /etc/resolv.conf file, the default one
i added
saved the file

and rebooted the computer and entered http://www.google.co.in in the address bar of firefox
but the google page was not loaded.

I guess it might be either because i am using the wrong dns address

2.As you said "if you can't find your isp's dns server IPs, check them at your router configuration page."
how can i reach the router configuration page?
aman_grevalAuthor Commented:
Can you tell me how do i switch off the firewall in ubuntu
aman_grevalAuthor Commented:
I have seen the /etc/resolv.conf file of my friend's  RHEL system.
It has only two entries:

search                       localdomain

He says he has never configured any parameter to get RHEL running on the internet.
I happended automatically.
I guess these entries are standard entries that are with every RHEL pc.
If his computer can run without making any changes in the /etc/resolv.conf file then why should my Ubuntu pc need addition of a dnsaddress in /etc/resolv.conf?

2. I have seen that ubuntu does not have most of the important files that are with RHEL why so?
if the configuration is ok then you can connect to Internet
but there seems a problem and you should troubleshoot it...

first, check if it's a dns problem.

open the console, and type:


1- if it gets reply, then you connect to Internet but can't resolve domain names.
2- if it doesn't and times out then you might have a problem with the connection to your router.

if its the first situation then check this.. use console again..
type this:
nslookup www.google.com

this command will ask (public dns server i am using),
'what's the domain name of www.google.com
if it gets the answer, then you have a problem with your dns configuration (possibly in ubuntu)

if its the 2nd situation then try to ping your router (usually its
if it times out then we should check your configuration deeper..
your router conf. must be ok, cos you're using it with xp..
but if your router's running its dhcp service, and gives the same IP address to the XP
there might be an address conflict..

you can get to your router configuration page by typing the address to your browser
it will ask your username and password, if you doesnt give any password, it must be a default
like 'root' 'root' or 'admin' 'root'. plz read your router manual to learn the default username/password
and don't forget to change it, cos someone can hack your network easily after he gets to your router.

I'll wait.. plz feedback your troubleshooting..

firewall question:

ubuntu doensn't have a firewall configuration but it comes with iptables..
and unless you use some services that listens to outside you're secure...and because of it has no configuration it does not harm anything. so you really dont need to shut it down i think.. isn't your public dns server.. it must be your router or 2nd computer's network card..
if its your 2nd computer's  network card, then it might be the reason of your problem...

192.168.x.x means its private not public..

aman_grevalAuthor Commented:

Thaks for your suggestion. The internet has started working on the first computer.
It was a dns configuration problem.

ping was getting a reply

nslookup www.google.com gave me a reply. Showed me the domain name of google.

I went to System->Administration->Network Tools->Devices

There were 3 devices in the network interfaces

Network Device: Loopback Interface (L0)
IP                                   Netmask               Gateway              

Network Device: Ethernet Interface(eth0)
IP                                   Netmask               Gateway           

Network Device:Modem Interface(ppp0)
IP                                  Netmask                 Gateway          

I changed the configuration of the Network Device:Ethernet Interface(eth0) from to the ip address of the router
Configuration: Static IP Address
IP                                  Netmask                 Gateway          

Note: I have given a static ip address to eth0. When i configure the ip to be assigned to it dynamically through dns, mozilla stops showing web pages again.

Then i restarted mozilla, typed www.google.com and it showed me the page
aman_grevalAuthor Commented:

1) Now my second problem is that the Mozilla computer i have just configured ComputerA running Ubuntu, is the primary computer on which the router is attached.

I have another computer, ComputerB running on Ubuntu too.
I have networked both computers ComputerB with ComputerA through a network cable.

However the ComputerB does not seem to be  recognizing the existance of ComputerA which i just configured and is running the internet through mozilla.

In windows this was not a problem, windows would automatically detect another windows machine and would start showing it and i would start running the internet on the other computer too. I just needed one modem to run both the computers.

To detect if ComputerB detects the modem i pinged the router from it.

Connect: Network is unreachable

Then i also tried,
nslookup www.google.com
Connection timed out, no servers could be reached.

I tried to go to the router configuration page by typing the address in mozilla browser.
It asked me the username and password.
I typed nav/nav into it but it showed wrong username/password
I also tried root/root and admin/root but it still showed wrong username/password.

2) When i go to System->Administration There are two network related menu options

System->Administration->Network Tools

The first menu option System->Administration->Networking is available only on ComputerB, which i need to network with the ComputerA that is running mozilla. This option is not available on ComputerA. I assume this is because i think ubuntu has somehow detected the presence of ComputerA.

However when i select this option System->Administration->Networking, It shows me that it is opening the Networking dialog box. I can see the Networking tab opened in the status bar for 3 minutes, after that it disappears without showing the networking dialog box. Is that a configuration problem?

3) I am facing the same problem in my friend's computer running RHEL 9, when i select mozilla, it shows the mozilla tab in the status bar for 3-4 minutes then exists without displaying mozilla. Is this a configuration problem too.

I am not able to give you a feedback promptly as i am in my office when i recieve your reply. I have to go home after office hours in the evening and try out your suggestions before i can give you a feedback. Sorry for the delay.

i guess this is your network..

this is no problem when you windows, because winxp can use Internet Connection Sharing

can't you connect both of the PCs to the router?
Your router has only 1 port?

If it has only one, then you should setup Ubuntu 1 as a internet sharing server (NAT)
to do it check this link

If your router has two ports then don't do it, and connect your PCs directly to the router..

do you know the ip address of the router?
if it's, then you must not give that address to the Ubuntu 1 or 2

let me explain:
your router has two addresses


to connect to Internet successfuly
Ubuntu1 must send the packets to the address of your router, it's

this is called 'gateway', and you should configure the gateway of Ubuntu1 as
eth0 is the address of your network card of Ubuntu1, and it can be 'between'
so make it

to be able to resolve names you should also configure the dns of Ubuntu1 as at this scenario.. but if you give it another public dns server address, its ok too

to be able to connect Ubuntu2 to Ubuntu1 you should use a cross-over cable between them.
and then configure the Ubuntu2 like this...

eth0: (cos we used and 1.2)
gateway: (cos 1.2 is Ubuntu1 and it will serve as a gateway for Ubuntu2)
dns: or your public dns server...or if you use Ubuntu1 as a local cache dns server..

if its too complicated for you, you can buy a small switch..then you need to apply the configuration above to the PCs..
then connect all the nodes to the switch..
and without configuring Ubuntu1 as a NAT you can surf the Internet...

also find your router's username and password before someone else finds it...
call someone or read the manual or google it...

i realized something wrong..

to do this cross-over thing

ubuntu1 must have two interfaces..


you will connect eth0 of Ubuntu 2 to the eth1 of Ubuntu1

then the conf. should look like this at ubuntu2

eth0: (cos we used and 1.2 and 1.3)
gateway: (cos 1.3 is Ubuntu1 and it will serve as a gateway for Ubuntu2)
dns: or your public dns server...or if you use Ubuntu1 as a local cache dns server..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now