Solved

Setup internet on Linux using a DSL router

Posted on 2003-12-06
60
1,661 Views
Last Modified: 2013-12-06
I am trying to setup my Red Hat Linux 9.0 box to connect to my DSL router.
I did the following , connected the Linux box to my router using the CAT 5 cable.
I ran netconfig on Linux and first tried to get IP automatically using DHCP , when i restart the machine (or do : service network start). I get the error : determining ip address for eth0 failed   no link present ...check cable.
I then tried manually setting ip address....then i dont get any errors , but i cant ping the router or any other machine on the network. But i can ping the IP address i just assigned myself.

I have no clue what to do next... please help
0
Comment
Question by:rahulkothari
  • 32
  • 26
  • 2
60 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9889309
have u installed DSL router driver for linux on your linux box.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889316
did u try enabling the link.
---------------------------
ifup eth0 down
ifup eth0 up
0
 

Author Comment

by:rahulkothari
ID: 9889321
why do i need DSL router driver ??
DSL router is already being used by two other machines , when i want to connect a Windows Machine...i just connect the cable (and do automatically get IP) and things work fine.

I am sure i dont need a driver to setup internet on linux , when the DSL router is already setup and in place.
0
 

Author Comment

by:rahulkothari
ID: 9889330
i did :
ifup eth0 down
ifup eth0 up


didnt help
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889336
Above should refresh your TCP/IP properties, additionally u may need to create file named dhcpd.leases in /etc directory.

1.set up the default route through your eth0 interface with (need root permissions)
     route del default
     route add default eth0
try ping and see if it works in not then

2. check your  /etc/sysconfig/network
NETWORKING=yes               <--- u need this
HOSTNAME=your_machine_hostname    <--- thats ur machine name
GATEWAYDEV=eth0             <--- your 1st ethernet
device
GATEWAY=192.168.0.1         <--- that's the routing
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889343
i got confused with DSL modem for driver issues, forget about that.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889358
u said u connect your windows machine and it works fine then good try these. could u check these values.

in /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0                                    
BOOTPROTO=none                            
BROADCAST=192.168.0.255              <---- 1st & 2nd number got to match with the gateway keep the 0 & 255 alone u can check this value from windows.
NETMASK=255.255.255.0                   <---- same as your windows machine
IPADDR=
USERCTL=NO                                      
ONBOOT=yes                                      
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889372
also check your resolv.conf file has DNS server, u can check this server from your windows machine.
0
 

Author Comment

by:rahulkothari
ID: 9889377
i did this....

NETWORKING=yes              
HOSTNAME=lucky  
GATEWAYDEV=eth0            
device
GATEWAY=192.168.1.1        

now i did : service network start

tried to ping my router...didnt work

0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889413
Redhat 9 should use ethadmin, could y try setting up again with this tool.
0
 

Author Comment

by:rahulkothari
ID: 9889420
where is resolv.conf , i did cat /etc/resolv.conf.....it only prints:  search
0
 

Author Comment

by:rahulkothari
ID: 9889423
i searched on google , ethadmin + Red Hat :)
no results....i dont think there is sich thing
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889426
or try this
startup linuxconf as root and go into
config->networking->client tasks->basic host information
make sure it's enabled and DHCP is checked.

for more information check this link.
http://thecity.sfsu.edu/LDP/HOWTO/mini/DHCP.html


0
 

Author Comment

