Ubuntu networking

From Ever changing code
Revision as of 18:29, 26 August 2013 by Pio2pio (talk | contribs) (Created page with "=== Networking Tools === <code>nm-tool</code> - utility to report NetworkManager state and devices, it provides information about NM, device and wireless networks. === Ethern...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Networking Tools

nm-tool - utility to report NetworkManager state and devices, it provides information about NM, device and wireless networks.

Ethernet Interfaces

Identify Ethernet Interfaces

lshw shows here an interface with the logical name of eth0 along with bus information, driver details and all supported capabilities

sudo lshw -class network
 *-network
      description: Ethernet interface
      product: BCM4401-B0 100Base-TX
      vendor: Broadcom Corporation
      physical id: 0
      bus info: pci@0000:03:00.0
      logical name: eth0
      version: 02
      serial: 00:15:c5:4a:16:5a
      size: 10MB/s
      capacity: 100MB/s
      width: 32 bits
      clock: 33MHz
      capabilities: (snipped for brevity)
      configuration: (snipped for brevity)
      resources: irq:17 memory:ef9fe000-ef9fffff
Ethernet Interface Logical Names

Interface logical names are configured in the file /etc/udev/rules.d/70-persistent-net.rules. If you would like control which interface receives a particular logical name, find the line matching the interfaces physical MAC address and modify the value of NAME=ethX to the desired logical name. Reboot the system to commit your changes.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:c5:4a:16:5a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:c5:4a:16:5b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
Ethernet Interface Settings

ethtool is a program that displays and changes Ethernet card settings such as auto-negotiation, port speed, duplex mode, and Wake-on-LAN. It is not installed by default, but is available for installation in the repositories.

sudo apt-get install ethtool

The following is an example of how to view supported features and configured settings of an Ethernet interface.

sudo ethtool eth0
Settings for eth0:
       Supported ports: [ TP ]
       Supported link modes:   10baseT/Half 10baseT/Full 
                               100baseT/Half 100baseT/Full 
                               1000baseT/Half 1000baseT/Full 
       Supports auto-negotiation: Yes
       Advertised link modes:  10baseT/Half 10baseT/Full 
                               100baseT/Half 100baseT/Full 
                               1000baseT/Half 1000baseT/Full 
       Advertised auto-negotiation: Yes
       Speed: 1000Mb/s
       Duplex: Full
       Port: Twisted Pair
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: on
       Supports Wake-on: g
       Wake-on: d
       Current message level: 0x000000ff (255)
       Link detected: yes

Changes made with the ethtool command are temporary and will be lost after a reboot. If you would like to retain settings, simply add the desired ethtool command to a pre-up statement in the interface configuration file /etc/network/interfaces.

The following is an example of how the interface identified as eth0 could be permanently configured with a port speed of 1000Mb/s running in full duplex mode.

auto eth0
iface eth0 inet static
pre-up /usr/sbin/ethtool -s eth0 speed 1000 duplex full