# Problem using router to connect to the internet

## Techie2000

I try to setup a static IP so I edit the files exactly as it says in the install guide setting my IP to 192.168.0.50, and the gateway as 192.168.0.168 (my router). But when I try to emerge rsync I get unresolved host errors, and I can't ping. Is there anything else I need to be doing to get it working with my Linksys BEFSR41?

----------

## handsomepete

Did you set up your resolv.conf with your DNS server's IPs?

----------

## Utoxin

You need to add your ISP's name servers to /etc/resolv.conf, one per line.

----------

## Techie2000

Yes I did that. I followed the install instructions to the letter. I'll double check the IPs though JIC..

----------

## Utoxin

If you've got the IPs right, try traceroute'ing to one of them, and see where the traceroute dies. Also, what output do you get from the command 'route'?

----------

## Techie2000

pinging works but I usually get 80% packet loss, I forgot the Linux traceroute command, and route gives me a thing saying interface, etc. but nothing listed underneath it.

----------

## Utoxin

Ping shouldn't /be/ working, if your routing table is empty. But if it is, and you're getting 80% packet loss, that sounds like a bad wire.

So, it appears you have two problems:

1. Your route isn't configured, so the kernel has no idea where to send packets.

2. You may have a bad wire, resulting in high packet loss.

In your /etc/conf.d/net, look near the bottom. What is the 'gateway' line set to? And for that matter, what does the iface_eth0 line near the top say?

As for the wire, if you have the tools to make your own, I'd highly recommend cutting the tips off and putting new ones on. There's a good guide to the pinouts of 10/100 ethernet wire here. If your wire is going straight from the compter to the router, it may need to be a crossover cable. Follow those instructions if that's the case.

----------

## Utoxin

As a guide, here's how your /etc/conf.d/net should look, based on what you said in your first message.

```

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

iface_eth0="192.168.0.50 broadcast 192.168.255.255 netmask 255.255.0.0"

# For setting the default gateway

#

gateway="eth0/192.168.0.168"

```

----------

## Techie2000

# This is basically the ifconfig argument without the ifconfig $iface 

# 

iface_eth0="192.168.0.50 broadcast 192.168.0.255 netmask 255.255.0.0" 

# For setting the default gateway 

# 

gateway="eth0/192.168.0.168" 

is how it looks. Also I got plenty of cat5 wire. Part of my dads work...

----------

## Utoxin

Your broadcast and your netmask don't match up. (If you want a long gruesome detailed explanation of why, I suppose I could provide one.) I'd suggest changing the broadcast to .255.255 at the end, instead of .0.255

the rest of it looks fine. Hmmm.  What happens if you do this:

```
/sbin/route add -net default gw 192.168.0.168 netmask 0.0.0.0 metric 1
```

and then try to connect to the net? (Make sure it adds the new route to the output of 'route')

----------

## Techie2000

When doing the /sbin/route thing I get:

SIOCADDRT: File Exists

I also edited /conf.d/net as you suggested.

----------

## Utoxin

That error means that the routing daemon believes that route already exists. At this point, rather than try and delete it, I'd recommend a reboot, just to flush out any residual problems that may have resulted from the improperly configured broadcast address. Since it's not working anyway, I can't imagine this being much of a problem. (Besides. Gentoo reboots quickly.)

----------

## Techie2000

rebooted, emerge rsync does not work still...is there a command to reset all the network settings back to default?

----------

## Utoxin

Not that I know of. Let's not give up yet though. What is the output of 'ifconfig'?

----------

## Techie2000

eth0 Link encap:Ethernet HWaddr: 00:(rest left out)

       inet addr: 192.168.0.50 Bcast: 192.168.255.255 Mask:255.255.0.0

       UP BROADCAST RUNNING MULTICAST MTU:1500 Metric: 1

----------

## Utoxin

Huh. That looks valid. At this point, I think I may have to conceed defeat. Sorry I couldn't solve it for you.

----------

## FINITE

If ifconfig shows up and running in the output then your connection is there but something is constricting it. Also isn't ifconfig supposed to show more info like rxpackets and txpackets sent and received and collisions etc etc? Was everything working fine before the router was added?

----------

## FINITE

Also who is you r isp and are the addresses assigned dynamically or are they entered static?

----------

## handsomepete

Also, not to insult you, but make sure that your router is set up properly (i.e. don't use dhcp if you're using static IPs, if you changed the router's IP make sure you hit 'apply' (if you need to, reset the router with that tiny little button on the front) use the reported DNS servers (they should be fresh for a while at least) from the setup tab, don't include any setting/port blockings that don't make sense).  And of course, switch out cables.  Theoretically your nic should be working, but if you *really* want to troubleshoot it, maybe you could set your router to 192.168.1.1 and do it all by hand again:

ifconfig eth0 192.168.1.2 broadcast 192.168.1.255 netmask 255.255.255.0

route add -net default gw 192.168.1.1 netmask 0.0.0.0 metric 1

(doing it from memory but that looks right to me... those are pretty safe settings and the befsr default addy is always 192.168.1.1)

You'd probably have to route del -net default gw 192.168.1.1 before doing this, but what's the worst that could happen (this comes with no guarantees...  :Smile:  )

----------

## padawan

Hey!

I was just about to post that I was having the same problem, (I just installed

Gentoo over the last couple of days), but when I was gathering information

I spotted something, and I think I fixed it.

I have 4 PC's behind a DSL router (actually not all mine, but anyway...).

The router is 192.168.100.1, and the others are 2,3,4,5.  The Gentoo box

is 3.  Netmask is 255.255.255.0.  All can access the net and talk to each

fine except the Gentoo box.  (Although it's dual boot, and works fine with

wind*ze running, so no hardware or cable problems).

When Gentoo was booted with static IP, I could ping the other PCs, but I

couldn't ping the router!   If I dropped the static IP, and ran dhcpcd, then

everything worked fine.  Here's the route table for both:

Static:

```

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

0.0.0.0         192.168.100.1   0.0.0.0         UG    1      0        0 eth0

```

Dynamic:

```

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 eth0

```

The only difference is the metric.  I modified /etc/init.d/net.eth0 to set

the metric to 0, same as the dynamic setting, and now it works as static!

(I'm posting this from my Gentoo box with static IP)  

 :Cool: 

----------

## padawan

Doh!  Ignore that previous post...

Right after I posted, it just spontaneously stopped working again.  Same symptoms.  I could ping the other local machines, but not the router.  I'm back on dhcp again.    :Sad: 

----------

## Techie2000

I'm currently cleaning all the dust off my computer and moving it to a new case a acquired a couple weeks ago. I'll change the PCI slot position of the NIC and see what happens. Otherwise, I'll reinstall Gentoo...

----------

