Linux 7 Configuring a USB Network Adapter: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[Linux 7 Network Configuration#Configuring_a_USB_Network_Adapter]]
* [[Linux 7 Network Configuration#Configuring_a_USB_Network_Adapter]]
=Overview=
A USB network adapter is usually detected automatically upon attachment. <tt>/var/log/messages</tt> is updated as follows:
<pre>
Jan  4 22:01:58 now510 kernel: usb 1-2: new high-speed USB device number 2 using xhci_hcd
Jan  4 22:01:58 now510 kernel: usb 1-2: New USB device found, idVendor=05ac, idProduct=1402
Jan  4 22:01:58 now510 kernel: usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan  4 22:01:58 now510 kernel: usb 1-2: Product: Apple USB Ethernet Adapter
Jan  4 22:01:58 now510 kernel: usb 1-2: Manufacturer: Apple Inc.
Jan  4 22:01:58 now510 kernel: usb 1-2: SerialNumber: 282AE1
Jan  4 22:01:59 now510 kernel: asix 1-2:1.0 eth0: register 'asix' at usb-0000:0f:00.0-2, ASIX AX88772 USB 2.0 Ethernet, ac:7f:3e:e5:40:39
Jan  4 22:01:59 now510 kernel: usbcore: registered new interface driver asix
Jan  4 22:01:59 now510 NetworkManager[842]: <warn>  (eth0): failed to find device 4 'eth0' with udev
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (eth0): new Ethernet device (carrier: OFF, driver: 'asix', ifindex: 4)
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (eth0): interface index 4 renamed iface from 'eth0' to 'enp15s0u2'
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (enp15s0u2): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (enp15s0u2): device state change: unavailable -> disconnected (reason 'none') [20 30 0]
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready
</pre>
and the new interface (enp15s0u2) shows up in the list reported by <tt>ip</tt>:
<pre>
[root@now510 ~]# ip addr show
1: lo: [...]
2: enp0s25: [...]
3: wlp3s0: [...]
4: enp15s0u2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether ac:7f:3e:e5:40:39 brd ff:ff:ff:ff:ff:ff
</pre>
Up to this point, the network cable was not connected. Upon connection, <tt>/var/log/messages</tt> show:
<pre>
Jan  4 22:20:28 now510 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp15s0u2: link becomes ready
Jan  4 22:20:28 now510 NetworkManager[842]: <info>  (enp15s0u2): link connected
Jan  4 22:20:28 now510 kernel: asix 1-2:1.0 enp15s0u2: link up, 100Mbps, full-duplex, lpa 0xC5E1
</pre>
=Configuration=
In order to activate the network interface during the next network subsystem restart, create a <tt>/etc/sysconfig/network-scripts/ifcfg-enp15s0u2</tt> with the following content:
<pre>
TYPE="Ethernet"
NAME="enp15s0u2"
DEVICE="enp15s0u2"
IPADDR="192.168.1.9"
PREFIX="24"
GATEWAY="192.168.1.1"
DNS1="192.168.1.1"
ONBOOT="yes"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
</pre>
and either reboot.
Make sure you use the network interface name as identified during the USB detection.
<font color=red>
=To Investigate=
Can I avoid reboot and simply
<pre>
systemctl network restart
</pre>
?
</font>

Latest revision as of 06:48, 5 January 2016

Internal

Overview

A USB network adapter is usually detected automatically upon attachment. /var/log/messages is updated as follows:

Jan  4 22:01:58 now510 kernel: usb 1-2: new high-speed USB device number 2 using xhci_hcd
Jan  4 22:01:58 now510 kernel: usb 1-2: New USB device found, idVendor=05ac, idProduct=1402
Jan  4 22:01:58 now510 kernel: usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan  4 22:01:58 now510 kernel: usb 1-2: Product: Apple USB Ethernet Adapter
Jan  4 22:01:58 now510 kernel: usb 1-2: Manufacturer: Apple Inc.
Jan  4 22:01:58 now510 kernel: usb 1-2: SerialNumber: 282AE1
Jan  4 22:01:59 now510 kernel: asix 1-2:1.0 eth0: register 'asix' at usb-0000:0f:00.0-2, ASIX AX88772 USB 2.0 Ethernet, ac:7f:3e:e5:40:39
Jan  4 22:01:59 now510 kernel: usbcore: registered new interface driver asix
Jan  4 22:01:59 now510 NetworkManager[842]: <warn>  (eth0): failed to find device 4 'eth0' with udev
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (eth0): new Ethernet device (carrier: OFF, driver: 'asix', ifindex: 4)
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (eth0): interface index 4 renamed iface from 'eth0' to 'enp15s0u2'
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (enp15s0u2): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready
Jan  4 22:01:59 now510 NetworkManager[842]: <info>  (enp15s0u2): device state change: unavailable -> disconnected (reason 'none') [20 30 0]
Jan  4 22:01:59 now510 kernel: IPv6: ADDRCONF(NETDEV_UP): enp15s0u2: link is not ready

and the new interface (enp15s0u2) shows up in the list reported by ip:

[root@now510 ~]# ip addr show
1: lo: [...]
2: enp0s25: [...]
3: wlp3s0: [...]
4: enp15s0u2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether ac:7f:3e:e5:40:39 brd ff:ff:ff:ff:ff:ff

Up to this point, the network cable was not connected. Upon connection, /var/log/messages show:

Jan  4 22:20:28 now510 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp15s0u2: link becomes ready
Jan  4 22:20:28 now510 NetworkManager[842]: <info>  (enp15s0u2): link connected
Jan  4 22:20:28 now510 kernel: asix 1-2:1.0 enp15s0u2: link up, 100Mbps, full-duplex, lpa 0xC5E1

Configuration

In order to activate the network interface during the next network subsystem restart, create a /etc/sysconfig/network-scripts/ifcfg-enp15s0u2 with the following content:

TYPE="Ethernet"
NAME="enp15s0u2"
DEVICE="enp15s0u2"
IPADDR="192.168.1.9"
PREFIX="24"
GATEWAY="192.168.1.1"
DNS1="192.168.1.1"
ONBOOT="yes"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"

and either reboot.

Make sure you use the network interface name as identified during the USB detection.

To Investigate

Can I avoid reboot and simply

systemctl network restart

?