Pages

Tuesday, 25 June 2013

Network connection troubleshooting

Error message: eth0 interface on and off once a while
tail -f /var/log/messages:
dmesg | less: 
e100: eth0: e100_watchdog: link down
e100: eth0: e100_watchdog: link up, 100Mbps, full-duplex

[root@localhost ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes

[root@localhost ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:02:B3:4D:BD:6B 
          inet addr:172.16.95.27  Bcast:172.16.95.255  Mask:255.255.255.0
          inet6 addr: fe80::202:b3ff:fe4d:bd6b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:720866 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1243358 errors:19788 dropped:0 overruns:0 carrier:19788
          collisions:287 txqueuelen:1000
          RX bytes:61520720 (58.6 MiB)  TX bytes:1164775778 (1.0 GiB)

[root@localhost ~]# mii-tool -v eth0
eth0: negotiated 100baseTx-FD flow-control, link ok
  product info: Intel 82555 rev 4
  basic mode:   autonegotiation enabled
  basic status: autonegotiation complete, link ok
  capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
  link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control

Reset auto-negotiation
[root@localhost ~]#  mii-tool -r eth0

If all fail, replace the cable.


Some clients in the subnet has cached the IP with old MAC address, I want them to update the new value by doing a ARP broadcast, is it possible in Linux?

Yes, it's called "Unsolicited ARP" or "Gratuitous ARP". Check the manpage for arping for more details, but the syntax looks something like this:
arping -U 192.168.1.101
If you're spoofing an address, you may need to run this first:
echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
Finally, because of its spoofing ability, sending Unsolicited ARP packets is sometimes considered a "hostile" activity, and may be ignored, or might lead to being blocked by some third-party firewalls.

Usage Example:

 The problem is I accidentally assign a new machine with an used IP, so they conflict the IP. I can't access the old machine using SSH. Now I remotely shutdown the wrong (new) machine, but I still cannot access the old machine, I suspect the router has cached MAC address in its ARP table.

No comments:

Post a Comment