LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   switching from dhcp to static lost internet (https://www.linuxquestions.org/questions/linux-networking-3/switching-from-dhcp-to-static-lost-internet-306766/)

basq3 03-27-2005 05:09 PM

switching from dhcp to static lost internet
 
im using fedora 3 with a nic and a cable modem. I can ping the IP from both the box and from another box. the ip shows behind the modem on the network.

dhcp worked but when i switched to a static ip/gateway I lost the internet.

I also had edited my host.conf file - if anyone has a sugguestion for what's in that file please.

Code:

[root@br ~]# ifconfig eth0

eth0  Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:xx.xxx.xxx.10  Bcast:xx.xxx.xxx.15  Mask:255.xxx.xxx.xxx
          inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/xx Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15757 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3028 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1039265 (1014.9 KiB)  TX bytes:620958 (606.4 KiB)
          Interrupt:185 Base address:0xa000

why would it broadcast at .15 instead of .10 like the ip?

when i ping a host:

[root@br ~]# ping www.yahoo.com
ping: unknown host www.yahoo.com

when i ping an ip: it freezes and i have to ctrl c to get it to unfreeze.

[root@br ~]# ping xx.xxx.xxx.xxx
PING xx.xxx.xxx.xxx (xx.xxx.xxx.xxx) 56(84) bytes of data.

--- xx.xxx.xxx.xxx ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 5999ms

any help is appreciated :)

Thoreau 03-27-2005 05:12 PM

I suggest you stop packeting yourself and add your gateway to your ipsettings and DNS to your /etc/resolv.conf.

basq3 03-27-2005 05:32 PM

examples? im not to familiar with those files thx!!!

Thoreau 03-27-2005 05:37 PM

/etc/resolv.conf

nameserver xxx.xxx.xxx.xxx(ip of your DNS aka router IP)

Gateway is is the router IP as well(the route out). You configure that in the same place you configure your static IP(control panel?)

basq3 03-27-2005 07:57 PM

i was hoping to get exactly what goes into the host.conf and the resolv.conf as im away from the machine so i have to use the vi and the consol.

could you provide an actual example doesnt have to be real #'s. thx again.

Thoreau 03-27-2005 10:53 PM

That was an actual eample. /etc/hosts has nothing to do with it. I think you should hire a $150/hr consultant to help you.

mcd 03-28-2005 06:47 PM

if you check your /etc/resolv.conf file you'll see it's just a list of nameservers. should be something like

nameserver 4.7.8.38
nameserver 192.168.1.1


your router probably acts as a caching nameserver, so you can put it in there if you want. otherwise, use your ISP's nameserver. note that if you use dhcp (and maybe sometimes if you don't) resolv.conf can be overwritten.


as for setting your default gateway, in fedora i *believe* you set it in /etc/sysconfig/ifcfg-eth0, or something like that. wherever your static ip settings are...where did you configure that? there should be a line like

Gateway=""

and you want to put in

Gateway="192.168.1.1"

or whatever your router's ip address is. you can also do this with the command


route add default gateway 192.168.1.1


but it won't be permanent.

basq3 03-29-2005 09:34 AM

i was able to setup the ip, gateway, primary and secondary dns all through the gui on eth0.

ill try to edit the resolv.conf which do i need to put in without the router(getting it this week)?

my ip?
the gateway?
both dns servers?

thanks for clarifying the structure of the resovl.conf

can you provide an example of the host.conf file since i hosed mine?

sorry to be bothering so much but i have no examples to go off of. im new to linux but not new to computers.

basq3 03-29-2005 09:44 AM

nice tutorial with examples!!!! thx!!!!!


All times are GMT -5. The time now is 02:25 AM.