Troubleshooting the network
From FBSD_tips
DRAFT - INCOMPLETE - DRAFT - INCOMPLETE
Contents |
[edit] Rationale
This document is designed in a flow chart like structure to step through a debugging process for network connectivity, from the lowest level to increasingly higher levels. It only takes into account the simplest cases(s) and is by no means exhaustive.
[edit] Physical connectivity
First, you have to find your primary interface, ifconfig can assist you here.
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=b<RXCSUM,TXCSUM,VLAN_MTU> ether 00:0e:0c:59:03:36 media: Ethernet autoselect (1000baseTX <full-duplex>) status: active fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500 options=8<VLAN_MTU> ether 02:00:00:05:34:f4 ch 1 dma -1 plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000
First, you look for an interface that has a media type of Ethernet. lo0 is the defauly loopback interface and should be present always so we ignore it now. plip0 is an IP over parallel port interface and we will ignore it too. If you have a firewire interface you may also see fwe0, an IP over firewire interface which we will also ignore for now. The em0: interface is of the correct media type. On the ethernet interface you need to see a status of active.
[edit] Possible issues
- Not cabled, not cabled correctly.
- Try a different cable
- Make sure everything is seated correctly
- Problem with the switch, hub or other network equiptment.
- Change ports
- The NIC could be defective or not completely supported by the driver.
- Try a different NIC
- Auto negotiation could be failing.
- Try setting it manually e.g. media: Ethernet autoselect (1000baseTX <full-duplex>)
[edit] IP connectivity
There are 2 ways you can get your IP information, statically assigned at the system startup or obtained via DHCP from a serbver on your LAN. Choose one (but not both) of the following methods :
[edit] 1) Static assignment
In /etc/rc.conf put this line or make sure that it is correct.
ifconfig_em0="inet 10.1.1.1 netmask 255.255.255.0"
Of course, substitute your own :
- Interface instead of em0
- IP address instead of 10.1.1.1
- netmask instead of 255.255.255.0
[edit] 2) DHCP
In /etc/rc.conf put this line or make sure it is correct.
ifconfig_em0="DHCP"
The best way to see these changes take effect is to reboot. Once you are back up, can you ping your own IP address? If not, a very common cause is a misconfigured firewall, disable any firewalls and try again.
To disable IPFW (NOTE: do not do this while logged in over the network, see Firewalling while logged in over the network) :
ipfw -f flush ipfw add pass all from any to any
[edit] Routing
Do you have a default gateway set up? Here is one way to find out :
> netstat -rnf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.100.1.1 UGS 0 3860965 em0
10.100.1/24 link#1 UC 0 0 em0
10.100.1.1 00:04:ac:2e:2c:5a UHLW 2 2470549 em0 1161
10.100.1.139 00:17:f2:ee:50:dc UHLW 1 18 em0 1196
127.0.0.1 127.0.0.1 UH 0 28853 lo0
Here 10.200.1.1 is the default router. Try pinging the default router, you should see replies.
> ping -c 4 10.100.1.1 PING 10.200.1.1 (10.200.1.1): 56 data bytes 64 bytes from 10.100.1.1: icmp_seq=0 ttl=64 time=0.192 ms 64 bytes from 10.100.1.1: icmp_seq=1 ttl=64 time=0.185 ms 64 bytes from 10.100.1.1: icmp_seq=2 ttl=64 time=0.185 ms 64 bytes from 10.100.1.1: icmp_seq=3 ttl=64 time=0.192 ms --- 10.100.1.1 ping statistics --- 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.185/0.189/0.192/0.003 ms
If you don't have a default router on a network, ping a maching that you know to be up on the same network as the interface in question.
[edit] Possible issues
If you get timeout, your trouble couls be :
- Hardware - cabling, bad port on switch/hub
- Try a different cable
- Try a different port
- Signalling - e.g. incorrent duplex, incorrect speed
- Manually set the speed
- Manually set the duplex
- Netmask - wrong netmask on host or router
- Check that they match
[edit] Adding a default router
If you do not have your default router set this is how to set one, replacing your IP for 10.100.1.1. If you get your IP via DHCP this should not apply to you.
In /etc/rc.conf : defaultrouter="10.100.1.1"
Reboot to have this setting take effect.
[edit] Name resolution
Set the hostname.
Do you have a source for name resolution?
Are there local hosts that must go into /etc/hosts?
[edit] Internet services
Can you open connections to typical internet services?
