# Cannot connect the net. FreeBSD 9.1



## Maicol (May 8, 2013)

I have been working on a web server some days and I am really tired that always have this error, after restart, the server doesn't connect to the net.

I have modified /etc/rc.conf, /etc/hosts, /etc/resolv.conf but I couldn't solve my problem. Notably, I'm working on a Realtek 8111E, but I have already added the line 
	
	



```
if_re_load="YES"
```
 to /boot/loader.conf.

Can someone help me?. 

Mistakes: 
	
	



```
Ping 192.168.1.1 (gateway): No route to host.
```

The first time after install, the net runs perfectly.


----------



## wblock@ (May 8, 2013)

Unfortunately, you do not show the contents of any of the files mentioned.  The error suggests that there is no defaultrouter entry in /etc/rc.conf, or maybe an incorrect one.


----------



## Maicol (May 8, 2013)

I'm sorry,

/etc/rc.conf

```
hostname="server"
ifconfig_re0="inet 192.168.1.2 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
apache22_enable="YES"
```

/etc/hosts

```
::1 localhost localhost.my.com
127.0.0.1 localhost localhost.my.com
192.168.1.2 server server.my.com
192.168.1.1 gateway gateway.my.com
```

/etc/resolv.conf

```
domain my.com
nameserver 192.168.1.1
```


----------



## wblock@ (May 8, 2013)

Please show the output of `route show default`.


----------



## jb_fvwm2 (May 8, 2013)

AFAIK resolv.conf needs an actual nameserver (not a local lan address), (but I've not enough experience with webservers to qualify that as the best answer...)


----------



## Maicol (May 8, 2013)

```
root@server:/root# route show default
route to: default
designation: default
mask: default
gateway: gateway
interface: re0
flags: <UP,GATEWAY,DONE,STATIC>
rcvpipe sendpipe ssthresh rtt,msec mtu weight expire
```


----------



## wblock@ (May 8, 2013)

jb_fvwm2 said:
			
		

> AFAIK resolv.conf needs an actual nameserver (not a local lan address), (but I've not enough experience with webservers to qualify that as the best answer...)



It's set to the router, which typically is a nameserver also.


----------



## Maicol (May 8, 2013)

wblock@ said:
			
		

> It's set to the router, which typically is a nameserver also.



Yes, that gateway runs as a packet filter, router and DHCP server. And other PC's can navigate perfectly.


----------



## zspider (May 8, 2013)

You did add a default gateway right?

`route add default <ip address of gateway>`


----------



## wblock@ (May 8, 2013)

Maicol said:
			
		

> ```
> root@server:/root# route show default
> route to: default
> designation: default
> ...



There should be one more line at the end, showing the MTU.  I can't think of the next thing to check right now, but surely someone else will.


----------



## wblock@ (May 8, 2013)

The default route should be set by the entry in /etc/rc.conf.  Wait, I did think of something else: to check DNS, please show the output of these commands:
`ping gateway`
`ping 192.168.1.1`


----------



## Maicol (May 8, 2013)

```
root@server:/ # route add default 192.168.1.1
route: writing to routing socket: File exists
add net default: gateway 192.168.1.1: route already in table
```


```
root@server:/ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
ping: sendto: Host is down
```


----------



## Maicol (May 8, 2013)

```
root@server:/root# route show default
route to: default
designation: default
mask: default
gateway: gateway
interface: re0
flags: <UP,GATEWAY,DONE,STATIC>
rcvpipe sendpipe ssthresh rtt,msec  mtu    weight  expire
   0         0       0         0     1500     1      0
```


----------



## wblock@ (May 8, 2013)

@Maicol, please stop making me edit every one of these posts.

Please do that ping again, after a reboot, without manually setting the default router.

Can your other systems ping the router?


----------



## Maicol (May 8, 2013)

Yes, my other systems ping the router, no problems.

The server startup without problems, but I can't ping the router.
At startup, the server says:

```
re0: watchdog timeout
```


----------



## wblock@ (May 8, 2013)

Maicol said:
			
		

> Yes, my other systems ping the router, no problems.
> 
> The server startup without problems, but I can't ping the router.



Right, but what is the error message?  So far there have been two, pointing at different problems.



> At startup, the server says:
> 
> ```
> re0: watchdog timeout
> ```



Hmm.  I don't think mine do that, but it may not be a problem.


----------



## Maicol (May 8, 2013)

wblock@ said:
			
		

> Right, but what is the error message?  So far there have been two, pointing at different problems.



This is my problem, after restart:

```
root@server:/ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
ping: sendto: Host is down
```

I can't send or receive packets. The server says that all computers on my net are off. The other computers neither can connect the server.


----------



## wblock@ (May 8, 2013)

Too many variables, and they are multiplying.  First, ping(8) can be problematic because Windows systems are terrified of ICMP packets.  Some routers might also not transfer ICMP.  Then there is DNS.

So... can you use some real network protocol to connect to somewhere out on the net?  Can you download and install ports or packages?

For the local network, can the other machines see your server web page if you just use the IP address?


----------



## Maicol (May 8, 2013)

wblock@ said:
			
		

> Too many variables, and they are multiplying.  First, ping(8) can be problematic because Windows systems are terrified of ICMP packets.  Some routers might also not transfer ICMP.  Then there is DNS.



Net Schema: 








> So... can you use some real network protocol to connect to somewhere out on the net?  Can you download and install ports or packages?



From the server? I can't. Only before the first restart I could install ports.



> For the local network, can the other machines see your server web page if you just use the IP address?



No, only before the first restart. I think that I have some hardware problem, only after the first restart begin my problems, before I can install ports and ping without problems...


----------



## usdmatt (May 8, 2013)

As @wblock@ says, this question is quickly getting out of control.

You say you can ping the router, 192.168.1.1, from other computers on the same network, but you are getting 'Host is down' on the FreeBSD box.

I'm pretty sure the re device is part of the GENERIC kernel so you don't need to load it in /boot/loader.conf but that shouldn't really cause a problem. I've seen watchdog timeouts on lots of machines and never had any obvious networking problems so I don't think that is the issue.

Can you reboot the server, then without loading or changing anything else, show the output of the following:


```
# ifconfig re0
# netstat -rn
# ping 192.168.1.1
```

The Host is down message kind of suggests you have more basic networking problems, like a dodgy network cable or a switch that's gone awry.


----------



## SirDice (May 8, 2013)

Maicol said:
			
		

> At startup, the server says:
> 
> ```
> re0: watchdog timeout
> ```


For some reason I get these too on one of my machines. re(4) keeps generating watchdog errors and dropping off the network. 

This seems to work for me (I have a gigabit network, adjust where needed):
`# ifconfig re0 media 1000baseT mediaopt full-duplex mtu 1500`

That will fix it on 1000baseT (gigabit) and full-duplex.


----------



## Maicol (May 8, 2013)

*It works!*



			
				SirDice said:
			
		

> For some reason I get these too on one of my machines. re(4) keeps generating watchdog errors and dropping off the network.
> 
> This seems to work for me (I have a gigabit network, adjust where needed):
> `# ifconfig re0 media 1000baseT mediaopt full-duplex mtu 1500`
> ...



Thanks for the replies, I'm grateful.


----------

