# Cannot ping out from a LAN



## c00kie (Apr 17, 2012)

hi

I *can* ping my router, interface and loopback. I *can't* ping outside the LAN however:

`#  ping [url]http://www.google.com[/url]`


```
ping: cannot resolve www.google.com: Host name lookup failure
```

My FreeBSD box is patched into the router with ethernet. My network configuration looks like:
http://drupal876.co.uk/img/network.jpg

Has anyone had similar problems?

Thanks in advance.


----------



## SirDice (Apr 17, 2012)

Configure your DNS servers correctly in /etc/resolv.conf. See resolv.conf(5).


----------



## c00kie (Apr 17, 2012)

SirDice said:
			
		

> Configure your DNS servers correctly in /etc/resolv.conf. See resolv.conf(5).



Thanks.

My /etc/resolv.conf currently looks like:


```
# Generated by resolvconf
nameserver 194.168.4.100
nameserver 194.168.8.100
```
If I'm not mistaken the first IP address showed up whilst I did a post 
`#  sysinstall` and went into the Networking options.

I*'*ve tried editing /etc/resolv.conf with


```
nameserver 192.168.0.5 # LAN machine address
nameserver 1.2.3.4     # WAN address ISP
```

Can't ping out though? Can you throw me a bone?


----------



## SirDice (Apr 17, 2012)

Use the same DNS servers you're using on the other machine.


----------



## c00kie (Apr 17, 2012)

SirDice said:
			
		

> Use the same DNS servers you're using on the other machine.



Other machine? Now you've confused me..:\ I'm only using 'one' FreeBSD box on my LAN.


----------



## SirDice (Apr 17, 2012)

Your drawing shows 2 machines, one FreeBSD laptop and one desktop.


----------



## c00kie (Apr 17, 2012)

SirDice said:
			
		

> Your drawing shows 2 machines, one FreeBSD laptop and one desktop.



That's correct. OK, the desktop computer is running Windows7 pro. I'm familiar with the cmd utility. My next question would be how do I find DNS settings in Windows? I wasn't aware my desktop would have any DNS server information.

Edit:

In Windows at the cmd:

[CMD=">"] ipconfig /all[/CMD]

It's showing the same DNS information as /etc/resolv.conf:


```
DNS servers..........................194.168.4.100
                                     194.168.8.100
```


----------



## SirDice (Apr 17, 2012)

c00kie said:
			
		

> I wasn't aware my desktop would have any DNS server information.


How do you think it resolves hostnames?


----------



## c00kie (Apr 17, 2012)

SirDice said:
			
		

> How do you think it resolves hostnames?



Yes, it's a bit obvious isn't it..


----------



## c00kie (Apr 17, 2012)

OK, all machines are sharing the same DNS server settings namely:

194.168.4.100
194.168.8.100


----------



## SirDice (Apr 17, 2012)

Is the Windows 7 machine configured to "Obtain an IP address automatically"?

If that's the case configure your FreeBSD machine to use DHCP. It will get its IP address, subnet mask, default gateway and DNS settings automatically.


----------



## c00kie (Apr 18, 2012)

SirDice said:
			
		

> Is the Windows 7 machine configured to "Obtain an IP address automatically"?
> 
> If that's the case configure your FreeBSD machine to use DHCP. It will get its IP address, subnet mask, default gateway and DNS settings automatically.



Thanks SirDice. Editing /etc/rc.conf with:


```
# ifconfig_re0="inet 192.168.0.5 netmask 255.255.255.0"
ifconfig_re0="DHCP"
```

I can now ping outside of the LAN. Brill. A couple more questions. Are the nameserver addresses from my ISP? 194.168.4.100 & 194.168.8.100.

My FreeBSD machine is running as a public web server as you know from earlier posts. I was under the impression that the FreeBSD box needed a static ip address to be acces*s*ible from outside the LAN i.e. via the public internet. Is this not the case?


----------



## SirDice (Apr 18, 2012)

c00kie said:
			
		

> Are the nameserver addresses from my ISP? 194.168.4.100 & 194.168.8.100.


If your ISP is Cable Online Ltd, yes.



> My FreeBSD machine is running as a public web server as you know from earlier posts. I was under the impression that the FreeBSD box needed a static ip address to be accesible from outside the LAN i.e. via the public internet. Is this not the case?


Strictly speaking no but it does make it a little easier. Simplest thing to do is to go in your modem/router configuration and configure it's DHCP server. You need to enter the machine's MAC address and the modem/router will make sure your machine always receives the same IP address. It's usually called 'reservations' or 'static assignment', you'll have to consult your modem/router's manual for that.


----------



## aa (Apr 18, 2012)

c00kie said:
			
		

> A couple more questions. Are the nameserver addresses from my ISP? 194.168.4.100 & 194.168.8.100.


Yes


> I was under the impression that the FreeBSD box needed a static ip address to be accesible from outside the LAN i.e. via the public internet.


Any service to be accessible by world deserves a *global* IP. It could be *static* or *dynamic* there's no difference. Of course many services like DNS prefer static because it not make sense to put them on dynamic IP.


----------



## c00kie (Apr 18, 2012)

SirDice said:
			
		

> If your ISP is Cable Online Ltd, yes.
> 
> It's usually called 'reservations' or 'static assignment', you'll have to consult your modem/router's manual for that.



Excellent. Nice insight into networking also thanks.


----------