by:rahulkothari
ID: 9889450
i dont have linuxconf :(
0
 

Author Comment

by:rahulkothari
ID: 9889451
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889457
Check if firewall is off.... try:
#service iptables stop
#ifup eth0
If interface brings up -> disable firewall at all or add rule for dhcp

1. In /etc/sysconfig/network remove the HOSTNAME and GATEWAY entries.
2. In /etc/sysconfig/network-scripts/ifcfg-eth0  remove the IPADDR, NETMASK, NETWORK, and BROADCAST entries. leave  DEVICE and ONBOOT as is.  change the BOOTPROTO line to BOOTPROTO=dhcp
3. create a /etc/resolv.conf file
and put dns server entry there.
and restart your network.

sometime DHCP server does not DNS entry properly and u can get out, so u have to create it manully.
0
 

Author Comment

by:rahulkothari
ID: 9889483
what should be my DNS entry ?? if my ip is 192.168.1.103 and the router's ip is 192.168.1.1
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889496
u can get this value from your working windows system and put that value here.
ipconfig /all
0
 

Author Comment

by:rahulkothari
ID: 9889550
now i cannot start the network
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889555
what is error coming.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889571
BTW what i meant in
In /etc/sysconfig/network remove the HOSTNAME and GATEWAY entries.
2. In /etc/sysconfig/network-scripts/ifcfg-eth0  remove the IPADDR, NETMASK, NETWORK, and BROADCAST entries. leave  DEVICE and ONBOOT as is.  change the BOOTPROTO line to BOOTPROTO=dhcp

remove the values fields not the full line. u have to have those line to work.
0
 

Author Comment

by:rahulkothari
ID: 9889572
i cannot bring up eth0.....it sayd some problem with dhcpclient
0
 

Author Comment

by:rahulkothari
ID: 9889578
it gives error in eth0.....sbin/dhclient-script : device command not found
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889589
do u have dhcpd running.
also do u have dhcp client software on your system.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889595
ps -aef | grep dhcp does it give u anything.
0
 

Author Comment

by:rahulkothari
ID: 9889604
i did a grep..the process is running.....
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889613
/sbin/dhclient-script is main script and it will generate all the dhcp config files for u, even resolv.conf also generated by it. thats why u did not have resolv.conf.

find / -name "*dhcp* -print

to look for this script.  and if u found on some other place other then /sbin, then create a link to it from /sbin
0
 

Author Comment

by:rahulkothari
ID: 9889630
i dont have any dhcp scripts inside sbin , whats the exact name of the file to look for...
i think i have to create this myself.....what contents do i need to put in
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889640
I see the problem u have put device value in /etc/sysconfig/network, my bad typing mistake.
u have everything u need, it is failed to find command device which should not be there at first place.
sorry about that.

--------------------------
ok then just roll back.
-------------------------------
change resolv.conf to
nameserver         DNS_ip_address.
--------------------------------

/etc/sysconfig/network would look like:
NETWORKING=yes
HOSTNAME=
GATEWAYDEV=eth0            
GATEWAY=
--------------------------------
0
 

Author Comment

by:rahulkothari
ID: 9889651
before i had inside resolv.conf

nameserver=151.198.0.39

i changed it to
nameserver DNS_ip_address
 
?? is that correct
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:rahulkothari
ID: 9889661
and also :
why is HOSTNAME and GATEWAY empty ??
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889665
yes. and use a tab netween nameserver and ipaddress.
also
/etc/sysconfig/network-scripts/ifcfg-eth0 should like.
--------------
DEVICE=eth0                                    
BOOTPROTO=dhcp                          
BROADCAST=
NETMASK=
IPADDR=
USERCTL=NO                                      
ONBOOT=yes      
-------------------------
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889687
gateway is provided by the dhcp server, if it detect it put the value there, if not then we can put by outselves also, but i am leaving for the fresh connection to start with.
dhcp server keep getting changes and so the gateway server. dhcp take care of these functionality.

also hostname is also proviced by dhcp most of the time, if u want to have static name, u have to have some rule to fetch your hostname to dhcp. ( this is my solaris knowledge !). but may be true here too.
0
 

Author Comment

by:rahulkothari
ID: 9889700
i get the error :
Determining IP information for eth0.....failed
0
 

Author Comment

by:rahulkothari
ID: 9889707
and when i try to ping my router or my own ip = 192.168.1.103 , i get the error : network is unreachable
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889723
ok mv the resolv.conf to resolv.conf.backup
and reboot the linux.
0
 

Author Comment

by:rahulkothari
ID: 9889732
ok..i am rebooting now
0
 

Author Comment

by:rahulkothari
ID: 9889756
i rebooted.....there is no /etc/resolv.conf anymore....i tried to start the network service again
and when it was Bringing up the interface eth0 ...it gave the same error : Determining IP information for eth0.....failed
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889772
ok, now u are machine is in dhcp environment. but can not find ip address for itself.
may be route/gateway and dns problem.
------------------------------------------------
now u can do what i said before.
#service iptables stop
#ifup eth0      
does not work.
--------------------
# route del default
# route add default eth0
#ifup eth0
does not work
-------------------
/etc/sysconfig/network would look like:
NETWORKING=yes
HOSTNAME=
GATEWAYDEV=eth0            
GATEWAY=192.168.1.1
# route del default
# route add default eth0
#ifup eth0
----------------------------
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889795
also check your /var/adm/messages file abd post any messages/error related to DHCP discover or something.
0
 

Author Comment

by:rahulkothari
ID: 9889812
i changed my /etc/sysconfig/network
to :

NETWORKING=yes
HOSTNAME=
GATEWAYDEV=eth0            
GATEWAY=192.168.1.1

then i typed, on the prompt:
# route del default
# route add default eth0
#ifup eth0

i get the same error : Determining IP information for eth0.....failed
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889832
only one option left.

mkdir /etc/dhcpc
Make a link from /etc/dhcpc/resolv.conf to /etc/resolv.conf
ln -s /etc/dhcpc/resolv.conf /etc/resolv.conf
restart network.
if it fails.

move /etc/resolv.conf.back to /etc/resolv.conf
restart network
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889858
also u can add your ethernet mac value to
/etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=
0
 

Author Comment

by:rahulkothari
ID: 9889878
doesnt work :(...same problem
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9889894
there is no software problem looks here.
may be hardware, will u change the cable and replace it with what u r using on windows system.
0
 

Author Comment

by:rahulkothari
ID: 9889966
checked the wire...works fine
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9890027
u rebooted so firewall must have come again.
 Check if firewall is off.... try:
#service iptables stop
#fup eth0 down
#ifup eth0 up
restart network


0
 
LVL 24

Expert Comment

by:shivsa
ID: 9890083
also if your hardware is good and all, as u say.
then you can try static config.
----------------------------------
/etc/sysconfig/network:
NETWORKING=yes
HOSTNAME=lucky
GATEWAYDEV=eth0            
GATEWAY=192.168.1.1
-------------------------------
/etc/sysconfig/network-scripts/ifcfg-eth0 should like.
--------------
DEVICE=eth0                                    
BOOTPROTO=dhcp                          
BROADCAST=                          
NETMASK=                                  <-- get this value from windows.
IPADDR=192.168.1.103                
USERCTL=NO                                      
ONBOOT=yes      
-------------------------
ifconfig inet 192.168.1.103 netmask 255.255.255.0 broadcast 192.168.1.1
ifup eth0 up
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 9890153
swap cables with a know good one, and  then try it (sounds like a bad cable)
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 9890156
and plug into a know good port on the router
0
 

Author Comment

by:rahulkothari
ID: 9890565
finally some good news , i can ping all other machines on the network...can also ping the router. But still internet doesnt work...cant ping www.yahoo.com either
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9890584
good, so now it is either route problem or DNS problem.
what is output of
route -n
0
 

Author Comment

by:rahulkothari
ID: 9891081
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

thats the result of route -n
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9891175
it looks ok,
could u check file
/etc/sysconfig/networking/profiles/default/resolv.conf
and its content, and compare it with /etc/resolv.conf file.
also check netstat -rn output.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9891185
route add default gw 192.168.1.1

Also You can see what data was offered by the DHCP negotiation in the dhcpcd info file (usually /etc/dhcpc/dhcpcd-eth0.info)
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9891194
also check the output of traceroute 216.239.53.99
0
 

Author Comment

by:rahulkothari
ID: 9892848
route add default gw 192.168.1.1
results in the message : file exists

traceroute 216.239.53.99
results in : Host unknown
0
 
LVL 24

Accepted Solution

by:
shivsa earned 500 total points
ID: 9892862
route is not working.
# route del default
# route add default  gw 192.168.1.1
#ifup eth0 up
and also i asked for other output  in above comments.
0
 

Author Comment

by:rahulkothari
ID: 9894560
Shiva.....works fine now.
I just added a DNS entry.....

Thanx for all ur help
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9894583
Youe welcome.
glad to know that things worked out for u.
now i can start on your next question i just saw.
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Join & Write a Comment

Suggested Solutions

Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now