pavement

Network, troubleshooting

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(See also: link to network wireless)
 
(3 intermediate revisions by one user not shown)
Line 7: Line 7:
 
# ping something on the other side of your [[gateway]] (something in another subnet or outside your network, for example). ping a known-pingable IP address on the internet. If you can ping 216.239.37.99 but not google.com, then you know something is wrong with your [[DNS]]. Other public places that respond to public pings are: cisco.com, yahoo.com, apple.com, google.com and freebsdwiki.net. It might not be a bad idea to write down the IP addresses of one or two of those places for future reference.
 
# ping something on the other side of your [[gateway]] (something in another subnet or outside your network, for example). ping a known-pingable IP address on the internet. If you can ping 216.239.37.99 but not google.com, then you know something is wrong with your [[DNS]]. Other public places that respond to public pings are: cisco.com, yahoo.com, apple.com, google.com and freebsdwiki.net. It might not be a bad idea to write down the IP addresses of one or two of those places for future reference.
 
# If it's been narrowed down to DNS, find out if it's your DNS or the DNS lookup itself that's causing a problem: try using [[dig]] or [[nslookup]] to do lookups against another DNS server.
 
# If it's been narrowed down to DNS, find out if it's your DNS or the DNS lookup itself that's causing a problem: try using [[dig]] or [[nslookup]] to do lookups against another DNS server.
# [[ifconfig]] is your friend, unless it's not: if you've misconfigured the IP and netmask, you may not be able to connect to the machine. Remember to log in to the [[console]] or you can always connect a [[crossover cable]] and give your laptop/desktop that you've hooked up to it the gateway's IP -- this works when you've given your server a 32-bit netmask (255.255.255.255).  
+
# [[ifconfig]] is your friend, unless it's not: if you've misconfigured the IP and netmask, you may not be able to connect to the machine. Remember to log in to the [[console]] or you can always connect a [[crossover cable]] and give your laptop/desktop that you've hooked up to it the gateway's IP -- this works when you've given your server a 32-bit netmask (255.255.255.255).
 +
 
 +
Examples for steps 1-3:
 +
# ifconfig
 +
# ping 192.168.x.x
 +
# ping cisco.com
 +
# ping 72.163.4.161
  
 
==etc/==
 
==etc/==
Here are general configurations. Except for a few exceptions, be sure that custom ''[[etc/]]'' settings are located under ''/usr/local/etc/''. /etc configurations can be updated by running processes. This explains why functionality can break, and may have to be updated if only relying on network configuration files in ''/etc'' .
+
Here are general configurations for networks settings which reside in /etc.
  
 
===rc.conf===
 
===rc.conf===
''[[rc.conf]] is an exception and it belongs in ''/etc'' to be customized by the user.
+
''[[rc.conf]] belongs in ''/etc'' to be customized by the user.
  
 
Be sure to have the lines:
 
Be sure to have the lines:
Line 20: Line 26:
  
 
To check your hostname, you may type at the command line:
 
To check your hostname, you may type at the command line:
  # uname -a
+
  # uname -n
  
 
These are common settings used for a wireless card; [[WPA Supplicant]] is used here:
 
These are common settings used for a wireless card; [[WPA Supplicant]] is used here:
Line 27: Line 33:
  
 
===hosts===
 
===hosts===
Edit the file at /usr/local/etc/hosts
+
Edit the file ''/etc/hosts''
  
 
The commented out line in ''[[hosts]]'' is artificially added here for explanation:
 
The commented out line in ''[[hosts]]'' is artificially added here for explanation:
 
  #gateway ip    localhost    localhost.namedgateway
 
  #gateway ip    localhost    localhost.namedgateway
 
  192.168.x.x    localhost    localhost.yourgatewayname.com
 
  192.168.x.x    localhost    localhost.yourgatewayname.com
#the localhost variable can optionally be replaced with the name of your computer
 
  
 
===resolv.conf===
 
===resolv.conf===
Edit the file /usr/local/etc/[[resolv.conf]] . A line containing "DNS" may have to be commented out from it, depending on your hardware.
+
Edit the file /etc/[[resolv.conf]] . A line containing "DNS" may have to be commented out from it, depending on your hardware.
 
resolv.conf should look something like this:
 
resolv.conf should look something like this:
 
  search gateway.yourgateway.com    # search + gateway. and the word name of your gateway ("gateway" is its localhost)
 
  search gateway.yourgateway.com    # search + gateway. and the word name of your gateway ("gateway" is its localhost)
 
  nameserver 192.168.x.x            # nameserver + numerical ip of gateway
 
  nameserver 192.168.x.x            # nameserver + numerical ip of gateway
 
  
 
==See also==
 
==See also==
Line 45: Line 49:
 
* [[Network Configuration (manual)]]
 
* [[Network Configuration (manual)]]
 
* [[Network Configuration (Advanced)]]
 
* [[Network Configuration (Advanced)]]
 +
* [[Network, Wireless]]
 
* [[Network Address Translation]]
 
* [[Network Address Translation]]
  

Latest revision as of 12:05, 21 October 2015

If you suddenly can't get to the internet, the best thing to do is to find out exactly what's broken first. Makes sense, right? Then here are common configuration file solutions.

Contents

[edit] Testing network

So, a quick checklist of things:

  1. run ifconfig and see the state of your interfaces; if a cable's come unplugged, you'll see that the interface isn't connected.
  2. ping your gateway to see if it's your LAN that's down
  3. ping something on the other side of your gateway (something in another subnet or outside your network, for example). ping a known-pingable IP address on the internet. If you can ping 216.239.37.99 but not google.com, then you know something is wrong with your DNS. Other public places that respond to public pings are: cisco.com, yahoo.com, apple.com, google.com and freebsdwiki.net. It might not be a bad idea to write down the IP addresses of one or two of those places for future reference.
  4. If it's been narrowed down to DNS, find out if it's your DNS or the DNS lookup itself that's causing a problem: try using dig or nslookup to do lookups against another DNS server.
  5. ifconfig is your friend, unless it's not: if you've misconfigured the IP and netmask, you may not be able to connect to the machine. Remember to log in to the console or you can always connect a crossover cable and give your laptop/desktop that you've hooked up to it the gateway's IP -- this works when you've given your server a 32-bit netmask (255.255.255.255).

Examples for steps 1-3:

# ifconfig
# ping 192.168.x.x
# ping cisco.com
# ping 72.163.4.161

[edit] etc/

Here are general configurations for networks settings which reside in /etc.

[edit] rc.conf

rc.conf belongs in /etc to be customized by the user.

Be sure to have the lines:

defaultrouter="192.168.[your gateway ip address here]"
hostname="[your computer's host name]"

To check your hostname, you may type at the command line:

# uname -n

These are common settings used for a wireless card; WPA Supplicant is used here:

wlans_ath0="wlan0"
ifconfig_wlan0="WPA DHCP"

[edit] hosts

Edit the file /etc/hosts

The commented out line in hosts is artificially added here for explanation:

#gateway ip     localhost     localhost.namedgateway
192.168.x.x     localhost     localhost.yourgatewayname.com

[edit] resolv.conf

Edit the file /etc/resolv.conf . A line containing "DNS" may have to be commented out from it, depending on your hardware. resolv.conf should look something like this:

search gateway.yourgateway.com     # search + gateway. and the word name of your gateway ("gateway" is its localhost)
nameserver 192.168.x.x             # nameserver + numerical ip of gateway

[edit] See also

[edit] References

  • Thanks to those who both ask and help answer relevant questions at FreeBSD related forums.
Personal tools