date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,570,710,319,000 |
I'm trying to configure on Linux bonding active-backup (2 physical interfaces eth2 and eth3, one is used) but also with two VLANs, and later connect it to internal bridges.
I see two options for connections, both are working,
First method works fine and looks easy, but all VLANs are routed through single physical interface (lower bandwidth)
The second is problematic (for me), but I prefer this second, because it allows to route one VLAN through eth2, and second VLAN through eth3 (greater bandwidth with fault-tolerant).
I don't want bond-mode 4 = 802.3ad AKA LACP (servers are connected to different Cisco switches, I have heard and seen some problems with such configurations), so bond-mode active-backup need to be enough.
# 1. Two NICs agregated to one bonding, and then separate VLANS from bonding interface:
eth2 bond1.10 - xenbr10
> bond1 <
eth3 bond1.15 - xenbr15
# 2. VLANs separated form physical NIC, then aggregate to separate binding interfaces.
eth2.15 ...
eth2 <
eth2.10
> bond10 - xenbr10
eth3.10
eth3 <
eth3.15 ...
I have server with Debian 11, 2 network interfaces, installed packages vlan, bridge-utils and ifenslave (in version 2.13 from testing repo, due to this problem from 2.12). Modules 8021q and bonding are loaded in system.
Question 1: Is first option of connection best-practices here? And why? I'm asking, because most (or maybe all) tutorials found on internet is about first connection (even Debian Wiki)
Option 1
This is working fine, I can do it both from console or by config file. Downside of this: both VLANs are sent always using single interface. My current /etc/network/interfaces (non-important elements removed)
iface eth2 inet manual
iface eth3 inet manual
auto bond1
iface bond1 inet manual
bond-slaves eth2 eth3
bond-mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
iface bond1.10 inet manual
vlan-raw-device bond1
iface bond1.15 inet manual
vlan-raw-device bond1
auto xenbr10
iface xenbr10 inet static
address 1.2.3.4/24
bridge_ports bond1.10
After rebooting system this config is working correct, but I would like to configure and use second option.
Option 2: works from shell, unable to do from config file
I can do this configuration from the command line:
ifconfig eth2 up
ifconfig eth3 up
#setting up VLANs
ip link add link eth2 name eth2.10 type vlan id 10
ip link add link eth3 name eth3.10 type vlan id 10
#creating bonding interface with 2 slaves NIC
ip link add name bond1 type bond mode active-backup
ip link set dev eth2.10 down
ip link set dev eth3.10 down
ip link set master bond10 dev eth2.10
ip link set master bond10 dev eth3.10
ip link set up dev bond10
ip link set dev eth2.10 up
ip link set dev eth3.10 up
### Bridge + bonding
brctl addbr xenbr10
brctl addif xenbr10 bond10
ip addr add 1.2.3.4/24 dev xenbr10
ip link set dev xenbr10 up
And network is up:
cat /proc/net/bonding/bond10
Ethernet Channel Bonding Driver: v5.10.0-12-amd64
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2.10
MII Status: up
(..)
Slave Interface: eth2.10
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: (..)
Slave Interface: eth3.10
MII Status: up
(..)
But I'cant create config file to make this permanent. I tried many options like this, but with no luck. If i connect interface eth2.10 directly to some xenbr10 it works.
iface eth2.10 inet manual
vlan-raw-device eth2
iface eth3.10 inet manual
vlan-raw-device eth3
bond-master bond10 #It doesn't change nothing, for testing
auto bond10
iface bond10 inet manual
bond-slaves eth2.10 eth3.10
#bond-slaves none
bond-mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
auto xenbr10
iface xenbr10 inet static
address 1.2.3.4/24
bridge_ports bond1.10
After rebooting system, usually I get errors like this:
ifup[686]: Failed to enslave eth2.10 to bond10. Is bond10 ready and a bonding interface ?
Question 2: What is wrong with this config? I've tried
set eth2.10 config above or below the bond10 configuration,
use bond-master bond10 entry for eth2.10 and bond-slaves none in bond10 config part
use bond-slaves eth2.10 eth3.10 entry in bond10 part
use auto eth2.10
|
After day of searching and testing I found two solutions. First config maybe not elegant, but works:
# Using default ifupdown on Debian 11:
# Set up NIC and NIC's alias with VLAN:
auto eth2
iface eth2 inet manual
post-up ip link add link eth2 name eth2.10 type vlan id 10
post-up ip link add link eth2 name eth2.15 type vlan id 15
auto eth3
iface eth3 inet manual
post-up ip link add link eth3 name eth3.10 type vlan id 10
post-up ip link add link eth3 name eth3.15 type vlan id 15
auto bond533
iface bond533 inet manual
bond-slaves eth2.533 eth3.533
bond-mode active-backup
# (...)
Thanks to A.B.'s comment (link) I found even better solution using ifupdown2. Beaware: during installation of this package (it removes older ifupdown) I've lost network until reboot (perhaps restarting network would be enough, not tested).
# After installing ifupdown2:
# No need to set up physical NIC or VLAN interface!
#iface eth2.10 inet manual
# vlan-raw-device eth2
#iface eth2.533 inet manual
# vlan-raw-device eth2
#Set up bonding and brige (the same as with ifupdown)
auto bond533
iface bond533 inet manual
bond-slaves eth2.533 eth3.533
bond-mode active-backup
# (...)
It is little bit weird for me that such simple config works correct. It looks that ifupdown2 can set up necessary bond-slaves network interfaces (even vlans) without configuring them earlier.
I was based on the configuration on this page:
https://docs.nvidia.com/networking-ethernet-software/knowledge-base/Configuration-and-Usage/Network-Interfaces/Compare-ifupdown2-with-ifupdown/
| Bonding with VLAN and bridge on Debian 11 |
1,570,710,319,000 |
I have disabled 802.1Q module in my Cento 7 VM and did arping through one of the interface to it's gateway IP and captured packet traffic on that interface from the same VM.
[root@vm1 ~]# lsmod | grep 8021q
8021q 33208 0
garp 14384 1 8021q
mrp 18542 1 8021q
[root@vm1 ~]# modprobe -r 8021q
[root@vm1 ~]# lsmod | grep 8021q
My expectation was that exgress packets wouldn't have any VLAN tags.
The machine I pinged is the windows host and also VLAN tags support was not added in the windows host. So, I also expect that the ingress packets also won't be having any VLAN tags.
But I see VLAN tag with default ID: 1 on both the packets.
So, is the module 8021.q in Centos 7 is obselete and not needed at all?
Edit 1:
I checked again by analyzing ping traffic. For ping, there is no VLAN tag ids added (with and without 8021q module loaded)
|
Issue is with the decoding type I have selected. I selected decoding as VLAN for link and then selected decoding as do not decode. Thus somehow ended up with the above wrong decoding.
I just need to clear decoding to see the actual data and the VLAN tag is then added only when the 8021q module is loaded + when a VLAN tagged interface is created.
| Why do I see VLAN tag in my ARP IP packet even though I have disabled the module 8021.q in CentOS 7? |
1,570,710,319,000 |
I am trying to set up a honeypot server in different VLANs. The company I work in has 3 VLANS: 10, 20, 30. My goal is to use a Raspberry Pi to host a simple honeypot and broadcast sniffer (for ARP and DHCP) in each of those VLANs.
I am connected via trunk to main switch, and for each VLANs, I think I would need a virtual interfaces be able to talk inside those:
VLAN 10: 192.168.1.0/24 (I wish to have 192.168.1.100 here)
VLAN 20: 192.168.2.0/24 (I wish to have 192.168.2.100 here)
VLAN 30: 192.168.60.0/24 (I wish to have 192.168.60.100 here)
As far I know I can use like eth0:1, eth0:2 and eth0:3, and assign basic IP info to each of them. Will this work?
|
For this "simple" case (ie not involving bridges and bridge ports, overlapping VLANs or any other fancy setup), you just have to create three vlan sub-interfaces with their default settings. Once done you can now consider you have three interfaces as usual and forget about the physical interface or VLANs. Default settings will just tag and untag the single vlan id automatically on each interface. One naming convention among others for those interfaces is to add the vlan id after the base interface name with a dot between.
ip link add eth0.10 link eth0 type vlan id 10
ip link add eth0.20 link eth0 type vlan id 20
ip link add eth0.30 link eth0 type vlan id 30
ip link set eth0 up
ip link set eth0.10 up
ip link set eth0.20 up
ip link set eth0.30 up
That's it. You can now configure them as usual as if they were basic ethernet interfaces without having to consider VLANs anymore. Please forget ifconfig which has been obsolete for 10 years and switch to ip ... instead. The use of : is a leftover from this and is used with ifconfig for setting additional IPs on the same interface, not for adding additional interfaces.
ip address add dev eth0.10 192.168.1.100/24
ip address add dev eth0.20 192.168.2.100/24
ip address add dev eth0.30 192.168.60.100/24
Now for example tcpdump will display ethertype 802.1Q frames on eth0, but only usual (for example) ethertype ARP or ethertype IPv4 frames on eth0.10: the kernel handles automatic tagging/untagging for the vlan sub-interfaces. Avoid having special network tools like DHCP listening directly on eth0, some can be confused with the tagging.
Any problem you will then likely encounter will not be caused by VLANs but by routing: you can't expect a multi-homed setting like this to freely use any of its IPs to anywhere without policy routing. As long as you don't try to have more than one default gateway or reach the same destination using two different paths, you shouldn't need policy routing.
Instead of manually configuring interfaces you should consider using system settings to create and configure those interfaces. For example Debian's ifupdown's vlan extended options, or NetworkManager both can create and configure those interfaces.
Also, as commented by Rui F Ribeiro, you should be using hardware able to cope with the traffic, and a RPi might not be enough.
| Hosting a simple honeypot server in each of 3 VLANs using one ethernet port |
1,570,710,319,000 |
A discussion with the manufacturer stated this configured is not supported or even possible with the router's hardware and OS.
|
Interpretation of the default setup so far:
The Realtek switch already tags frames with VLAN 1, the other LAN ports are tagged by the Broadcom switch and show up tagged on port 8, which is connected to the SoC. The WAN port shows up untagged on port 8 (if that's what the "u" means, the robocfg source is unhelpful here, and I couldn't find a datasheet).
Guess: The SoC ethernet driver associates untagged frames with eth0, and frames tagged with VLAN 1 with eth1, and drops frames with all other VLAN tags. Which means you can configure the Broadcom switch all you want, you won't be able to isolate any ports using VLAN tags.
That behaviour is testable by removing eth0 and eth1 from all bridges, playing around with the VLAN ids for ... 8t and ... 8u a bit, and send in packets without and with different ids from both sides.
So the task is to find out what the SoC ethernet driver actually does, and if it's configurable in any way. If you could tell it, say, to route VLAN id 10 to eth2 and VLAN id 20 to eth3, you'd be all set.
If it's not the SoC ethernet driver, but, say, eth1 is already a VLAN slave of eth0 and the kernel does the redirection, then so much the better.
Look in dmesg after boot for any hints for eth0 and eth1, find out where /sys/class/net/eth[01]/device points to and which kernel module is responsible, etc. That needs a bit of sleuthing and looking at various things.
Edit
1) The Realtek RTL8365MB switch has its own kernel module rtl8365mb. Source (possibly different variant) is available. Datasheet of a very similar chip is available. With all this info, it should be possible to write something similar to robocfg/swconfig and control the switch. Apparently some thought about that, but I couldn't google any successes.
2) According to the robocfg source, the VLAN table implementation of the Broadcom and of the Realtek chip seem to be similar enough to conclude from 8.12.6 in the datasheet that t means "add tag for egress" and u means "remove tag unconditionally for egress".
3) Your SoC chipset seems to be a BCM47XX with three on-chip etherports, two of which seem to be to used somewhere else, and on is eth0:
fwd0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 7.14.131.56 (r641653)
fwd1: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 7.14.131.56 (r641653)
eth0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 7.14.131.56 (r641653)
The controlling module is et, the source (possibly a different variant) is available.
It's not entirely clear to me if eth1 and eth2 also belong to this driver, and are just registered later, or if they belong to bcmdhd (WLAN), and/or if they are renamed by udev at some stage:
Dongle Host Driver, version 1.363.45.58013 (r651509)
Compiled in drivers/net/wireless/bcmdhd on Jun 21 2017 at 10:36:36
Register interface [eth1] MAC: 34:97:f6:20:1b:a8
...
Dongle Host Driver, version 1.363.45.58013 (r651509)
Compiled in drivers/net/wireless/bcmdhd on Jun 21 2017 at 10:36:36
Register interface [eth2] MAC: 34:97:f6:20:1b:ac
So the next step is to sort out all the network interfaces. Please edit question with output of ip -d link, and also ls -l /sys/class/net/*/lower* and ls -l /sys/class/net*. If that doesn't provide sufficient information, udevadm info -a -p /sys/class/net/eth0 and udevadm info -a -p /sys/class/net/eth1 would also be interesting, assuming the router uses udev.
Another thing to look for is where the configuration information sits, so modinfo rtl8365mb, modinfo et may produce something interesting, as well as find /etc | xargs grep eth or similar things.
As you can see, I am fishing for information; this is slow and not easy to do remotely without the system in front of me. Feel free to do these or additional steps in any ways that sorts things out. The goal is to find the place that says "eth1 is somehow associated to eth0 with VLAN tag 1".
| Isolating ports on a router |
1,490,767,764,000 |
When creating network interface files ifcfg-tttN (ttt in {eth,em,bond}) in /etc/sysconfig/network-scripts/ on RHEL/CentOS servers, what are the different values for VLAN_NAME_TYPE and what do they mean?
|
The parameter VLAN_NAME_TYPE defines the naming convention that you want to use for the VLAN device names, and thus for the file names.
Here are a few assumptions:
- I'm using interface eth0. The configuration is the same for a bonding interface, where the physical device name would be bond0, or for the new Dell naming convention emN, pSpN see RedHat manual.
- The VLAN id for the subnet 10.0.20.0/24 is 12.
Here is the content of my ifcfg- file, to which I will append the VLAN parameters.
VLAN=yes
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=no
IPADDR=10.0.20.2
NETMASK=255.255.255.0
TYPE=Ethernet
MTU=1500
IPV6INIT=no
VLAN_NAME_TYPE=<see below>
DEVICE=<see below>
PHYSDEV=<optional, see below>
Possible values for VLAN_NAME_TYPE and their associated parameters are below.
The name of the file has to match the content of the DEVICE parameter with the prefix ifcfg-.
Note that if the parameter DEVICE doesn't contain the physical device, the parameter PHYSDEV is mandatory.
VLAN_NAME_TYPE_RAW_PLUS_VID
Name will look like: eth0.0012
File name /etc/sysconfig/network-scripts/ifcfg-eth0.0012
DEVICE=eth0.0012
VLAN_NAME_TYPE=VLAN_NAME_TYPE_RAW_PLUS_VID
VLAN_NAME_TYPE_PLUS_VID_NO_PAD
Name will look like: vlan12
File name /etc/sysconfig/network-scripts/ifcfg-vlan12
PHYSDEV=eth0
DEVICE=vlan12
VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD
VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD (this is the default)
Name will look like: eth0.12
File name /etc/sysconfig/network-scripts/ifcfg-eth0.12
DEVICE=eth0.12
VLAN_NAME_TYPE=VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
VLAN_NAME_TYPE_PLUS_VID
Name will look like: vlan0012
File name /etc/sysconfig/network-scripts/ifcfg-vlan0012
PHYSDEV=eth0
DEVICE=vlan0012
VLAN_NAME_TYPE=VLAN_NAME_TYPE_PLUS_VID
Source: Source of the 8021q module for the linux kernel 2.6.32
| What are the values for VLAN_NAME_TYPE when setting up a VLAN interface on Linux |
1,490,767,764,000 |
I try to setup VLANs on a virtual Debian machine. It's connected to an Cisco 2960 Switch.
The Switch has 3 VLANs (1,100,200) which're allowed the pass the trunk. The Switch Configurations was tested with an other layer2 switch, which was also configured as trunk. It worked perfectly so it has to be the VM.
The 8021q Kernel Module is loaded but "Used by" is set to 0.
The Network Configuration of the Debian Host looks like:
auto eth0.1
iface eth0.1 int static
address 192.168.0.1
netmask 255.255.255.0
vlan_raw_device eth0
auto eth0.100
iface eth0.100 int static
address 192.168.1.1
netmask 255.255.255.0
vlan_raw_device eth0
auto eth0.200
iface eth0.200 int static
address 192.168.2.1
netmask 255.255.255.0
vlan_raw_device eth0
When I try to ping the IP of the Switch I get back
From 192.168.1.1 icmp_swq=1 Destination Host Unreachable
I would realy appreciate Help!
|
First of all, is the host machine network interface is connected to the trunked port ?
you can test this simple with the command vconfig to create the vlan interface on the fly,
# vconfig add [interface-name] [vlan-id]
# ( you will need 8021q module loaded )
# -e.g.
vconfig add em1 100
ip addr show
...
12: em1.100@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether f0:de:f1:54:d8:55 brd ff:ff:ff:ff:ff:ff
inet6 fe80::f2de:f1ff:fe54:d855/64 scope link
valid_lft forever preferred_lft forever
set up the ip address and make sure you can communicate on this vlan
EDIT:
There 2 ways you can access you networks,
Create the vlan interfaces on the host and bridge to them
Bridge to the trunk interface and then create the vlan on the vm
| Debian VLAN (8021q) Configuration doesn't work |
1,490,767,764,000 |
I am working on an embedded system that will connect a processor running Linux to an Ethernet switch via a "conduit" Ethernet link (e.g. eth0) using the port-based Ethertype DSA (Marvell) frame tagging protocol, so that the Linux kernel will present the userspace with separate Ethernet links for each of the switch's user ports (e.g. lan1, lan2, lan3).
As I understand it this is usually done via a fixed phy-less conduit (e.g. xMII) and an MDIO link between the processor and the switch so that the processor can configure and control the physical user ports.
I want to do some software development ahead of receiving the hardware, so I want to "fake" the MDIO link, or in some other way configure the kernel, such that it uses port-based EDSA frame tagging over an ordinary (PHY-equipped) Ethernet port, resulting in a frame layout like this:
7 6 5 4 3 2 1 0
. . . . . . . . .
0 +---+---+---+---+---+---+---+---+
| Ether Destination Address |
+6 +---+---+---+---+---+---+---+---+
| Ether Source Address |
+6 +---+---+---+---+---+---+---+---+ --
| Prog. DSA Ether Type [15:8] | |
+1 +---+---+---+---+---+---+---+---+ |
| Prog. DSA Ether Type [7:0] | | EDSA tag
+1 +---+---+---+---+---+---+---+---+ |
| Reserved (0x00 0x00) | |
+2 +---+---+---+---+---+---+---+---+ | --
| Mode |b29| Switch Device | | |
+1 +---+---+---+---+---+---+---+---+ | |
| Switch Port |b18|b17|b16| | |
+1 +---+---+---+---+---+---+---+---+ | | DSA tag
| PRI [2:0] |b12| VID [11:8] | | |
+1 +---+---+---+---+---+---+---+---+ | |
| VID [7:0] | | |
+1 +---+---+---+---+---+---+---+---+ -- --
| Ether Length/Type |
+2 +---+---+---+---+---+---+---+---+
. . . . . . . . .
...where Switch Port corresponds to the switch's user port number.
The documentation of kernel modules dsa_loop and dsa_loop_bdinfo imply that these might be suitable, and the source code seems to link .netdev = "eth0" to some user ports ("lan1".."lan4") but even though I can modprobe dsa_loop into my kernel I don't see any virtual port devices created by the kernel (I am using ifconfig -a to show net devices).
~# lsmod
Module Size Used by
dsa_loop 16384 0
dsa_core 118784 1 dsa_loop
When doing the modprobe dsa_loop I see a call to dsa_loop_init but no call to dsa_loop_drv_probe.
So I guess I have several questions:
Are the dsa_loop and dsa_loop_init modules intended to allow EDSA tagging to be performed on a "normal" Ethernet link?
How are these modules intended to be used?
Are there any other ways of configuring Linux to do this without access to the switch MDIO?
|
OP said:
Are the dsa_loop and dsa_loop_init modules intended to allow EDSA tagging to be performed on a "normal" Ethernet link?
Yes.
The problem I was running into is the result of an ordering problem between these loadable modules and the fixed-phy layer code which was being compiled as a built-in module.
When the kernel configuration was changed to compile them as build-in modules along with the fixed-phy code the problem went away and I could see calls to dsa_loop_drv_probe.
| Is it possible to configure Ethertype DSA VLAN tagging on an Ethernet port that has a real PHY connection to the outside world? |
1,490,767,764,000 |
I am attempting to use ebtables to match a specific VLAN ID (non zero) along with a specific VLAN PCP value.
I tried the following:
ebtables -A FORWARD -p 0x8100 --vlan-id 5 --vlan-prio 3 -j DROP
Ebtables does not complain (as the check has been commented out in ebtables), but the rule reported back using "ebtables -L" only contained the match for VLAN ID.
I did see in the ebtables man page that when vlan-prio is used, the vlan-id must either be zero or not specified.
Why this is the case? I have so far not been able to find any references to support that the ID must be zero when the priority bits are used.
Is there anyway to make this possible, aside from creating a separate chain to match the vlan-id and vlan-prio separately?
|
The explanation isn't really making sense, but here it is in the kernel at linux/net/bridge/netfilter/ebt_vlan.c:
if (GET_BITMASK(EBT_VLAN_ID)) {
if (!!info->id) { /* if id!=0 => check vid range */
if (info->id > VLAN_N_VID) {
pr_debug("id %d is out of range (1-4096)\n",
info->id);
return -EINVAL;
}
/* Note: This is valid VLAN-tagged frame point.
* Any value of user_priority are acceptable,
* but should be ignored according to 802.1Q Std.
* So we just drop the prio flag.
*/
info->bitmask &= ~EBT_VLAN_PRIO;
}
/* Else, id=0 (null VLAN ID) => user_priority range (any?) */
}
So as far as I understand, kernel's side of ebtables enforces ignoring the prio (PCP) flag/option when receiving the rule with a non-null VLAN ID (VID), so I don't see how you can succeed without using an user chain with two rules as workaround.
It's quite difficult to be able to consult without account any 802.1Q official document, but I couldn't find in the version from 2005 I could get to see an explanation for this comment. I understand it's written that VID=0 means there's only the PCP, but not that a PCP implies VID=0 nor that there is any interaction between both parameters (I mean there's nothing written about).
Note: nftables doesn't have this limitation:
nft add table bridge filter
nft add chain bridge filter forward '{ type filter hook forward priority -200; policy accept; }'
nft add rule bridge filter forward ether type vlan vlan id 5 vlan pcp 3 counter drop
Will give back what was provided (debug bytecode included, here shown in little-endian, hence 0x81 instead of 0x8100 etc.):
# nft --debug=netlink list chain bridge filter forward -a
bridge filter forward 2
[ payload load 2b @ link header + 12 => reg 1 ]
[ cmp eq reg 1 0x00000081 ]
[ payload load 2b @ link header + 14 => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x0000ff0f ) ^ 0x00000000 ]
[ cmp eq reg 1 0x00000500 ]
[ payload load 1b @ link header + 14 => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x000000e0 ) ^ 0x00000000 ]
[ cmp eq reg 1 0x00000060 ]
[ counter pkts 0 bytes 0 ]
[ immediate reg 0 drop ]
table bridge filter {
chain forward { # handle 1
type filter hook forward priority -200; policy accept;
vlan id 5 vlan pcp 3 counter packets 0 bytes 0 drop # handle 2
}
}
| Matching vlan id and priority with ebtables |
1,490,767,764,000 |
I have developed a server using Linux. The server is a DHCP VLAN server consisting of two VLANs 110 and 120. I am trying to get it working to the client side.
My /etc/network/interfaces for VLAN 110
auto lo
iface lo inet loopback
#VLAN 110
auto enp0s9.110
iface enp0s9.110 inet static
address 192.168.110.1
netmask 255.255.255.0
network 192.168.110.0
broadcast 192.168.110.255
vlan_raw_device enp0s9
My /etc/default/isc-dhcp-server IPv4 Interface
INTERFACESv5="enp0s9.110 enp0s10.120"
My /etc/dhcp/dhcpd.conf configuration for VLAN 110
subnet 192.168.110.0 netmask 255.255.255.0 {
option domain-name testdom.local;
option domain-name-servers ns1.testdom.local;
range 192.168.110.60 192.168.110.100;
option routers 192.168.110.1;
option broadcast-address 192.168.110.255;
}
My client side on Ubuntu terminal for VLAN 110
# VLAN 110 for Ubuntu Client
auto enp0s8
iface enp0s8 inet dhcp
gateway 192.168.110.1
Rebooted the client machine...
I ran ip addr show enp0s8 and I get the address line of
inet 169.254.9.100/16 brd 169.254.255.255 scope link enp0s8:avahi
|
Since, as told in a comment by OP, the client is supposed to get tagged frames, then it's up to the client's system to untag it for normal operations. That means the client needs an additional vlan interface to untag the frames.
The vlan package should be installed, mostly for its plugin vlan-interfaces provided to ifupdown. The untagged interface can then be configured by replacing the network settings with:
# VLAN 110 for Ubuntu Client
auto enp0s8.110
iface enp0s8.110 inet dhcp
gateway 192.168.110.1
When following this convention (raw interface name + vlan id), the interface enp0s8 will be used by default as underlying raw/link interface. This raw interface should then never be assigned an IP because it doesn't make much sense (except if for example you also receive on the wire already untagged packets from an other VLAN, then that's fine).
| DHCP VLAN not working on the client side? |
1,490,767,764,000 |
I have been trying to configure the static IP addresses with Ubuntu 16.04 Dabian version. The network as follows in the graph
I have been failing to ICMP (ping echoing) between the Client and the HTTP server. Is there a way I can connect both of the Server and Client through the router 192.168.1.11 and 192.168.1.12?
My current network interface configuration for 192.168.1.11 and 192.168.1.12 which can ICMP between 192.168.0.16 and 192.168.2.16, but not to 192.168.0.17 from 192.168.1.12 nor to 192.168.2.17 from 192.168.1.11:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
# adding vlan 201 on eno1 - static IP address
auto eno1.201
iface eno1.201 inet static
address 192.168.1.12
netmask 255.255.255.0
vlan-raw-device eno1
post-up ip route add default dev eno1.201
# Adding vlan 101 on eno1 - Static IP address
auto eno1.101
iface eno1.101 inet static
address 192.168.2.16
gateway 192.168.1.10 # switch IP address
netmask 255.255.255.0
vlan-raw-device eno1
My Client static address:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet static
address 192.168.2.17
netmask 255.255.255.0
network 192.168.2.0
gateway 192.168.2.16
Note: I can connect the server and the client when I use IPsec, but when I stop IPsec, they don't ICMP each other.
Edit:
Basic Switch ports configurations
|
Let me quickly explain how VLANs work on the wire: A normal ethernet packet does not have a special field for the VLAN id. VLAN packets, on the other hand are a later extension that uses a new packet format which consists of all fields of the old format plus the additional tag, as definined in 802.1Q. So on the same wire, you can have untagged and tagged packets, and the interpretation is that they "just go past each other" and form different "virtual connections" on top of a physical connection.
So what does your switch do when you define a VLAN group with tagged and untagged ports, say VID=100? If the switch receives packets tagged with 100 on ports 1-4, it will forward them (with the same tag) to (the other numbers in) ports 1-4, and it will strip the tag and forwarded them to ports 5-6. All other tags and untagged packets on port 1-4 are ignored. When it receives untagged packets on ports 5-6, it will forward them untagged to the other port in 5-6, and it will tag them with 100 and forwarded it to port 1-4. All tagged packets received on ports 5-6 are ignored (for this VLAN)
Similarly for VID=201: If it receives packets tagged with 201 on ports 5-6 or 10-11, it will forwarded them tagged to the other ports in 5-6,10-11 and untagged 7-9 etc.
What it doesn't do is to somehow forward packets "between" different VLANs: A packet tagged with 100 and received on port 1-4 is not retagged with 201 "on port 5-6" and forwarded to the VID=201 VLAN, and then again retagged with
101 and forwarded to port 12-15.
The IP address that is assigned in the switch plays no role in this at all: A switch works on OSI level 2, where there are no IP addresses.
DHCP issues are also totally unrelated, this is purely networking.
So in your current configuration, there's no connection between VLAN 100 and VLAN 101 (unless you defined a routing table somewhere), they are completely separate, and hence the server and the client can't ping each other.
If you can explain what you want to achieve with your network configuration, I can try and come up with a solution. Something along the lines:
The client and server should always communicate, the left laptop should only communicate with the server and not the client, the right laptop should only communicate with the client and not the server, the laptops should only communicate via IPsec. All computers have only a single ethernet plug.
Usually in this situation you'd use one VLAN for each "separate" connection, so each computer will be part of several VLANs. Note that is purely administrative, and not secure: Nothing prevents any "rogue" computer from pretending that it is on other VLANs as well. So please mention security concerns, if there are any.
| Network Interface VLAN static addressing |
1,490,767,764,000 |
I want to connect three of my computers in a LAN as nodes in a single VLAN. How do I do it? I know I can create a VLAN using the
vconfig add [interface name] [vlan id]
command. But how do I connect the other computers to the same VLAN?
Is the VLAN id, a local reference in a particular computer or is it visible to all computers in the VLAN?
|
For physical servers, it is best to define a VLAN on your network / infra-structure.
Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.
For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).
Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.
Usually it only may make sense dealing with VLANs at Linux level when:
1) your router is a linux box;
2) you are in a test network.
Nonetheless, if you still insist in creating a VLAN for testing, you have to:
1) load the relevant kernel mode
modprobe 8021q
2) Add the interface to the required VLAN (5 for instance)
vconfig add eth0 5
You will have a result an interface called eth0.5.
All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.
Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.
I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)
Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.
As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.
Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.
For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.
In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.
| Creating a VLAN |
1,490,767,764,000 |
Red Hat 5 Family & Red Hat 6 Family.
I haven't found documentation for anyone who has successfully set up an LACP pair, put two IP addresses on it, and then tagging the primary and Virtual IP address with two different VLAN numbers. Does anyone know of anyone?...
# cat /etc/sysconfig/network-scripts/ifconfig-bond0.123
DEVICE=bond0.123
BOOTPROTO=none
IPADDR=192.168.10.12
NETMASK=255.255.255.0
GATEWAY=192.168.10.1
ONBOOT=yes
USERCTL=no
BONDING_OPTS="mode=802.3ad xmit_hash_policy=layer3+4 lacp_rate=slow miimon=100 updelay=5000 downdelay=5000"
VLAN=yes
# cat /etc/sysconfig/network-scripts/ifconfig-bond0:1.124
DEVICE=bond0:1.124
BOOTPROTO=none
IPADDR=192.168.12.12
NETMASK=255.255.255.0
GATEWAY=192.168.12.1
ONBOOT=yes
USERCTL=no
VLAN=yes
Does the VIP config file need a BONDING_OPTS line, or would it ride the bond configuration from the primary interface file?
Will Red Hat's 8021q module accept instructions to tag an outgoing packet differently based on its real vs. virtual IP address?
Would eth1 and eth2, being set to use bond0 as a master, pay any attention to bond0:1?
Thinking of which, do I need to change the MASTER entry? MASTER=bond0.123?
|
Yes, you can do this, but your configs are a little off.
You don't need bonding information on the VIFs. That's handled a layer below on bond0. In these cases, I normally create an interface (like bond0), and then create my VLAN interfaces on top of that (such as bond0.123 and bond0.124). This works as expected, in that bond0 uses the native VLAN (if there is one) and the VIFs use tagged VLANs.
All that's really needed is that you specify VLAN=yes in the VIF files, as you have done above.
HOWEVER, I don't believe that a VIF will acccept bonding options properly. In fact, I'm almost certain of it in regards to mode 4. Put bonding info on a plain bond interface, then run your VIFs off of that. An example follows:
# cat /etc/sysconfig/network-scripts/ifconfig-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
# cat /etc/sysconfig/network-scripts/ifconfig-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#cat /etc/sysconfig/network-scripts/ifconfig-bond0
DEVICE=bond0
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=none
IPADDR=192.168.10.12
NETMASK=255.255.255.0
GATEWAY=192.168.10.1
ONBOOT=yes
USERCTL=no
BONDING_OPTS="mode=802.3ad xmit_hash_policy=layer3+4 lacp_rate=slow miimon=100 updelay=500 downdelay=200"
# cat /etc/sysconfig/network-scripts/ifconfig-bond0:1.123
DEVICE=bond0:1.123
BOOTPROTO=none
IPADDR=192.168.12.12
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
VLAN=yes
Here we see a bonding master, with a VIF running on top of it. The master may have its own IP (as long as its within the native VLAN - or no IP if there isn't a native VLAN configured on your switch for this bond). VIFs will only operate within the tagged VLAN that their number corresponds to. VIFs do not control bonding in any way.
| Bonded *and* primary & virtual IP addresses *and* VLAN tagged |
1,490,767,764,000 |
In a Ubuntu 20.04 machine connected to my home LAN, I created macvlans under my ethernet device:
$ sudo ip link add macvlan1 link enp37s0 type macvlan mode bridge
$ sudo dhclient macvlan1
$ sudo ip link add macvlan2 link enp37s0 type macvlan mode bridge
$ sudo dhclient macvlan2
By chance, they got the following addresses from DHCP:
macvlan1: 192.168.0.40
macvlan2: 192.168.0.41
I could ping my router from each of them:
$ ping 192.168.0.1 -I macvlan1
PING 192.168.0.1 (192.168.0.1) from 192.168.0.40 macvlan1: 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.713 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.25 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.20 ms
^C
--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
rtt min/avg/max/mdev = 0.713/1.052/1.245/0.240 ms
$ ping 192.168.0.1 -I macvlan2
PING 192.168.0.1 (192.168.0.1) from 192.168.0.41 macvlan2: 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.15 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.13 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.07 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.548 ms
64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=0.619 ms
^C
--- 192.168.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4030ms
rtt min/avg/max/mdev = 0.548/0.903/1.148/0.263 ms
Since they are were created in bridge mode, virtual devices should be connected to each other. But I can't ping one from the other:
$ ping 192.168.0.40 -I macvlan2
PING 192.168.0.40 (192.168.0.40) from 192.168.0.41 macvlan2: 56(84) bytes of data.
^C
--- 192.168.0.40 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4128ms
$ ping 192.168.0.41 -I macvlan1
PING 192.168.0.41 (192.168.0.41) from 192.168.0.40 macvlan1: 56(84) bytes of data.
^C
--- 192.168.0.41 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2039ms
Why I can't ping one from another? How to fix this?
|
The Linux kernel detects incoming packets with a local source address, considers them a routing mistake (packets that a particular computer sends out should never come back), and drops them to prevent network flooding.
Try to put each macvlan into a different network namespace (after all, macvlans were designed to be used from network namespaces). Then it should work.
| Why I can't ping between two siblings macvlans in bridge mode? |
1,490,767,764,000 |
For some very specific reason, I need to create 4 virtual interfaces with different MAC address on each virtual interface, the frames from those interfaces will needs be sent over a single physical interface without any VLAN tags (the device on other ends will look at my PC and thinks my PC is a dumb switch because frames from different MAC address is being sent towards them)
I've tried this command ip link add link eth0 name untagged type vlan id 0 which managed to create an untagged virtual interface but when I tried to create another one and replace the 0 then it said RTNETLINK answers: File exists
Again, I'm not trying to create a trunk over the physical interface, a tagged frame being sent out the physical interface is not suitable for my purpose because the other end doesn't understand a VLAN tagged frame or a trunk interface for that matter.
How I could accomplish this?
|
Thanks to LL3 I found out that this feature is called macvlan, for your reference I'll put the command here:
ip link add link eth0 address 00:cc:cc:cc:11:33 eth0mac2 type macvlan
ip link set eth0mac2 up
Source: https://serverfault.com/questions/576337/macvlan-interface-and-ppp-session
This can be used to create a L2 virtual interface for PPPoE
| Create multiple untagged virtual interface on a single physical interface |
1,490,767,764,000 |
I have the following routing rules (displayed using route -n):
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.2.1 0.0.0.0 UG 100 0 0 enp0s3
10.0.2.0 0.0.0.0 255.255.255.192 U 100 0 0 enp0s3.100
10.0.2.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s3
The interface enp0s3.100 is a interface with VLAN id 100.
If I try to get the route for 10.0.2.70, I expect it to use the VLAN interface, but it does not:
# ip route get 10.0.2.70
10.0.2.70 dev enp0s3 src 10.0.2.11
cache
Does anyone know why the longest prefix match is not being used here ?
|
Firstly, it's best to only use the ip commands, so you should have used ip route show (or ip r for short) to list the routing table.
In this case, the route over the VPN is for 10.0.2.0/255.255.255.192 or 10.0.2.0/26. This subnet is 0 - 63. Your example destination 10.0.2.70 falls outside of this range, hence it's not routed over the VPN but instead uses the next-more-specific route of 10.0.2.0/24 which is over enp0s3.
You mention the "longest prefix match", I usually hear "most specific match", i.e. where the range is the smallest, which indeed implies the longest prefix. However, as stated above, the IP address you're testing does not fall inside the prefix you think it does.
On Debian (and derivatives) there is a very useful utility netmask, which can help make things clearer:
$ netmask -r 10.0.2.0/255.255.255.192
10.0.2.0-10.0.2.63 (64)
Note that ip route show does not show the whole story, it's possible that policy-based routing is in play. You need to also list any routing rules, this is the normal output:
$ ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
You can then list the routing entries in a given table this way, here for the "local" table:
$ ip route show table local
This is called policy based routing. Normally you won't use this (you will if you have more than one internet connection, for example), but it helps to be aware of this when troubleshooting routing problems on systems you didn't configure yourself.
| Linux route selection not taking expected rule |
1,490,767,764,000 |
I have a physical system with Centos 6 as OS. In eth0 I set IP, gateway and netmask as below and the physical port is attached to a switch port that its VLAN is 12.
DEVICE=eth0
TYPE=Ethernet
UUID=20b60816-f5eb2e4
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.60.2
GATEWAY=192.168.50.55
NETMASK=255.255.255.0
and in eth1 i set these and physical port is attached to switch port with VLAN 14.
DEVICE=eth1
TYPE=Ethernet
UUID=9de7-14f13f5eb2e4
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.110.5
GATEWAY=192.168.60.60
NETMASK=255.255.255.224
the default port is set on eth1 so when i run route the gateway is 192.168.60.60. but when i bond eth1 and eth2 ( eth2 VLAN is also 14) and the default port is still eth1 and i run route the gateway is 192.168.50.55!
why this happen and what should I do?
UPDATE:
based on answer below i found these documents.
Centos documentation
redhat documentation
|
Well, it seems gateway (also known as default gateway) is something different from what you think it is, since the way you have it configured looks incorrect to me.
The default gateway defines how the machine should try to reach an IP in a network it doesn't know about, which is not in any of the networks directly attached to this machine, or networks for which the machine has static routes configured to. In short, the default gateway is the way by which the machine can reach the Internet.
In particular, you most typically don't have default gateways in multiple interfaces (since typically only one interface goes to the Internet, the others go to internal networks.) So I'd expect to see a default gateway configured on either eth0 or eth1, but not both...
Furthermore, the default gateway typically should be configured in the interface where that IP belongs (since you want it to be configured as that interface is brought up.) So I'd expect GATEWAY=192.168.60.60 to be configured in the eth0 configuration, since that interface handles the 192.168.60.x network and it's the one where IP 192.168.60.60 is actually reachable.
(Of course, that's assuming 192.168.60.60 is actually the default gateway through which you can reach the Internet, otherwise you shouldn't list it at all.)
IP 192.168.50.55 looks problematic, since it's not an IP on either one of the two configured networks (192.168.60.x on eth0 or 192.168.110.x on eth1), so configuring such a default gateway will plainly not work, since it's not attached to any of the known networks, so your machine doesn't know how to reach it.
If you configure default gateways in the wrong places and configure many of them, it's quite possible that the network scripts will still configure them both and you might end up having one, the other or maybe both listed, resulting into a configuration that works, or doesn't work, or work sometimes. So what you report about settings getting mixed up when bonding gets involved doesn't surprise me.
My advice here is that you try to understand how default gateways work, reconfigure your files to only list the correct one in the correct place, retest it, then go back to setting up bonding on your VLAN 14.
If you have follow up questions, this site can be a good resource. In that case, you might want to further describe your network, the IP ranges and how it's connected to the Internet, you might get more specific recommendations then.
| system get wrong gateway when bonding |
1,490,767,764,000 |
I am novice at networking and am really new to vlan terminology. I want to separate my network to stuff and guest users depending on the switch port.
I prepared a lab with the following:
At switch I mirrored the port 10 to port 2.
At machine A with Linux, I installed wireshark and connected to switch at port 2
At machine B with Linux, I managed to create a vlan interface with id 22 and connected to port 10.
The question is how to send packets tagged with id 22 from machine B to somewhere else, in order to monitor them through machine A? Is it possible?
|
All packets which are sent from the VLAN interface are tagged with the respective VLAN ID. And that interface gets only those packets with its VLAN ID.
| Sending vlan-tagged packets from Linux |
1,490,767,764,000 |
on my RedHat 7, i noticed that network connection for Netbackup stopped working and i tried everything including rurning off my firewall and disabled SELINUX with no luck. the only thing i noticed different between this server and other servers is that port 1556 is listening on tcp & tcp6 where the same port on other servers only listen on tcp and not tcp6. Could that be causing the connection to stop? Is there a way to force port 1556 to listen ONLY on tcp and not tcp6?
here's what i see when i run netstat on port 1556
[root@server ~]# netstat -tupln | grep 1556
tcp 0 0 0.0.0.0:1556 0.0.0.0:* LISTEN 2498/pbx_exchange
tcp6 0 0 :::1556 :::* LISTEN 2498/pbx_exchange
|
It's hard to say exactly what's causing the error.
Having IPv6 enabled, and listening on the same port shouldn't cause issues.
Any system which has dual-stack capability should handle it fine.
I've found this bug report from Veritas (and I'm making an assumption that you're using what
they refer to as Netbackup) but I have no idea if this could be the issue you're facing. I will admit upfront that I do not have experience with Netbackup.
So I can only really answer the "is this what's causing the issue" part of the question.
As for the "can you force it to listen only on IPv4", you probably can, and it should be somewhere in the configuration for Netbackup pertaining to what port/IP addresses it's listening on. If it is listening on ALL available IP addresses for the server, and the server has dual-stack IPv4 and IPv6, it will listen for connections from both. So if you can bind Netbackup to an IPv4 address allocated to your server, that should disable the IPv6 functionality.
| port 1556 listening on tcp6 causing issues |
1,490,767,764,000 |
8 port router over two switches (4+4)
Using kernel 2.6.x
I'm trying to setup private VLANs to enable port isolation on this router. Each physical Ethernet port should only be able to communicate with the eth0 interface (WAN) for Internet access.
Netfilter/iptables only sees the "br0" bridge interface, not the physical interface.
As a result, ebtables rules will be needed to unbridge the frames and perform dropping.
Each physical Ethernet port has its own private VLAN (i.e., eth1.1, eth1.2, etc.).
Robocfg will be used to assign private VLANs to physical ports. For example ...
robocfg vlan 10 "<port#> 8t"
How do you determine when a port should be tagged ?
|
You do not trust any of the (LAN) ports so the only tagged port should be the one of eth1.
It is not clear to be which interfaces are bridged and it may not matter for your case but iptables does see the bridge ports. Have a look at the physdev module.
| When to tag physical ports on private VLANs? |
1,490,767,764,000 |
My lab is on a VLAN. If the machines are connected to the VLAN they can connect to the Internet. If not they can't. Installing the VLAN package enables network connectivity. However, I don't know how load a .deb during an install. I tried installing a base system without network connectivity -- however, that failed when trying to install anything beyond VLAN. Namely, it was caught in a dependencies loop for libc6, libgcc1, and libstd++6.
|
You don't need a VLAN package on Debian unless you are configuring the Debian box as a VLAN switch. As long as the Debian machine has a NIC in that VLAN that is routed to the Internet.
If machines are connected and during installation you configure the IP address and DNS server, are you able to scan the mirror during installation?
| Network Install Debian on a VLAN |
1,490,767,764,000 |
There's a requirement setup needs to address to our pSeries box. We have one p770 box intended to setup UAT and Development VM Clients, but the requirement is to set different VLANs per Environment (UAT & Dev).
Also a separation of VLANs with applications and databases, it will be assigned by specific VLAN ids by our LAN Team.
Questions
How can this be done in VIOs? The old setup of our p6 box was a single VLAN which configured in our VIOs thru SEA.
How can we assign different VLANs in the SEA, or is it correct that its being configured via SEA or there is any other way?
|
You have a lot of options.
you could create multiple VIO servers and run DEV and UAT off different VIOs
you can create multiple SEA's on VIO servers and assign different physical adapters to each of the SEAs
you can assign multiple VLANs to the same SEA as long as the network side is set up for it (referred to as VLAN tagging usually)
other stuff I've not thought of straight away
There's no single right answer, it depends on a number of other factors. I strongly recommend you read the Red Books on PowerVM (VIO) because they cover the different scenarios.
IBM PowerVM Virtualization Introduction and Configuration is the best starting place.
| How can i set-up VIOs multiple VLANs in our p770 box? |
1,503,054,508,000 |
I installed Debian 9 stretch (GNOME desktop) 64-bit on my PC. My USB wireless adapter (TP-LINK TL-WN722N) was detected automatically after installing atheros firmware:
apt-get install firmware-atheros
But I can't connect to any wireless framework, whether they are protected with password or unprotected.
I plugged my USB. It was detected, sent auth, got authenticated, but immediately aborted authentication. Disabling IPV6 did not solve my problem..
Here is my dmesg report:
[ 59.880805] usb 1-1.4: new high-speed USB device number 4 using ehci-pci
[ 60.005727] usb 1-1.4: New USB device found, idVendor=0cf3, idProduct=9271
[ 60.005729] usb 1-1.4: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 60.005731] usb 1-1.4: Product: USB2.0 WLAN
[ 60.005732] usb 1-1.4: Manufacturer: ATHEROS
[ 60.005734] usb 1-1.4: SerialNumber: 12345
[ 60.324981] usb 1-1.4: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[ 60.325069] usbcore: registered new interface driver ath9k_htc
[ 60.348095] usb 1-1.4: firmware: direct-loading firmware ath9k_htc/htc_9271-1.4.0.fw
[ 60.629962] usb 1-1.4: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[ 60.880826] ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
[ 61.111895] ath9k_htc 1-1.4:1.0: ath9k_htc: FW Version: 1.4
[ 61.111897] ath9k_htc 1-1.4:1.0: FW RMW support: On
[ 61.111899] ath: EEPROM regdomain: 0x809c
[ 61.111900] ath: EEPROM indicates we should expect a country code
[ 61.111901] ath: doing EEPROM country->regdmn map search
[ 61.111911] ath: country maps to regdmn code: 0x52
[ 61.111912] ath: Country alpha2 being used: CN
[ 61.111912] ath: Regpair used: 0x52
[ 61.122477] ieee80211 phy0: Atheros AR9271 Rev:1
[ 61.185069] ath9k_htc 1-1.4:1.0 wlx18a6f7160a49: renamed from wlan0
[ 61.224640] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 61.361032] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 61.535923] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 61.743450] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 69.190250] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 70.360621] wlx18a6f7160a49: authenticate with 74:23:44:dc:0f:d7
[ 70.551637] wlx18a6f7160a49: send auth to 74:23:44:dc:0f:d7 (try 1/3)
[ 70.556012] wlx18a6f7160a49: authenticated
[ 75.555233] wlx18a6f7160a49: aborting authentication with 74:23:44:dc:0f:d7 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 76.872114] wlx18a6f7160a49: authenticate with 74:23:44:dc:0f:d7
[ 77.061146] wlx18a6f7160a49: send auth to 74:23:44:dc:0f:d7 (try 1/3)
[ 77.065158] wlx18a6f7160a49: authenticated
[ 82.061225] wlx18a6f7160a49: aborting authentication with 74:23:44:dc:0f:d7 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 83.775718] wlx18a6f7160a49: authenticate with 74:23:44:dc:0f:d7
[ 83.965040] wlx18a6f7160a49: send auth to 74:23:44:dc:0f:d7 (try 1/3)
[ 83.969807] wlx18a6f7160a49: authenticated
[ 88.969792] wlx18a6f7160a49: aborting authentication with 74:23:44:dc:0f:d7 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 91.207178] wlx18a6f7160a49: authenticate with 74:23:44:dc:0f:d7
[ 91.395860] wlx18a6f7160a49: send auth to 74:23:44:dc:0f:d7 (try 1/3)
[ 91.400263] wlx18a6f7160a49: authenticated
[ 93.996839] wlx18a6f7160a49: aborting authentication with 74:23:44:dc:0f:d7 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 94.061841] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
[ 94.233433] IPv6: ADDRCONF(NETDEV_UP): wlx18a6f7160a49: link is not ready
I have no idea why this happened, nor why it was aborted multiple times in one try.
Edit: iwconfig report:
enp3s0 no wireless extensions.
wlx18a6f7160a49 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
lo no wireless extensions.
|
Somehow, my firmware got trouble with long interface name. So I ran this command to prevent it:
ln -s /dev/null /etc/systemd/network/99-default.link
and it worked.
| "aborting authentication by local choice (Reason: 3=DEAUTH_LEAVING)" when trying to connect to wifi |
1,503,054,508,000 |
I built an embedded Linux using Buildroot and I have some trouble to stay connected to my AP. Cannot get an IP address more than once.
I use wpa_supplicant to connect to my AP using WPA2-PSK. It works with other AP such as my smartphone in AP mode.
When I use iwconfig wlan0 I see that I'm associated with my AP
wlan0 IEEE 802.11bgn ESSID:"ZyXEL_B3B5"
Mode:Managed Frequency:2.462 GHz Access Point: 90:EF:68:D3:B3:B5
Bit Rate=58.5 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=53/70 Signal level=-57 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:1 Missed beacon:0
But I cannot get an IP address with ifup wlan0
udhcpc (v1.22.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, failing
I should say that I'm able to get an IP address only once. If I reboot this is not possible anymore.
I managed to install dhclient instead of using the default DHCP client of Busybox but nothing happens (I stay blocked indefinitely)
dhclient wlan0
According to my kernel messages, it seems that I'm not continuously associated
[ 355.459738] wlan0: authenticate with 90:ef:68:d3:b3:b5 (try 1)
[ 355.461366] wlan0: authenticated
[ 355.461416] wlan0: associate with 90:ef:68:d3:b3:b5 (try 1)
[ 355.469353] wlan0: RX AssocResp from 90:ef:68:d3:b3:b5 (capab=0x431 status=0 aid=1)
[ 355.469364] wlan0: associated
[ 365.547863] wlan0: deauthenticating from 90:ef:68:d3:b3:b5 by local choice (reason=3)
[ 365.672765] cfg80211: Calling CRDA to update world regulatory domain
[ 367.169736] wlan0: authenticate with 90:ef:68:d3:b3:b5 (try 1)
[ 367.171421] wlan0: authenticated
[ 367.194859] wlan0: associate with 90:ef:68:d3:b3:b5 (try 1)
[ 367.198561] wlan0: RX AssocResp from 90:ef:68:d3:b3:b5 (capab=0x431 status=0 aid=1)
[ 367.198584] wlan0: associated
[ 377.277864] wlan0: deauthenticating from 90:ef:68:d3:b3:b5 by local choice (reason=3)
[ 377.412822] cfg80211: Calling CRDA to update world regulatory domain
[ 378.899738] wlan0: authenticate with 90:ef:68:d3:b3:b5 (try 1)
[ 378.901668] wlan0: authenticated
[ 378.924732] wlan0: associate with 90:ef:68:d3:b3:b5 (try 1)
[ 378.928437] wlan0: RX AssocResp from 90:ef:68:d3:b3:b5 (capab=0x431 status=0 aid=1)
[ 378.928461] wlan0: associated
[ 389.008120] wlan0: deauthenticating from 90:ef:68:d3:b3:b5 by local choice (reason=3)
[ 389.182888] cfg80211: Calling CRDA to update world regulatory domain
[ 390.689735] wlan0: authenticate with 90:ef:68:d3:b3:b5 (try 1)
[ 390.691415] wlan0: authenticated
[ 390.714734] wlan0: associate with 90:ef:68:d3:b3:b5 (try 1)
[ 390.720847] wlan0: RX AssocResp from 90:ef:68:d3:b3:b5 (capab=0x431 status=0 aid=1)
[ 390.720870] wlan0: associated
[ 400.811246] wlan0: deauthenticating from 90:ef:68:d3:b3:b5 by local choice (reason=3)
...
The logs of my AP
338 Nov 16 15:50:53 udhcpd[2404]: Received DISCOVER
339 Nov 16 15:50:53 udhcpd[2404]: unicasting packet to client yiaddr
340 Nov 16 15:50:56 udhcpd[2404]: Received DISCOVER
341 Nov 16 15:50:56 udhcpd[2404]: unicasting packet to client yiaddr
342 Nov 16 15:50:59 udhcpd[2404]: Received DISCOVER
343 Nov 16 15:50:59 udhcpd[2404]: unicasting packet to client yiaddr
The logs when it works (only once)
325 Nov 16 15:48:37 udhcpd[2404]: Received DISCOVER
326 Nov 16 15:48:37 udhcpd[2404]: unicasting packet to client yiaddr
327 Nov 16 15:48:37 udhcpd[2404]: Received REQUEST
328 Nov 16 15:48:37 udhcpd[2404]: lease = 11854360
329 Nov 16 15:48:37 udhcpd[2404]: requested = b2a8eb7f
330 Nov 16 15:48:37 udhcpd[2404]: server_id = c0a80101
331 Nov 16 15:48:37 udhcpd[2404]: unicasting packet to client yiaddr
How to solve it?
|
I changed the "Auto channel" option to a fixed channel and the "Channel width" option to 20 MHz in my AP and it solved my problem.
| How to fix "deauthentication by local choice"? |
1,503,054,508,000 |
I use wpa-conf in /etc/network/interfaces to make the WLAN interface automatically connect to the AP:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Actually, I just found that on a wiki somewhere. It seems that this isn't documented in interfaces(5) or in any other man page.
So what is the wpa-conf keyword? A kind of extension? Or is it built into ifup? And where do I get a list of all the commands I can use in /etc/network/interfaces?
|
As for /etc/network/interfaces, when you install wpa-supplicant, a script hook is installed in:
/etc/network/if-down.d
/etc/network/if-post-down.d
/etc/network/if-pre-up.d
/etc/network/if-up.d,
The hook is called wpasupplicant and is a symlink to /etc/wpa-supplicant/ifupdown.sh, that invokes in turn /etc/wpa-supplicant/functions.sh.
This hook will be invoked by runparts in ifup / ifdown, and the script the symlink points too tests whether the interface is wireless or not. If that is the case, the command will be passed on to wpa-supplicant.
For acting on the commands, passing them to /sbin/wpa-supplicant, it seems the script /sbin/wpa_action and the binary /sbin/wpa_cli are used.
I found an old page talking about this here:
http://manual.siduction.org/inet-wpa
As mentioned earlier, each wpa_supplicant specific element is prefixed
with 'wpa-'. Each element correlates to a property of wpa_supplicant
described in the wpa_supplicant.conf(5), wpa_supplicant(8) and
wpa_cli(8) manpages.
The supplicant is launched without any pre-configuration whatsoever,
and wpa_cli forms a network configuration from the input provided by
the 'wpa-*' lines. Initially, wpa_supplicant/wpa_cli does not directly
set the properties of the device (like setting an essid with iwconfig,
for example), rather it informs the device of what access point is
suitable to associate with. Once the device has scanned the area, and
found that the suitable access point is available for use, these
properties are set.
The script that does all the work is located at:
/etc/wpa_supplicant/ifupdown.sh /etc/wpa_supplicant/functions.sh
ifupdown.sh is executed by run-parts, which in turn is invoked by
ifupdown during the 'pre-up', 'pre-down' and 'post-down' phases.
In the 'pre-up' phase, a wpa_supplicant daemon is launched followed by
a series of wpa_cli commands that set up a network configuration
according to what 'wpa-' options were used in /etc/network/interfaces
for the physical device.
If wpa-roam is used, a wpa_cli daemon is lauched in the 'post-up'
phase.
In the 'pre-down' phase, the wpa_cli daemon is killed if it exists.
In the 'post-down' phase, the wpa_supplicant daemon is killed.
| Where is wpa-conf documented? |
1,503,054,508,000 |
I was trying to fix my wifi on Kali Linux the other day and was following some tutorial. That didn't work, so I read somewhere that if I run this command
iw dev wlan0 del
After that command I can't seem to find my wlan device. When I type iwconfig it shows this:
lo no wireless extensions.
eth0 no wireless extensions.
Anyone know what should I do now?
|
Easiest way is to just reboot. The type of configuration change you've made does not persist across reboots.
| Accidentally deleted my wifi device wlan0 |
1,503,054,508,000 |
I recently bought this WLAN adapter on Amazon.
When I attempt to switch to monitor mode:
ifconfig wlan1 down
iwconfig wlan1 mode monitor
ifconfig wlan1 up
I receive the following error:
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan1 ; Invalid argument.
This adapter is listed as follows in lsusb:
ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter
and wlan1 is listed when typing iwconfig, which means its drivers/firmware are correctly installed.
I use Kali-linux Sana (2.0) with kernel 4.0.0-kali1-amd64, but this should apply to all (Debian based) Linux distributions.
How can I switch this devive to "monitor mode"?
|
According to this, https://wikidevi.com/wiki/R8712u your chipset does not supports monitor mode.
Not all combinations of hardware/software support wifi monitor mode. Like any other functionality implemented in silicon/firmware, be it listening to the media, sending and listening to packets, monitor mode has to be usually implemented by the manufacturer for it to work.
Beware that I far as I remember, some implementations only allow passive monitoring, while others allow monitoring and sending/manufacturing "fake" packets.
Think it as monitor mode as a special/yet another service supported by the (firmware running on) hardware. When shopping around, that thought has to be taken in account, specifically for so more esoteric uses. So it it advisable beforehand to use Google, and talk with other people, to have an idea of what they are already using successfully for specific purposes.
I would also direct you to another thread where I talk about my (bad) experience with cheap realtek devices.
| How to run my RTL8191SU USB Wifi adapter in monitor mode on Linux? |
1,503,054,508,000 |
(I was trying and trying for hours to find a workaround, which proved much harder than initially expected.)
The problem itself is easy to understand, though. I recently installed a GUI-less Debian derivative on one of my machines and configured /etc/wpa_supplicant/wpa_supplicant.conf to access one of my access points and that worked out well.
Soon I took my machine with me out of home, so I added another network (which is my phone in hotspot mode this time) to wpa_supplicant.conf.
Sadly I noticed that it doesn't automatically connect to the phone's AP even after losing connection to the inital router, followed by wpa_cli --reconfigure.
Funny part: uncommenting the first network in the wpa_supplicant.conf makes my phone's AP work flawlessly. If both networks are kept uncommented, only the first one works.
I was reading the whole manual of wpa_supplicant.conf but the closest thing to what I needed was the BSSID option which didn't help in this situation.
So my question: how do I make the network controller change access points depending on availability of these?
Update:
I don't have /usr/share/doc/wpa_supplicant/README.modes, but only /usr/share/doc/wpa_supplicant/README.modes.gz which I am unable to extract because of too many symbolic links.
My /etc/wpa_supplicant/wpa_supplicant.conf:
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Klaus B. Schuldiger"
scan_ssid=1
psk="----"
}
#network={
#ssid="Xperia XZ_acd9"
#scan_ssid=1
#psk="----"
#}
|
To debug what wpa_supplicant is doing, wpa_cli status will give information about whether wpa_supplicant still thinks it's connected to an AP, or searching for a new AP.
Wpa_supplicant needs to be in roaming mode to automatically switch between networks. You enable roaming by using a wpa-roam entry after the iface stanza in /etc/network/interfaces, and put all the networks in a wpa_supplicant.conf file (typically /etc/wpa_supplicant/wpa_supplicant.conf). Details can be found in README.modes or README.modes.gz in the wpa_supplicant documentation.
Hidden access points (APs) will cause trouble for two reasons: One the hand, wpa_supplicant will be need to actively configured to scan for all of them (and I don't know the details on how to configure that). On the other hand, the WLAN client will have problems to determine if the connection is still valid or not, because the AP doesn't send out beacons which could be measured. So all the client sees is no answer to transmitted packets, which could also be caused by problems somewhere else in the network. The client will timeout the connection eventually, but that can take several minutes.
Also, hidden APs don't really improve security: Traffic between a hidden AP and a client can be sniffed, giving away the existence of the AP. A client actively scanning for an AP also gives away the existence (and as it's actively scanning for all hidden APs it knows of, it gives even more information).
So the easiest solution is to make all APs non-hidden in case they cause problems.
| wpa_supplicant doesn't auto-change AP |
1,503,054,508,000 |
How can I encrypt/hide my - wpa-psk "password" - line in the /etc/network/interfaces file? Since it's uncovered and readable for everyone who can get in the file now.
Or is it better that I use something else if I don't want to store my blank wifi password in a file?
I'm running on debian without desktop environment.
|
The best you can do is hash the password. Set wpa-psk to the output of:
wpa_passphrase <SSID> <KEY>
This will obfuscate the password, but it will not prevent someone else from using the hash to connect with another device.
As an additional measure you should also set /etc/network/interfaces file permission to rw------- (600), chmod og-rw.
| How to encrypt/hide password in /etc/network/interfaces file on debian? |
1,503,054,508,000 |
i have been fiddling with wpa supplicant for days now and i've finally come to the point where i can't find any new leads on google. so here is the problem: i just installed a new tp-link tl-wn881nd pci-e wifi card on my desktop pc running debian wheezy. wlan0 claims to be connected (ish? see below) to the access point, ifconfig reports the correct static ip address i have assigned it, however i cannot ping the access point and syslog says that there is an error with the handshake.
firstly, i have read that network-manager can mess with things. i'm fairly sure this is not a problem for me:
$ which NetworkManager
##### blank #####
$ dpkg -l | grep -i network-manager
rc network-manager 0.9.4.0-10 amd-64 network management framework (daemon and userspace tools)
ii network-manager-openvpn 0.9.4.0-1 amd-64 network management framework (OpenVPN plugin core)
my computer specs are:
$ uname -a
Linux mypc 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
$ sudo dmidecode | grep -iA3 '^system information'
System Information
Manufacturer: Dell Inc.
Product Name: OptiPlex 745
Version: Not Specified
and the wifi card specs are:
$ lspci | grep -i wireless
02:00.0 Network controller: Atheros Communications Inc. AR9287 Wireless Network Adapter (PCI-Express) (rev 01)
i have made sure the wifi card is active:
$ sudo ip link set wlan0 up
$ sudo ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisk mq state DORMANT mode DORMANT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
and the card is able to find my ssid:
$ sudo iw wlan0 scan
BSS xx:xx:xx:xx:xx:xx (on wlan0) -- associated
TSF: 2639667559 ysec (0d, 00:43:59)
freq:2412
beacon interval: 100
capability: ESS Privacy ShortSlotTime (0x0411)
signal: -56.00 dBm
last seen: 692 ms ago
Information elements from Probe Response frame:
SSID: aphanumeric_with_underscores
Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0
DS Parameter set: channel 1
ERP: Use_Protection Barker_Preamble_Mode
Extended supported rates: 6.0 12.0 24.0 48.0
HT capabilities:
Capabilities: 0x106e
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
No RX STBC
Max AMSDU length: 3839 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT RX MCS rate indexes supported: 0-7, 32
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 1
* secondary channel offset: no secondary
* STA channel width 20MHz
* RIFS: 0
* HT protection: non-HT mixed
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
RSN:* Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: (0x0000)
WMM:* Parameter version 1
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
Extended capabilities: HT Information Exchange Supported
Country: AL Environment: Indoor/Outdoor
Channels [1 - 13] @ 15 dBm
i read somewhere that you can put the wpa_supplicant options directly in /etc/network/interfaces, so here is mine:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use `auto wlan0` since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove `auto wlan0` from this file just to get a
# command prompt again!
iface wlan0 inet static
wpa-ssid "aphanumeric_with_underscores"
wpa-psk "my wpa2 password"
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
and note that there is currently no wpa_supplicant.conf file:
$ ls /etc/wpa_supplicant.conf
ls: cannot access /etc/wpa_supplicant.conf: No such file or directory
$ ls /etc/wpa_supplicant/*
action_wpa.sh functions.sh ifupdown.sh
now if restart the wlan0 interface:
$ sudo ifdown wlan0
$ sudo ifup wlan0
the ip address has been correctly assigned:
$ ifconfig
lo ...
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr 192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::16cc:20ff:feea:4578/64 Scope:Link
UP BROADCAST MULTICAST NTU:1500 Metric:1
RX packets:3075 errors:0 dropped:0 overruns:0 frame:0
TX packets:4028 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:347475 (339.3KiB) TX bytes:586219 (572.4KiB)
but here's the problem: the wlan0 interface appears to be up, but i can't reach the internet and i can't even ping the access point:
$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.50 icmp_seq=2 Destination Host Unreachable
From 192.168.1.50 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 0 received, +2 errors, 100% packet loss, time 2015ms
and when i look in /var/log/syslog i see some nasty looking errors:
Mar 18 01:23:11 mypc kernel: [ 148.242137] wlan0: authenticate with xx.xx.xx.xx.xx.xx (try 1)
Mar 18 01:23:11 mypc kernel: [ 148.244009] wlan0: authenticated
Mar 18 01:23:11 mypc kernel: [ 148.265967] wlan0: associate with xx.xx.xx.xx.xx.xx (try 1)
Mar 18 01:23:11 mypc kernel: [ 148.287770] wlan0: RX AssocResp from xx.xx.xx.xx.xx.xx (capab=0x411 status=0 aid=1)
Mar 18 01:23:11 mypc kernel: [ 148.287774] wlan0: associated
Mar 18 01:23:11 mypc kernel: [ 148.287774] wlan0: associated
Mar 18 01:23:11 mypc wpa_supplicant[4473]: wlan0: Associated with xx.xx.xx.xx.xx.xx
Mar 18 01:23:11 mypc kernel: [ 148.297421] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mar 18 01:23:11 mypc kernel: [ 148.297651] cfg80211: Calling CRDA for country AL
Mar 18 01:23:11 mypc kernel: [ 148.303008] cfg80211: Regulatory domain changed to country: AL
Mar 18 01:23:11 mypc kernel: [ 148.303013] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 01:23:11 mypc kernel: [ 148.303018] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303022] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303026] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 01:23:11 mypc kernel: [ 148.303029] cfg80211: (5490000 KHz - 5710000 KHz @ 80000 KHz), (N/A, 2700 mBm)
Mar 18 01:23:19 mypc kernel: [ 155.819739] wlan0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
Mar 18 01:23:19 mypc wpa_supplicant[4473]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Mar 18 01:23:19 mypc wpa_supplicant[4473]: wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=15
does anybody know how i can fix this and ping my access point via wlan0?
modification 1: trying dhcp instead of a static ip
i changed /etc/network/interfaces like so:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use `auto wlan0` since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove `auto wlan0` from this file just to get a
# command prompt again!
iface wlan0 inet dhcp
wpa-ssid "aphanumeric_with_underscores"
wpa-psk "my wpa2 password"
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
(note that wpa_supplicant.conf still does not exist in modification 1), and now i get some new errors on the commandline when i bring the interface up:
$ sudo ifup wlan0
Operation failed.
Failed to bring up wlan0
and syslog shows the same fail messages over and over again as before:
Mar 18 08:59:01 mypc kernel: [ 2493.163777] ADDRCONF(NETDEV_UP): wlan0: link is not ready
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='alphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:02 mypc kernel: [ 2493.974111] wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:02 mypc kernel: [ 2493.976083] wlan0: authenticated
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='aphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:02 mypc kernel: [ 2493.998016] wlan0: associate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:02 mypc kernel: [ 2494.019518] wlan0: RX ReassocResp from xx:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=2)
Mar 18 08:59:02 mypc kernel: [ 2494.019523] wlan0: associated
Mar 18 08:59:02 mypc wpa_supplicant[6151]: wlan0: Associated with xx:xx:xx:xx:xx:xx
Mar 18 08:59:02 mypc kernel: [ 2494.028721] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mar 18 08:59:02 mypc kernel: [ 2494.028873] cfg80211: Calling CRDA for country: AL
Mar 18 08:59:02 mypc kernel: [ 2494.033830] cfg80211: Regulatory domain changed to country: AL
Mar 18 08:59:02 mypc kernel: [ 2494.033835] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 08:59:02 mypc kernel: [ 2494.033839] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033843] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033846] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:02 mypc kernel: [ 2494.033849] cfg80211: (5490000 KHz - 5710000 KHz @ 80000 KHz), (N/A, 2700 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.499716] wlan0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 15)
Mar 18 08:59:09 mypc wpa_supplicant[6151]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Mar 18 08:59:09 mypc wpa_supplicant[6151]: wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=15
Mar 18 08:59:09 mypc kernel: [ 2501.536289] cfg80211: Calling CRDA to update world regulatory domain
Mar 18 08:59:09 mypc kernel: [ 2501.541764] cfg80211: World regulatory domain updated:
Mar 18 08:59:09 mypc kernel: [ 2501.541770] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 08:59:09 mypc kernel: [ 2501.541775] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541779] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541782] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541786] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541790] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 08:59:09 mypc kernel: [ 2501.541794] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
Mar 18 08:59:10 mypc wpa_supplicant[6151]: wlan0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='aphanumeric_with_underscores' freq=2412 MHz)
Mar 18 08:59:10 mypc kernel: [ 2502.434112] wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
Mar 18 08:59:10 mypc kernel: [ 2502.436071] wlan0: authenticated
etc
and note that eth0 works fine with dhcp, so there is no issue with dhcp itself.
modification 2: try using the psk hash from wpa_passphrase
$ wpa_passphrase myssid mypassword
network={
ssid="myssid"
#psk="mypassword"
psk=xxxxxxxxxxxx...
}
use this new psk in /etc/network/interfaces:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use `auto wlan0` since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove `auto wlan0` from this file just to get a
# command prompt again!
iface wlan0 inet dhcp
wpa-ssid "aphanumeric_with_underscores"
wpa-psk xxxxxxxxxxxxxxxx
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
try again:
$ sudo iplink set wlan0 down
$ sudo iplink set wlan0 up
$ sudo ifup wlan0
cat: /var/run/wpa_supplicant.wlan0.pid: No such file or directory
Operation failed.
Failed to bring up wlan0.
hmm interesting error that time. investigate:
$ sudo su
# cd /var/run/wpa_supplicant/
# ls -l
total 0
srwxrwx--- 1 root root 0 Mar 18 09:26 wlan0
# cat wlan0
cat: wlan0: No such device or address
/var/log/syslog is still showing the same errors though.
modification 3: set a very basic ssid and password
i set the ssid to abc and password to abcdefgh:
$ wpa_passphrase abc abcdefgh
network={
ssid="abc"
#psk="abcdefgh"
psk=ba89407e92b8efec11c227e3cce9f25c8dcc4b3651fe2be02d91d9ebda96e913
}
but the results are the same as for modification 1 and modification 2 no matter which of these pre-shared keys i put in /etc/network/interfaces
$ sudo ip link set wlan0 down
$ sudo ip link set wlan0 up
$ sudo ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DORMANT mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo ifdown wlan0
ifdown: interface wlan0 not configured
$ sudo rm /var/run/wpa_supplicant/wlan0
$ sudo ifup wlan0
wpa_supplicant: ctrl_interface socket not found at /var/run/wpa_supplicant/wlan0
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Operation failed.
Failed to bring up wlan0.
modification 4: use wpa_supplicant in debug mode on the commandline
remove all wpa settings from /etc/network/interfaces:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface wlan0 inet dhcp
now create the wpa_supplicant.conf file:
$ sudo sh -c 'wpa_passphrase abc abcdefgh > /etc/wpa_supplicant/wpa_supplicant.conf'
edit the file to contain the following information:
ap_scan=1
ctrl_interface=DIR=/var/run/wpa_supplicant
ctrl_interface_group=0
network={
proto=WPA2
pairwise=CCMP
group=CCMP
key_mgmt=WPA-PSK
ssid="abc"
#psk="abcdefgh"
psk=ba89407e92b8efec11c227e3cce9f25c8dcc4b3651fe2be02d91d9ebda96e913
}
run wpa_supplicant directly:
$ sudo ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo ip link set wlan0 up
$ sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWSCAN]: Device or resource busy
wlan0: Failed to initiate AP scan
wlan0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:00:00:00:00:00
wlan0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
^Cwlan0: CTRL-EVENT-TERMINATING - signal 2 received
and again, with a bit more debug verbosity:
$ sudo wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -f /tmp/wpa_supplicant.tl-wn881nd.errors
see the output here.
from ioctl[SIOCSIWENCODEEXT]: Invalid argument it looks like there may be an incompatibility between the wifi card and the kernel? if so then how can i diagnose and fix this?
|
the bloody wifi card wasn't plugged in to the pci-express slot properly! i took it out, blew the slot to get any dust out and pushed it in really hard this time. now all is working fine:
# the wifi led is not lit up on the outside of the pc case
$ sudo ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo ip link set wlan0 up
# now the wifi led is lit up on the outside of the pc case
$ sudo ip link show wlan0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
$ sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with 00:60:64:4c:37:fc (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:60:64:4c:37:fc
wlan0: WPA: Key negotiation completed with 00:60:64:4c:37:fc [PTK=CCMP GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 00:60:64:4c:37:fc completed (auth) [id=0 id_str=]
wlan0: CTRL-EVENT-DISCONNECTED bssid=00:60:64:4c:37:fc reason=0
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with 00:60:64:4c:37:fc (SSID='abc' freq=2412 MHz)
wlan0: Associated with 00:60:64:4c:37:fc
wlan0: WPA: Key negotiation completed with 00:60:64:4c:37:fc [PTK=CCMP GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 00:60:64:4c:37:fc completed (reauth) [id=0 id_str=]
$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=254 time=0.510 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=254 time=0.578 ms
^C
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.510/0.544/0.578/0.034 ms
the correct /var/log/syslog looks like this:
Mar 18 13:38:19 mypc kernel: [ 542.538613] wlan0: authenticate with 00:60:64:4c:37:fc (try 1)
Mar 18 13:38:19 mypc kernel: [ 542.540517] wlan0: authenticated
Mar 18 13:38:19 mypc kernel: [ 542.540553] wlan0: associate with 00:60:64:4c:37:fc (try 1)
Mar 18 13:38:19 mypc kernel: [ 542.563331] wlan0: RX AssocResp from 00:60:64:4c:37:fc (capab=0x411 status=0 aid=3)
Mar 18 13:38:19 mypc kernel: [ 542.563336] wlan0: associated
Mar 18 13:38:19 mypc kernel: [ 542.573034] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mar 18 13:38:19 mypc kernel: [ 542.573220] cfg80211: Calling CRDA for country: AL
Mar 18 13:38:19 mypc kernel: [ 542.578955] cfg80211: Regulatory domain changed to country: AL
Mar 18 13:38:19 mypc kernel: [ 542.578960] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Mar 18 13:38:19 mypc kernel: [ 542.578965] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
Mar 18 13:38:19 mypc kernel: [ 542.578969] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 13:38:19 mypc kernel: [ 542.578972] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
Mar 18 13:38:19 mypc kernel: [ 542.578976] cfg80211: (5490000 KHz - 5710000 KHz @ 80000 KHz), (N/A, 2700 mBm)
and those lines only show up once - they no longer repeat over and over in syslog
:)
note that it now also works fine if i remove the wpa_supplicant.conf file and put everything in /etc/network/interfaces:
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
# don't use `auto wlan0` since this will infinitely try to connect at
# boot time, and i will have to remove the hard drive, mount it on
# another pc and remove `auto wlan0` from this file just to get a
# command prompt again!
iface wlan0 inet static
wpa-ssid "aphanumeric_with_underscores"
# both the plaintext password and the ascii-hex hash from
# wpa_passphrase work fine for me here:
wpa-psk "my wpa2 password"
wpa-ap-scan 1
wpa-proto WPA2
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
and note that there is currently no wpa_supplicant.conf file:
$ ls /etc/wpa_supplicant.conf
ls: cannot access /etc/wpa_supplicant.conf: No such file or directory
$ ls /etc/wpa_supplicant/*
action_wpa.sh functions.sh ifupdown.sh
| wpa_supplicant nightmares |
1,503,054,508,000 |
How can I read out WLAN RSSI value for each radio channel from command line? Target system would be either Ubuntu 15.04 or Raspberry Raspbian.
By RSSI, I mean the raw received power, before any WLAN specific L1 operations. This is pretty much same way as in the 3GPP WCDMA, RSSI value means the raw energy received on antenna. Not just the received code power, not the signal-to-noise ratio. Just the overall received signal power containing both payload signal and any possible noise.
The only solution I have found so far is wavemon: when started with parameter -d, it will print out signal and noise values and I can grep out them easily. But are there other possibilities or would there be even some ready-made utility to scan for noise over all WLAN channels?
Reason for this question is that my both of my home 2.4G band WLAN networks have some random, but frequent problems blocking usage of both networks simultaneously. Problems are not related to WLAN base station HW, channel numbers or any of my own HW - all those have already been eliminated. Problems are not visible on my 5G band WLAN networks - those operate well also during 2.4G band problems.
I'm now suspecting that my 2.4G band WLAN networks are victims of some external noise. I need to collect more evidence and my plan was to set up one Ubuntu or Rasberry device to continuously scan over 2.4G WLAN channels, and to combine the resulting long time information with e.g. ping status over my 2.4G WLAN networks.
Additional information: I found one utility: https://github.com/simonwunderlich/FFT_eval
This one uses laptop's existing WLAN card (assuming card has certain chipset) to make the proper FFT scan over WLAN band. Here is an example measurement:
I'll try to tweak this utility so that I would get regular (like once per 10 seconds or so) scan results stored to file.
|
As I wrote above, following utility does what is required: https://github.com/simonwunderlich/FFT_eval
This one uses laptop's existing WLAN card (assuming card has certain chipset) to make the proper FFT scan over WLAN band.
This utility can be set up to measure by e.g. one minute intervals when script is added to crontab, or if resolution doesn't need to be so accurate, by having "sleep" command in script.
| How to scan WLAN RSSI in command line? |
1,503,054,508,000 |
I've some problems with the wlan0 interface on an embedded linux distro (compiled with yocto). The problem is that when I use the command:
iwconfig
the wlan0 results with no wireless extensions. But if I write the command:
iw wlan0 scan
it works correctly! And it also works well if I use connman as connection manager instead of iwconfig. I've tried to get up the interfaces with the follow commands:
ip link set wlan0 up
or
ifconfig wlan0 up
but when I checked the status of the file in /sys/class/net/wlan0/operstate the result is always "down". How can I solve this problem?
i want that iwconfig recognize the wlan0 interface.
|
It sounds like either your kernel or the driver for the wireless interface will only support the newer cfg80211 configuration interface used by the iw tool, not the older wireless-extensions interface used by iwconfig.
Does your kernel configuration enable the CONFIG_WIRELESS_EXT option, and/or the CONFIG_CFG80211_WEXT option? The latter option will enable a compatibility layer that will allow old userspace programs like iwconfig to access the configuration of newer-style drivers.
Note that when you use ip link set wlan0 up or ifconfig wlan0 up you'll be setting the administrative state of the interface, or basically the state the interface will want to be in. The /sys/class/net/wlan0/operstate tells you about the operational state of the interface, i.e. what state the interface has actually managed to achieve.
For a wired interface, the operational state changes to up basically reflects the state of the link LED of the interface: when the interface detects the link pulses from the other end (and successfully negotiates the connection speed and other parameters, if applicable), the link LED will light, and the operational state will change to up.
A wireless interface has no cable to plug in, so the equivalent task is associating with a wireless network (and completing any necessary authentication, if applicable). So you should first configure the wireless interface with a network with an ESSID and any necessary network passwords or authentication keys. If the wireless interface is out of range of the wireless AP or the authentication settings are not correct, the wireless interface won't be able to actually transfer packets - and that's what the operational state "down" means.
| iwconfig: wlan0 no wireless extensions |
1,503,054,508,000 |
Trying to connect to my WLAN on an Acer Travelmate 2301LM. System installed is a Puppy Linux Wary 5.3.
Since it doesn't have an internal adapter, I'm trying to integrate a Netgear N300 WLAN-USB-Mini-Adaptor - precisely a WNA3100M.
The Puppy Internet Connection Wizard doesn't list the wireless device.
If I plug it into my Ubuntu desktop and run lsusb, it reads
[..]
Bus 001 Device 007: ID 0846:9021 NetGear, Inc.
lsusb -v reveals
Bus 001 Device 007: ID 0846:9021 NetGear, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0846 NetGear, Inc.
idProduct 0x9021
bcdDevice 2.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 46
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 4
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
How can I get it to connect?
|
your device is not defined on http://wireless.kernel.org/en/users/Devices/USB I also don't see what driver is needed for the chipset. I assume you can use wext driver since it is a generic one, but you need to load the module by modprobe if you don't see the driver on lsmod. But before it, you need to be able to see if the device is working, you can see it by iwconfig if you have the interface. If iwconfig does not output the wifi interface,then you need to verify if you have the correct firmware (.fw extension) which is located on /lib/firmware.
I think you would save a lot time by selecting any device defined on http://wireless.kernel.org/en/users/Devices/USB Atheros chipset is the best in my opinion.
| Connecting to wireless USB adapter - Puppy Linux Wary |
1,503,054,508,000 |
I have a wlan1 connection that I want to share to other computers on my LAN (via Ethernet - eth0). As this is somehow a temporary solution, I want this to be done by a script, so that I do not touch the network configuration files of my host (i.e I'll run this script after each reboot if I want to).
The problem is that I am unable to bridge wlan1 and eth0.
sudo brctl addif br0 eth0 wlan1
I saw that one needs to enable 4addr:
iw dev wlan1 set 4addr on
Indeed, I can then add wlan1 to the bridge, but ... I lose the wifi connection! I saw this is also a common issue :(
In 2, the solution says to do this
iw dev wlan0 interface add wds.wlan0 type managed 4addr on
ip link set dev wds.wlan0 addr $ADDR
ip link set dev wds.wlan0 up
where $ADDR is "WDS device address configured in the router". I don't understand what that is? The MAC address of my network card for wlan1?
And how should I then create my bridge? The following is not working:
sudo brctl addbr br0
sudo brctl addif br0 eth0 wds.wlan0
Or here, they suggest to install ebtables. But the page does not explain how I should create the bridge, and they modify /etc/network/interfaces which I do not want to do...
So, can somebody please help me create that bridge correctly?
So far, my wifi script is:
#!/bin/bash
# this is for wlan1 - wifi connection
pkill dhclient
pkill wpa_supplicant
ip link set dev wlan1 down
ip addr flush dev wlan1
iwconfig wlan1 essid "mywifi"
iwconfig wlan1 frag 2432
iwconfig wlan1 rts 2432
ip link set dev wlan1 up
iwconfig wlan1 rate 1M
dhclient -v wlan1
# this is my IP address on my LAN
ifconfig eth0 192.168.0.8 netmask 255.255.255.0
I am running a Linux Mint 17.1 host. I have installed bridge-utils.
|
Is it possible to bypass the bridging part and use iptables instead?
If so, you can setup source NAT to masquerade traffic going out on the wlan interface.
First you need to enable IP forwarding:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Next, you need to masquerade traffic going out:
sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
Have the LAN connected hosts to use 192.168.0.8 as their default gateway and have your machine to use the wlan0 interface connected gateway as the default gateway.
| Share wlan connection to ethernet using command line |
1,503,054,508,000 |
I have just installed wifite on Debian GNU/Linux 8 (jessie). And when I execute it from Gnome-terminal started to loop prompting this:
enabling monitor mode on wlan0... done
How can i fix it?
|
It could have multiple causes:
Have you installed aircrack-ng?
Does your wireless card support monitor mode? If it's your laptop's internal card, it probably doesn't. Here is a list of recommended cards https://forums.kali.org/showthread.php?19387-802-11-Recommended-Wireless-Cards
The versions of wifite and aircrack-ng do not correspond. A while ago, the aircrack-ng team rewrote the way of naming interfaces from "mon0" to "wlan0mon". You can download the latest version of aircrack-ng from hxxp://www.aircrack-ng.org/downloads.html and you can clone the latest version of wifite from the git repository at hxxps://github.com/derv82/wifite. (Can't show link because of reputation..)
Try the Kali live-cd (pre-installed correct versions of wifite and aircrack-ng) It's at https://kali.org. Use the following command "airmon-ng start wlan0". If it says "failed to bring up card using ip", your card doesn't support monitor mode.
| Wifite problem (loop when I execute) |
1,503,054,508,000 |
For Nokia N900 there is an app called AutoDisconnect which monitors the WLAN usage and closes the connection if the traffic is very low.
I'd like to have something like this on my future notebook in order to save battery life, i.e. to auto disable WLAN when not needed. Is there any solution to achieve this in Linux? I'm planning to use Linux Mint as the distro of my choice.
|
You can use some bandwidth monitoring tool, such as vnstat, for this. To install it on Linux Mint, do:
sudo apt-get install vnstat
Then, you can monitor the average speed of your connection over some specified time, and if the speed comes out to be lower than some specific limit, then turn off your WLAN.
So, let's say you want to switch off your WLAN if your average download rate falls below 5 KB/s over a monitoring time of 30 seconds, then your code would be:
#!/bin/bash
#Taking sudo power initially because it will be required later on
sudo echo "Starting AutoDisconnect"
while true
do
downSpeed=$(vnstat -ru 0 -tr 30 -i wlan0 | grep rx | grep -oP "\d+\.\d+")
if (( $(echo "$downSpeed < 5.0" | bc -l) ))
then
sudo ifconfig wlan0 down
exit #exit now because we don't need monitoring since the interface is down
fi
done
Explanation of important bits
-ru 0 ==> to show the rate in bytes/s (use "1" for bits/s)
-tr 30 ==> take average over 30 seconds usage
-i wlan0 ==> `vnstat` defaults to eth0 on my computer (marmistrz)
bc -l ==> used in bash for doing arithmetic
grep rx ==> considering only the receiving rate (i.e. download rate)
grep -oP "\d+\.\d+" ==> strip out the download rate from the output
| Auto disconnect from WLAN if unused |
1,503,054,508,000 |
I am trying to use Fedora 19 on my Lenovo Yoga 13. A common issue with this setup is that the laptop's Wi-Fi does not work out of the box on any Linux distribution yet. This question and also this question is very similar to mine, in which the askers found working WLAN drivers but had trouble installing them. However, in my scenario to make & make install the driver, I apparently need the following packages:
kernel-headers kernel-devel gcc patch
Because I don't have working wireless or an Ethernet port, I effectively can not use yum to install these from the Internet. I have attempted downloading the rpm packages myself on another machine, transferring them via a flash drive, and using rpm -Uhv to install each one, but they appear to need endless dependencies that I do not have from installing Fedora 19 via a live USB. I gave up after a few hours of trying to navigate these lists of dependencies.
Is there a better way of installing required development packages in order to install a driver when I have no Internet connection?
|
You can yum install from a local repository rather than a network one. If you haven't installed any updates on your system (and it sounds like you haven't), you can use the installation DVD (although not the Live CD / Live USB) version. There are instructions for this in the install guide; the quick version is to mount the DVD somewhere (like /mnt) and create an /etc/yum.repos.d/dvd.repo file like this:
[dvd]
baseurl=file:///mnt/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
and then just go ahead and yum install from this repository. By default, yum will attempt (and fail) to access your networked repos, so you have to either edit the config files to disable them, or run your yum command like this:
yum --disablerepo='*' --enablerepo=dvd install ...
If you don't have a DVD drive, you can do something similar with a USB stick onto which you've copied the contents of the Fedora 19 repository. Of course, you don't really need the whole thing, but just getting it all is the easy way to avoid having to figure out the dependency chain yourself.
| Installing developer libraries for Fedora 19 without internet connection |
1,503,054,508,000 |
I have a LXLE 18.04 LTS and wlan adapter with name wlp7s0b1, which I'm not comfortable with.
Recommended by all /etc/udev/rules.d/70-persistent-net.rules is not present in my installation, although udev is.
/lib/udev/rules.d/75-persistent-net-generator.rules is successfully missing from my distribution and udevadm trigger --action=add doesn't change anything.
I successfully created a link: ln -s /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules, but there was no list devices therefore did not help.
/etc/network/interfaces in my installation does not contain anything useful, as a netplan.
During my attempts to find at least something, I came across the output of the sudo udevadm info /sys/class/net/wlp7s0b1 command:
P: /devices/pci0000:00/0000:00:15.3/0000:07:00.0/bcma0:1/net/wlp7s0b1
E: DEVPATH=/devices/pci0000:00/0000:00:15.3/0000:07:00.0/bcma0:1/net/wlp7s0b1
E: DEVTYPE=wlan
E: ID_BUS=pci
E: ID_MM_CANDIDATE=1
E: ID_MODEL_FROM_DATABASE=BCM4313 802.11bgn Wireless Network Adapter
E: ID_MODEL_ID=0x4727
E: ID_NET_NAME_MAC=wlx60d8190f1e84
E: ID_NET_NAME_PATH=wlp7s0b1
E: ID_OUI_FROM_DATABASE=Hon Hai Precision Ind. Co.,Ltd.
E: ID_PATH=pci-0000:07:00.0-bcma-1
E: ID_PATH_TAG=pci-0000_07_00_0-bcma-1
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Network controller
E: ID_VENDOR_FROM_DATABASE=Broadcom Limited
E: ID_VENDOR_ID=0x14e4
E: IFINDEX=3
E: INTERFACE=wlp7s0b1
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/wlp7s0b1
E: TAGS=:systemd:
E: USEC_INITIALIZED=37531623
In this output, I am very interested in pci-0000:07:00.0-bcma-1. I believe this can be used as a unique identifier instead of a MAC. I would not like to be tied to MAC, since it can be changed with utilities like macchanger, and then, probably, the old name can return. Or is there a binding to the permanent MAC embedded in the chip?
How do I permanently change the name of an interface based on its ID_PATH using udev? Is this renaming method correct?
|
I am very interested in pci-0000:07:00.0-bcma-1. I believe this can be used as a unique identifier instead of a MAC.
Right, the ID_PATH can be used to rename the interface name.
Create a /etc/systemd/network/10-rename-wlp7s0b1.link with the following content:
[Match]
Path=pci-0000:07:00.0-bcma-1
[Link]
Name=wlan0
Changes will be applied after reboot.
| How to propertly permanently rename network interface in LXLE? |
1,503,054,508,000 |
I want to configure guessnet and wpa_supplicant such that if I plug in my LAN cable, it connects to the network via the cable and if I unplug it, it automatically switches to WLAN and vice versa. I managed to make it work, however if I unplug the cable, it takes 10 to 20 seconds to connect to the WLAN network, which is pretty slow. In contrast, if I plug in the cable, it takes just a second to disconnect from WLAN and connect to LAN.
Is there any way to get a better configuration to make the switching to WLAN much faster?
By the way, when I tried new settings I often had to reboot, which was very annoying, a simple service networking restart was not enough - perhaps this has to do something with my configuration.
My system is Ubuntu 13.10. Here are my config-files:
/etc/network/interfaces
auto lo
iface lo inet loopback
#use guessnett
mapping eth0
script /usr/sbin/guessnet-ifupdown
#map timeout: 3
map default: unknown
iface home inet static
address 192.168.1.80
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
test1 peer address 192.168.1.1
iface no-net inet manual
test2 missing-cable
iface unknown inet dhcp
iface wlanWork inet dhcp
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
And this is my /etc/wpa/supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
network={
ssid="mywlan"
scan_ssid=1
psk="1234"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
id_str="home" ## specified in /etc/network/interfaces
}
network={
ssid="wlanWork"
scan_ssid=1
psk="1234"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
id_str="wlanWork" ## specified in /etc/network/interfaces
}
Finally this is /etc/default/ifplugd as generated by dpkg-reconfigure ifplugd
INTERFACES="eth0"
HOTPLUG_INTERFACES=""
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"
Edit I noticed some wired problems with this setup which I cannot reproduce. One time WLAN worked, but LAN didn't have the proper route/gateway. After setting the gateway manually via route add default gw 192.168.1.1 and rebooting, it worked again. After a second reboot nothing worked despite the fact that I got the correct IP (even ping 192.168.1.1 didn't work). Then I had to do sudo dhclient to get a working Internet connection again...
|
Try looking into route metrics. You should be able to sort this by inserting two default routes with different metrics to your routing table. Metrics are used to determine the cost of a route, a route with a lower cost is considered better and will be chosen over other higher cost path.
If you want your LAN-interface to be your primary route you assign it a lower metric than the WLAN one. This way you will always have the WLAN running, but will not used unless the LAN interface is unavailable.
You can use iproute2 to achieve this. iproute2
Your commands will look something similiar to:
ip ro add 0.0.0.0 0.0.0.0 via 192.168.1.1 dev eth0 metric 1
ip ro add 0.0.0.0 0.0.0.0 via 192.168.2.1 dev wlan metric 50
Dont forget to remove your preinstalled default route.
| Configure guessnet to switch automatically between LAN and WLAN |
1,503,054,508,000 |
I'm new to FreeBSD, it's working fine one my Laptop. Only problem is, that my wifi device isn't in ifconfig so I can't use it. I tried a lot of reading but I couldn't get it to work. How can I get my Broadcom chip to work?
Model: Acer Aspire 5820TG
# uname -a
FreeBSD rindtop 10.2-RELEASE-p7 FreeBSD 10.2-RELEASE-p7 #0: Mon Nov 2 14:19:39 UTC 2015
[email protected]:/usr/obj/usr/src/sys/GENERIC amd64
# pciconf -lv
none3@pci0:3:0:0: class=0x028000 card=0xe021105b chip=0x435714e4 rev=0x01 hdr=0x00
vendor = 'Broadcom Corporation'
device = 'BCM43225 802.11b/g/n'
class = network
# dmesg
...
pcib3: <PCI-PCI bridge> at device 28.5 on pci0
pcib3: failed to allocate initial I/O port window: 0x1000-0x1fff
pci3: <PCI bus> on pcib3
pci3: <network> at device 0.0 (no driver attached)
...
# ifconfig
alc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c3198<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE>
ether 60:eb:69:4b:fa:0c
inet 192.168.0.58 netmask 0xffffff00 broadcast 192.168.0.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
# cat /boot/loader.conf
if_bwn_load="YES"
if_bwi_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
fuse_load="YES"
# cat /etc/rc.conf
ifconfig_alc0="inet 192.168.0.58 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
font8x8="cp437-8x8"
hald_enable="YES"
dbus_enable="YES"
fusefs_enable="YES"
...
I tried to provide as much relevant information as I could. You will probably recognize some things I tried. Thanks for your help!
Update
It turnes out the Broadcom card isn't supported by FreeBSD as of 02.01.2016... :(
|
Broadcom has always ignored FreeBSD and fail to supply drivers so we choose to use other wifi devices, mostly Atheros. As of a year ago, I don't see anyone getting that chip to work and can't find it in the FreeBSD hardware compatibility list.
You'll find far more responses and questions about this on the FreeBSD wifi mailing list or the FreeBSD forum than here on SO.
| FreeBSD Broadcom BCM43225 Setup |
1,503,054,508,000 |
I am troubleshooting WLAN connections from my laptop. I have several possible WLANs to connect to. When connection is established, I am unable to see to which AP I am connected.
In my /var/log/daemon.log I only see the DHCP negotiation, but I don't see the AP info.
I am using Debian and dhclient.
Is there a way to get info about the AP I am currently connected to? Can I make the logging more verbose in /var/log/daemon.log
|
Try iwconfig, it might be in the wireless-tools package if not already installed.
| WLAN: get info about AP |
1,503,054,508,000 |
Following these instructions, I found that phy0 on my desktop should support wake on wlan and turned it on.
[root@Arch alex]# iw phy0 wowlan show
WoWLAN is enabled:
* wake up on magic packet
However, when I suspend the system and try to wake it up from a distance, it doesn't work:
[alex@Archlaptop tmp]$ wol 44:E5:17:ED:9E:D2r
Waking up 44:E5:17:ED:9E:D2r...
And nothing happens. Furhermore, if I follow the Arch wiki, I don't get wake-on-wlan:
[root@Arch alex]# ethtool wlo1
Settings for wlo1:
Link detected: yes
What is going on?
|
I found the problem: I had to use wakeonlan with the -i=<ip> option (with ip of course replaced with the ip of the system).
| Wake on wlan should work but doesn't |
1,503,054,508,000 |
I need to install remotely Omxplayer on a Raspberry Pi.
RPi is connected by a LTE modem through PPP0 interface.
My RPI is placed another country and I connect to Raspberry through my VPN using SSH.
My VPN does not have access to Internet and the default gateway is 10.1.64.1 (PPP0).
RPI has also WiFi Connection: WLAN0 interface.
I want to use WLAN0 to launch:"sudo apt-get install omxplayer" without lost my SSH communication through PPP0
ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 184 bytes 11776 (11.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 184 bytes 11776 (11.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.1.64.45 netmask 255.255.255.255 destination 10.64.64.64
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 202 bytes 25021 (24.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 808 bytes 65151 (63.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.93 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::2db7:3540:5e17:a470 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:da:d6:37 txqueuelen 1000 (Ethernet)
RX packets 1806 bytes 369775 (361.1 KiB)
RX errors 0 dropped 620 overruns 0 frame 0
TX packets 184 bytes 25229 (24.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
If I change the default gateway, I lost connectivity with the device.
I have tried the following command but it has not worked: I have lost the ssh connection.
sudo ip route change default via 192.168.1.1 dev wlan0
sudo route add default gw 192.168.1.1
My route table:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
0.0.0.0 192.168.1.1 0.0.0.0 UG 302 0 0 wlan0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
169.254.0.0 0.0.0.0 255.255.0.0 U 203 0 0 wwan0
192.168.1.0 0.0.0.0 255.255.255.0 U 302 0 0 wlan0
$ ip route show
default dev ppp0 scope link
default via 192.168.1.1 dev wlan0 src 192.168.1.205 metric 302
10.64.64.64 dev ppp0 proto kernel scope link src 10.1.64.54
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.104.103 metric 203
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.205 metric 302
How can I select the network interface?
Thanks in advance
|
If I understand correctly you have this arrangement:
(Client)---LAN?---(VPN)---ppp0---(Raspberry Pi)---wlan0---(the internet)
You mentioned that when you change your default route to use wlan0, you lose SSH access. You also indicated that you can't access the internet through ppp0 (through your VPN).
If you just want your r-pi to have internet access...
You can't SSH into your PI when you change the default route because the default route is the only one that can get to your SSH client. So what you can do is add a new route to talk back to your SSH client then change your default route.
A really simple / dirty way to fix this temporarily is:
# Find your current SSH client IP address as seen by the raspberry pi
env | grep SSH_CLIENT
Then assuming this gives you the IP 10.20.30.40 add a route to just that IP:
ip route add 10.20.30.40 dev ppp0 proto kernel scope link
# Now you can change your default route
ip route change default via 192.168.1.1 dev wlan0
A better way to do this is to discover which subnet(s) can be accessed through ppp0 and then create routes for those instead of just your one SSH client. I can't tell how to find these subnets. But once you have this, the technique is the same. (eg subnet 10.20.0.0/16):
ip route add 10.20.0.0/16 dev ppp0 proto kernel scope link
# Now you can change your default route
ip route change default via 192.168.1.1 dev wlan0
| How can I select the network interface for installing a program in linux? |
1,503,054,508,000 |
I have a Linux machine that creates a Wifi hotspot. I need to simulate a few clients connecting to that hotspot and then using that connectiong to talk to a service, through the wlan interface. The service is running in it's own process and the clients would be connecting from another process. Is there a way to achieve this? Something like create another interface on the same subnet as the wlan? Thanks
|
Have a look at the mac80211_hwsim kernel module. This module simulates a number of virtual "radios" (wifi cards, or phys) that communicate with each other. E.g.,
modprobe mac80211_hwsim radios=3
will give you 3 of those. Use iw dev to view them and see their MAC address. Then you can use iw and ip to configure them, and simulate an access point and as many clients as you want. You'll also get a hwsim0 interface of ieee802.11/radiotap type, and you can run wireshark on it to see the messages that go through the "virtual" air.
If the software you are using on the wireless network interfaces can't bind to specific interfaces, consider putting it into a network namespace for each client.
| Linux emulate multiple Wifi connections |
1,503,054,508,000 |
I have a linux box and has ethernet, wlan STA/client and wlan Access Point.
It's a internet connection via ethernet and I can log in to the box via ssh. But I wish to use the box like a wireless router and be able to connect to internet by using for example a smart phone. I can connect my phone to wifi but it has no internet access.
Here are my interfaces:
eth0 is Ethernet
eth1 and eth2 is WLAN
# ifconfig
br0 Link encap:Ethernet HWaddr 00:15:BC:22:17:20
inet addr:10.10.1.116 Bcast:10.10.1.255 Mask:255.255.255.0
inet6 addr: fe80::215:bcff:fe22:1720/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6377 errors:0 dropped:608 overruns:0 frame:0
TX packets:615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:865911 (845.6 KiB) TX bytes:59751 (58.3 KiB)
eth0 Link encap:Ethernet HWaddr 00:15:BC:22:17:20
inet6 addr: fe80::215:bcff:fe22:1720/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6417 errors:0 dropped:6 overruns:0 frame:0
TX packets:623 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:985364 (962.2 KiB) TX bytes:60399 (58.9 KiB)
eth1 Link encap:Ethernet HWaddr 00:15:BC:22:17:21
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth2 Link encap:Ethernet HWaddr 02:15:BC:22:17:21
inet addr:192.168.2.10 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::15:bcff:fe22:1721/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:502 errors:0 dropped:3 overruns:0 frame:0
TX packets:236 errors:0 dropped:8 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44998 (43.9 KiB) TX bytes:24874 (24.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame:0
TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13525 (13.2 KiB) TX bytes:13525 (13.2 Ki
B)
And here is /etc/network/interfaces file:
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet dhcp
iface eth2 inet dhcp
iface br0 inet dhcp
hostname gw-143A
bridged_ports eth0
Wireless:
# iwconfig
tap0 no wireless extensions.
lo no wireless extensions.
br0 no wireless extensions.
eth2 IEEE 802.11-bgn Mode:Master Frequency:2.457 GHz
eth1 IEEE 802.11-bgn ESSID:""
Mode:Managed Frequency:2.437 GHz Access Point: Not-Associated
Bit Rate:0 kb/s
RTS thr:off Fragment thr:off
Encryption key:9F64-0D78-CCAB-A8 [3]
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
sit0 no wireless extensions.
eth0 no wireless extensions.
|
In order for your linux box to act as a WLAN access point, you will need to:
make sure your wireless NICs use a driver which supports AP. Output of lsmod | grep 80211 usually helps. If your driver doesn't support AP mode, you'll have to get a new WLAN adapter which does.
make sure your kernels supports IP forwarding and enable it. This is usually done by running echo 1 > /proc/sys/net/ipv4/ip_forward as root.
configure routing tables to forward network packets from br0 to eth2:
sudo iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
sudo iptables -A FORWARD -i br0 -o eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth2 -o br0 -j ACCEPT
install and configure an access point management software.
configure a DHCP server which would assign your phone an IP address, if this is not already done.
| WLAN connected but no internet access |
1,503,054,508,000 |
switching from Ubuntu 14.04 to Debian jessie (LXDE) on a ThinkPad T500
Lan (eth0) is configured in
/etc/network/interfaces
and works fine.
After setting up LXDE i wanted to switch to WLAN and it lasted hours to get it running.
tried wicd and network-manager with different configurations and browsed many forums.
I could CONNECT but not even ping the router.
The solution with which i got WLAN up and running was
/etc/init.d/networking stop
which I didn't find in any forum or elsewhere.
I was stunning when I realized, who sent me the could not reach host from the ping command... it was the IP of my eth0!!!
Back to my question:
Why is that so hard in Debian? In Ubuntu it works out of the box!
Ubuntu is Debian-based, but gets the job done. Why isn't (kind of) this simplicity integrated backwards into Debian?
EDIT:
I removed my configuration from
/etc/network/interfaces
so the "Wired Connection" is handled by network-manager and it still works.
PS:
I know its a long and weird post (and question) but I wanted to at least document the success anywhere on the web...
|
There are three reasons, history, purpose and philosophy. Debian is much older than Ubuntu, and is hesitant to break things that work, particularly when the replacements require user intervention. Ubuntu is newer and had no install base when they developed their solution. Ubuntu is designed to be easy to use, Debian is designed to be powerful. My favorite example of this is there was some talk of having debian adopt Ubuntu's installer because it was prettier. The response was why would we want to do that when what we have a something that is so much more powerful, we'll just make ours better looking. The networking setup has similar elements, but is more complicated. Ubuntu is designed so that 90% of the people using it can just get on the network and not have any difficulties. Debian has at least three fully functional, completely incompatible ways to configure the network so you can use the one you want. You discovered one of the disadvantages, in that using two methods at the same time is tricky at best (and recommended only for those who know what they are doing or just into making life difficult). As far as I know all the network configuration systems work well for their designed function.
wicd is designed for machines that move. It makes switching between networks easy. It can function fine for fixed wireless or fixed wired connections. It requires user intervention when moving between networks, but is easy to use.
gnome has its own network configuration tool, I have never used it.
The traditional debian networking tools are optimized for the complicated. If you are likely to use two or more network cards at the same time, it will do everything you want. as it does not have a gui it is prefered for servers, firewalls, and routers. it has support for ppp, pppoe, static interfaces, vlans and vpns in addition to the expected wlan and ethernet interfaces. It is however difficult to configure for machines that use different networks at different times.
If memory serves I have read about other network configuration tools.
Two things that will give you fits every time are to try to have two different systems configure the same interface or to set the default route.
Personally I don't find either system difficult as long as you only use one.
| Why is setting up WLAN in Debian so hard? (compared to Ubuntu) [closed] |
1,503,054,508,000 |
I'm installing a Angstrom (custom build, not the default build) on a Beagleboard XM.
I can scan for wireless networks using iwlist and see the neighborhood wireless devices.
I have set my SSID and Key (a 10-digit hex code using lowercase) in /etc/network/interfaces
When I do a ifup wlan0, it goes through the process of DHCPDISCOVER and then says
No DHCPOFFERS received.
The device is an Alfa USB with a Realtek rtl8187 chipset. (which works fine when used under Debian on my laptop).
Why isn't my SSID displayed properly under iwconfig, and why won't the interface get an IP via DHCP?
|
Thanks to @slm for sending me to the how-to reference.
It appears the biggest issue was that NetworkManager was running and because I have no GUI (the BeagleBoard version of nmcli does not have the "connect" feature allowing for the creating of new interfaces on the command-line, and I am only connecting to the beagleboard via a serial port (no GUI)) I had no means to setup new connections. Further, NetworkManager may have been killing connections which I was finally able to see proof of in /var/log/syslog.
So the solution was to prevent NetworkManager from running and run and setup manually the necessary configuration for wpa_supplicant.
With wpa_supplicant running and NetworkManager not running (and bringing the interface up/down several times) I was finally able to get a DHCP assigned, and the Internet is now reachable through a wireless connection on the Beagleboard.
I'll have to continue to fiddle and experiment to ensure this connection comes up smoothly at boot-time (and to ensure that the Ethernet port will continue to work) but at least I've overcome the immediate road-block.
| Why is my wlan0 interface on Angstrom (Beagleboard) "Not Associated"? |
1,556,748,703,000 |
I'm trying to setup the WiFi connection on my Lenovo B590 but I get the following error :
ifdown: interface wlan0 not configured wpa_supplicant:
/sbin/wpa_supplicant daemon failed to start run-parts:
/etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011
Internet Systems Consortium. All rights reserved. For info, please
visit https://www.isc.org/software/dhcp/
Cannot find device "wlan0" Bind socket to interface: No such device
Failed to bring up work-network
So I looked up which firmware I need so my Debian 7 Wheezy system could find wlan0.
NOTE: the wlan chipset is a Broadcom Corp. BCM43142 and its PCI-ID is 14e4:4365
host@user $ lspci -vnn -d 14e4: |grep Network
02:00.0 Network controller [0280]: Broadcom Corporation BCM43142
802.11b/g/n [14e4:4365] (rev 01)
I found this article on the Debian Wiki giving all the steps needed to get it working, I followed them and got no errors anywhere.
I set up the WiFi interface with wpa_supplicant but when I run
$ ifdown wlan0
$ ifup wlan0=work-network
I still get the error Cannot find device "wlan0" Bind socket to interface: No such device
Do you know what is missing for it to work?
EDIT: below is the dmesg output
$ dmesg |grep broadcom -i
[ 2.574645] usb 1-1.4: Manufacturer: Broadcom Corp
[ 6.828086] eth1: Broadcom BCM4365 802.11 Hybrid Wireless Controller 6.20.55.19 (r300276)
[ 10.343512] Broadcom 43xx driver loaded [ Features: PMNLS ]
And here is the content of /etc/network/interfaces
# The loopback network interface
auto lo
# iface lo inet loopback
iface work-network inet dhcp
wpa-conf /etc/wpa_supplicant/work-network.conf
# The primary network interface
auto eth0
allow-hotplug eth0
|
If your system is not reporting a device wlan0 as available then the Linux kernel was unsuccessful in detecting your hardware and associating a driver to it. I would start by looking in the dmesg output for any messaging related to the Broadcom device.
If it's being reported there in any way then the appropriate driver is either not present within the kernel/system or it is misconfigured for your particular system.
Finding a driver
Searching a bit on the name of your card + linux yielded this thread titled: Thread: Broadcom BCM43142 Driver Ubuntu 12.10 64 Bit which has details on how to install/configure an appropriate driver for your system.
| Why is my BCM43142 chipset is not recognised and device wlan0 not found? |
1,556,748,703,000 |
I wish to use a laptop and simultaneously connect wirelessly to an intranet and to the Internet. Assume the subnet IP address ranges are 192.168.0.X for the network with Internet access and 10.10.0.X for the intranet. I'm running Arch Linux on a 2017 model Lenovo ThinkPad. It seems that my wireless card supports combinations. I do not fully understand all the output below, but I think it confirms that my card can function in several modes at the same time.
iw list | grep -A 2 'interface combination'
valid interface combinations:
* #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
total <= 3, #channels <= 2
I used this answer to get started: https://askubuntu.com/a/488604/36661
I have verified that the following command succeeds:
iw dev wlan0 interface add wlan1 type station
After running that command, I see this interface:
4: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether c6:d1:7c:2b:1a:b2 brd ff:ff:ff:ff:ff:ff
However, I am not having success connecting that interface to the second access point. First I tried the NetworkManager GUI, where I created a new wireless connection, gave it a random MAC address, assigned it to the new wlan1 virtual interface and set all the other properties as I normally would. But NetworkManager did not give me the option to connect to it.
As a second step, I tried nmcli as shown:
nmcli c up wlan1_virtual
Error: Connection activation failed: No suitable device found for this connection.
My next step was:
ip link set dev wlan1 up
RTNETLINK answers: Device or resource busy
What should I do next?
I got one idea from this page:
documentation:iw [Linux Wireless] https://wireless.wiki.kernel.org/en/users/documentation/iw/vif
The idea is to create an ad-hoc network:
iw phy phy0 interface add ah0 type ibss
ifconfig ah0 up
iw dev ah0 ibss join AdHocNetworkName 2412
Is that the right direction?
BTW, I have read conflicting answers on this subject. The answer linked above indicates this is possible, but this one says it is not possible. But the accepted answer on that question says it is possible. So far, it seems there are more "yes, it's possible" answers. So I am forging ahead.
$ uname -a
Linux 4.18.7-arch1-1-ARCH #1 SMP PREEMPT Sun Sep 9 11:27:58 UTC 2018 x86_64 GNU/Linux
If more info is needed, I'll provide it.
|
Your interface combinations
* #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
total <= 3, #channels <= 2
clearly say "number of simultaneous managed interface must be less or equal than one". In other words, you can't add a second interface of type station (which is the same as managed).
So no, you can't use this adapter to connect to two (or more) different access points as a station. You'll need an additional adapter, or a different one that supports multiple stations.
| How to simultaneously connect to two different networks via WiFi access points (laptop with one WiFi card) |
1,556,748,703,000 |
I'm trying to set up apache2 server on Debian 9. I'm using an laptop with Ralink network-card, witch was able to use eth0, at Debian 8, with looks more familiar for me. Since I update my system to 9 my network interface has changed and looks something like this:
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp37s0 1500 0 0 0 0 0 0 0 0 BMU
lo 65536 612 0 0 0 612 0 0 0 LRU
wlo1 1500 36736 0 1 0 20492 0 0 0 BMRU
and in the /etc/interfaces.d/setup file it's defined like:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
What is the enp37s0? And why am I connected to the router with wlo1, not eth0?
My routing table:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.63.16.1 0.0.0.0 UG 600 0 0 wlo1
10.63.16.0 0.0.0.0 255.255.255.0 U 600 0 0 wlo1
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlo1
Is that a proper configuration?
|
Please do see Chapter 2. What's new in Debian 9 from the Release Notes for Debian 9 (stretch), 64-bit PC
2.2.9. New method for naming network interfaces
The installer and newly installed systems will use a new standard
naming scheme for network interfaces instead of eth0, eth1, etc. The
old naming method suffered from enumeration race conditions that made
it possible for interface names to change unexpectedly and is
incompatible with mounting the root filesystem read-only. The new
enumeration method relies on more sources of information, to produce a
more repeatable outcome. It uses the firmware/BIOS provided index
numbers and then tries PCI card slot numbers, producing names like
ens0 or enp1s1 (ethernet) or wlp3s0 (wlan). USB devices, which can be
added to the system at any time, will have names based upon their
ethernet MAC addresses.
This change does not apply to upgrades of jessie systems; the naming
will continue to be enforced by
/etc/udev/rules.d/70-persistent-net.rules. For more information, see
/usr/share/doc/udev/README.Debian.gz or the upstream documentation.
see also How can I show the old eth0 names and also rename network interfaces in debian 9 stretch?
I would advise you to take a bit of time to familiarize yourself with Debian 9 before upgrading Debian 8 to Debian 9 systems, and/or following recent documentation/tutorials as the changes under the hood are significant.
| Debian 9; setting network devices for an www server |
1,556,748,703,000 |
I'm looking for a simple way to configure an external Access Point (IP address, SSID, WPA key, turn WiFi on/off, etc.) via Linux command line instead of the standard web interface that APs offer.
This could be either an off-the-shelf AP that offers this feature, or a procedure to accomplish this with any standard APs. I realize the question might seem too broad; I'd like to find the simplest solution for this.
|
You'll (almost certainly) need to flash a custom firmware on the AP to enable this functionality. The two most common firmwares to use for this are OpenWRT and DD-WRT. They're very similar but have slightly different hardware compatibility lists. If you already have the AP check to see if one of them support it. If you're looking to buy an AP check it's compatibility with one of them before you buy. I've done extensive work with DD-WRT on a Linksys WRT54GL and it works like a charm. Best wifi router ever made IMHO.
| Access Point configurable via Linux [duplicate] |
1,556,748,703,000 |
I've changed my PCI wireless cards several times, and the wlan# interface numbers keep increasing by one. To be more specific, the first wifi interface name was wlan0, after removing that card and installing new one to same slot, the interface name became wlan1 after another one it became wlan2 and so on.
I've been wondering how to clean this cache and make the last connected driver wifi interface name wlan0 ?
Thank you
|
You can Found the entries at /etc/udev/rules.d/70-persistent-net.rules
| DEBIAN - How to clean known wifi interface list |
1,556,748,703,000 |
Debian Wheezy on ARM: wlan0 works with DHCP but doesn't work with static IP.
This is my /etc/network/interfaces
auto lo wlan0
iface lo inet loopback
iface wlan0 inet static
wpa-ssid "mySSID"
wpa-psk "myPASS"
address 10.1.30.33
netmask 255.255.0.0
gateway 10.1.1.1
But it doesn't work: I get the interface listed with ifconfig, but I cannot ping anything (nor I cannot be pinged). If I set inet dhcp everything works...
Thanks for your help.
|
A few things to consider here:
What's the output of route command? There should be a
"default" destination listed.
cat /etc/resolv.conf should have
at least one address in it. mine is 127.0.0.1 but can be your routers
address or others.
Are you actually connected to a router? try iwgetid I believe that shows the connected BSSID or nothing if not connected.
Alternatively you could set up a reserved DHCP address on your router so it uses DHCP but you're address is fixed.
| Cannot configure wlan0 with static ip? |
1,556,748,703,000 |
I have a mid-old laptop that I want to use for learning more details about Linux, so I decided for a first-time Gentoo installation. I can only connect via WLAN to internet with this laptop. My router only supports WPA(2). My biggest USB stick has 2GB for the live linux, so the full Gentoo live DVD (larger than 2GB) is no option. The minimalist Gentoo has no wpa_supplicant (which would be needed for WPA), however.
What is the best option for me to follow the Gentoo manual as closely as possible?
|
Just Download a Live-Distro of your choice (with wpa_supplicant) with the same arch (32/64 bit) you'll choose for gentoo later, too
Create a bootable USB-Stick from it
Boot from the USB-Stick
Most of the upcomping steps require root privileges, so you could do a su in your Live-Distro and go on as root.
Create your partitions (/boot,/home/,/) e.g. with fdisk on the hdd of the laptop
Create FileSystem with:
mkfs.ext2 /dev/WHATEVER_YOUR_BOOT_IS,
mkfs.ext4 /dev/WHATEVER_YOUR_HOME_IS
and
mkfs.ext4 /dev/WHATEVER_YOUR_ROOT_IS
mkdir /mnt/gentoo
Mount /-partition to /mnt/gentoo with:
mount /dev/WHATEVER_YOUR_ROOT_IS /mnt/gentoo
Create directories for mounting /home and /boot with:
mkdir /mnt/gentoo/{boot,home}
Mount /home and /boot with:
mount /dev/WHATEVER_YOUR_BOOT_IS /mnt/gentoo/boot
and
mount /dev/WHATEVER_YOUR_HOME_IS /mnt/gentoo/home
Download stage3 gentoo 32/64 bit (not hardened for now) to the User directory of your live-system
In the directory of the stage3:
tar -C /mnt/gentoo -xjf stage3.....tar.bz2 (that could take a moment)
Now chroot into your new gentoo
Install wpa_supplicant and bootloater
Shutdown Live-USB, unplug USB-Stick, reboot
Now you should be able to boot into your gentoo (i hope i didn't missed anything :>)
| What live linux smaller 2GB and with pre-installed `wpa_supplicant` is suited best for Gentoo installation? |
1,556,748,703,000 |
I have a Compaq CQ58 laptop with fresh Debian 12. I would like to fix one problem, namely the non-working WLAN on/off button. Constantly lights up yellow (it should be either yellow or blue) and does not respond to pressing. xev does not catch its pressing.
|
Debian 12 ships with the latest Linux LTS when it was released: Linux 6.1
For the 6.1 version the driver handling WMI keys exists:
CONFIG_HP_WMI:
HP WMI extras found in drivers/platform/x86/Kconfig
The configuration item CONFIG_HP_WMI:
prompt: HP WMI extras
[...]
found in Linux kernels: 2.6.29–2.6.39, 3.0–3.19, 4.0–4.20, 5.0–5.19, 6.0–6.1
modules built: hp-wmi, hp-wmi, hp-wmi
[...]
Say Y here if you want to support WMI-based hotkeys on HP laptops and
to read data from WMI such as docking or ambient light sensor state.
But actually there's an additional toggle to get this option: X86_PLATFORM_DRIVERS_HP which appeared in 6.2 and was backported to 6.1 later. This created a regression, because this new option wasn't enabled in Debian's kernel 6.1:
$ grep CONFIG_X86_PLATFORM_DRIVERS_HP /boot/config-6.1.0-12-amd64
# CONFIG_X86_PLATFORM_DRIVERS_HP is not set
resulting in no CONFIG_HP_WMI option appearing at all in Debian's kernel. Older kernels (such as linux-image-6.1.0-9-amd64) still provided this driver.
What can be done now?
Debian 12 offers currently in backports Linux 6.4.4 (pulling linux-image-6.4.0-0.deb12.2-amd64) which does enable this option and thus does provide the hp_wmi kernel module.
Instructions on activating backports: https://backports.debian.org/Instructions/
Or you can use https://snapshot.debian.org/ in a similar way to use the latest provided kernel before the regression: linux-image-6.1.0-9-amd64 (does include hp_wmi).
Once booted in an adequate kernel, please verify that the module hp_wmi (from file hp-wmi.ko) is loaded:
lsmod | grep hp_wmi
If not, as root (so using first su - or sudo -i) attempt to load it with:
modprobe hp_wmi
If it tells nothing chances are it's working. If it returns something like:
modprobe: ERROR: could not insert 'hp_wmi': No such device
that would mean this answer didn't solve the problem (ie: the module doesn't recognize the current hardware).
What should be done later?
Using a -backports kernel is not recommended, because it doesn't receive any timely security update. Likewise, keeping an older kernel means it's not updated.
Switching the kernel to a testing/unstable kernel, while not best practice would be better than backports, but some adequate care must be done to avoid upgrading by mistake the whole Debian 12 into testing/unstable.
Really, you should file a Debian bug for the kernel (can't tell if this should be for kernel or for linux) asking that CONFIG_X86_PLATFORM_DRIVERS_HP and HP_WMI get enabled in Debian 12's stable kernel because it's causing a regression.
| HP Wlan button and led dont't work |
1,556,748,703,000 |
With the following configuration on Devuan Chimaera Linux:
/etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
pre-up /sbin/wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down /usr/bin/killall -q wpa_supplicant
/etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="MySSID"
psk="redacted"
}
ctrl_interface=/run/wpa_supplicant
update_config=1
dhclient only runs when the interface first comes up.
If I use ifconfig wlan0 down, the IP address is retained while down and ifconfig wlan0 up brings the interface back up without running dhclient.
Unfortunately I have a custom /etc/dhcp/dhclient-exit-hooks.d/wlan0-routes which adds custom routes, calculated from the default route provided by dhclient.
When I bring wlan0 down, the custom routes are lost, as expected.
When I bring wlan0 up, dhclient does not run and so the custom routes are not re-added.
Update:
There seems to be a difference in the behaviour of ifconfig wlan0 down (which caused this) and ifdown wlan0.
root@demo:~# ifconfig wlan0 down
root@demo:~# ip addr show wlan0
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 00:0e:8e:4c:f6:a3 brd ff:ff:ff:ff:ff:ff
inet 192.168.98.196/24 brd 192.168.98.255 scope global dynamic wlan0
valid_lft 7130sec preferred_lft 7130sec
root@demo5:~# ifconfig wlan0 up
...
root@demo5:~# ifdown wlan0
root@demo5:~# ip addr show wlan0
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 00:0e:8e:4c:f6:a3 brd ff:ff:ff:ff:ff:ff
When I use ifdown wlan0 instead of ifconfig wlan0 down dhclient is called when I bring the interface up, and everything works as it ought.
What is the difference between ifconfig wlan0 down and ifdown wlan0?
|
quoting from man:
the ifup and ifdown commands may be used to configure (or, respec-
tively, deconfigure) network interfaces based on interface definitions
in the files /etc/sysconfig/network and
/etc/sysconfig/network-scripts/ifcfg-<configuration>
while
Ifconfig is used to configure the kernel-resident network
interfaces. It is used at boot time to set up interfaces as
necessary. After that, it is usually only needed when debugging
or when system tuning is needed.
ifconfig is part of the net-tools (networking utilities) https://net-tools.sourceforge.io/
i think it's kind of an obsolete and deprecated tool replaced by iproute2 https://wiki.linuxfoundation.org/networking/iproute2
| How to make dhclient run when wlan0 is brought back up (but already has an old address) |
1,556,748,703,000 |
I'm brand new to server configuration. I'm just a developer, so forgive me if I don't understand what you're talking about, if I haven't posted enough information, or if I don't understand your terminology.
You should know that my SSID is hidden. I have confirmed both the SSID and passkey are correct on a computer that is connected to the network.
What I've done so far:
Installed Debian (Jessie) to an i386 "server."
Installed wpa_supplicant.
Read the "README.modes" file associated with wpa_supplicant
Attempted to use the non-roaming method by changing my "interface" file in the "network" directory.
My attempt at #4 on that list was guided by this post. I did the following...
Change the "interface" file permissions.
Run the "wpa_passphrase" command.
Copy the hashed PSK to the "interface" file.
My "interface" file now contains...
auto wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid mySSID
wpa-psk myHashedPSK
I have confirmed that my device is recognized by using "iwconfig" and that it is indeed defined as "wlan0."
The Problem:
"ifup wlan0" returns the following...
run-parts: failed to stat component /etc/network/if-pre-up.d/wpasupplicant: No such file or directory
Failed to bring up wlan0.
I have navigated to "/etc/network/if-pre-up.d/" and found something there named "wpasupplicant." When I open it in the text editor using "pico" I am greeted with what I assume is a completely empty file.
What is wrong with my configuration, and how do I fix it?
|
You are missing the wpasupplicant package. You need to install it properly first.
You can do it with apt-get as below:
apt-get install wpasupplicant
Make sure it is properly installed.
And then to be on the safe side, put double quotes around the values like following and try again:
wpa-ssid "mySSID"
wpa-psk "myHashedPSK"
| Failure starting Wlan connection with wpa_supplicant? |
1,556,748,703,000 |
I'm trying to set up an own Cloud Lab on a self-built server.
Server details:
Board: Gigabyte Z77MX-D3H TH
CPU: Xeon E3-1245 v2
16GB Crucial Ballistix CL8 1600Mhz
NETWORK: ALFA AWUS036H
additional crap (like crap-hdd, cooler, etc).
I can only use (at this moment) a wireless connection because the box is far away from the router.
I tried with Cloudstack and wanted to try with Openstack but I have read a lot of about (people who work with in production) that it is not a good solution and it will be more useful for me to try out with ProxMox.
Now I have ProxMox up, but I can not establish any wireless-connections. At the PVE-Forum I got that they don't support or have not provided any wireless-network setup because PVE has some problems because of bridging.
My question is now:
I have my metal here (see hardware description above).
I have almost no experience with virtualization on Unix/Linux.
(I'm using VMware WS on my Ubuntu and I worked some weeks with OpenNebula (setting up and s.o.).
-> What should I use for my Cloud Lab / virtualisation environment, and if ProxMox is a good point to go on, how to solve the wireless problem?
EDIT:
I will definitely need kvm as hypervisor.
|
You should use devstack. Have a look at the instructions here:
http://devstack.org/guides/single-machine.html
| Problems setting up own Cloud Lab |
1,556,748,703,000 |
Proxy server
In computer networking, a proxy server is a server application or appliance that acts as an intermediary for requests from clients seeking resources from servers that provide those resources. A proxy server thus functions on behalf of the client when requesting service, potentially masking the true origin of the request to the resource server.
I want to know that if I set the proxy automatic than will it work for wlan0/wifi?
|
If the Xisilon.Xyz network has a proxy available, and the network administrator has set up the proxy auto-discovery information correctly, then yes, the web browser(s) and any HTTP/HTTPS features of your Kali desktop environment should use that proxy if you set that setting to Automatic.
The proxy may still be set to require authentication before it can be used.
Note that you would then be using the proxy that is under the network administrator's control, and that proxy will most likely log the real IP address of any incoming connections, so you cannot really mask the origin of your requests from the administrator that way.
Also, if you install a proxy software to your Kali system, that won't mask you either, because the source IP address of any outgoing connections from the proxy on your Kali system is still going to be the IP address of the Kali system.
| proxy in kali linux |
1,556,748,703,000 |
I'm trying to make the WLAN USB stick connect to a wireless network.
There was an official Linux driver available for download (v4.0.2_9000.20130911, which supports my Linux kernel version) and I used wifi-radar
Both had no success in making it work. Probably the driver is not compatible with my Oracle Linux (based on Red Hat Enterprise Linux 6)
# lsusb | grep WLAN
Bus 002 Device 017: ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter
The problem is that the device still can't be detected even after the driver installation runs to the end. I don't know how to check if it was actually installed, or where it is mounted.
# cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/driver/rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911
# make
(no errors)
# make install
(no errors)
# /sbin/modprobe 8192cu
# ifconfig wlan0 up
wlan0: unknown interface: No such device
# /sbin/iwconfig
virbr0-nic no wireless extensions.
eth0 no wireless extensions.
eth1 no wireless extensions.
virbr0 no wireless extensions.
lo no wireless extensions.
Is it possible to somehow specify it manally in wifi-radar or what steps should I take?
|
After plugging the USB in and out and running the updated script again I made it work. I also ran the install.sh script provided with the driver, but it seems that was not needed. Here is my setup:
# cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/driver/rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911
# make
(no errors)
# make install
(no errors)
# /sbin/modprobe 8192cu
# /sbin/iwconfig
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"KDG-44A11" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.412 GHz Access Point: DC:53:7C:A4:4A:16
Bit Rate:300 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:****-****-****-****-****-****-****-**** Security mode:open
Power Management:off
Link Quality=100/100 Signal level=73/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
eth1 no wireless extensions.
virbr0 no wireless extensions.
lo no wireless extensions.
| Setting up a WLAN usb stick |
1,406,187,154,000 |
I'm using a Flask application with virtual environment. When I start the server, I can access it locally via the IP 127.0.0.1:5000, but I'd like to make it accessible on my WLAN (pointing at 10.0.0.1:5000). I don't know if it is possible, the fact that virtual environment kind make my server sandboxed.
I tried naively to change my /etc/hosts file
127.0.0.1 10.0.0.2
but when I launch my browser at http://10.0.0.2:5000, that doesn't work.
(I can still access other services on http://10.0.0.2, but the redirection at port 5000 is not working).
I'm not sure to get it right. Help will be greatly appreciated.
Edit
for the virtual environnement, I'm just using virtualenv, a utility to handle python dependancy. Then I installed Flask-SocketIO. I'm not sur if it is actually really sandboxed, but the fact is I can't connect to port 5000.
if I do
sudo nestat -anp | grep 5000
I get:
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 18541/python
|
Why don't you make Flask to listen on all public IPs.
http://flask.pocoo.org/docs/0.10/quickstart/#a-minimal-application
Externally Visible Server
If you run the server you will notice that the server is only
accessible from your own computer, not from any other in the network.
This is the default because in debugging mode a user of the
application can execute arbitrary Python code on your computer.
If you have debug disabled or trust the users on your network, you can
make the server publicly available simply by changing the call of the
run() method to look like this:
app.run(host='0.0.0.0')
This tells your operating system to listen on all public IPs.
| Is it possible to redirect a local port to a LAN port? |
1,406,187,154,000 |
The problem concerns a driver support regression for the RTL8192CUS WLAN chip under antiX 13.1, a Debian Wheezy (stable) based distribution.
The chip actually resides in a Edimax EW-7811Un 802.11n wireless adapter.
First, here is some general system information.
$ inxi -F
System: Host: 4000cdt Kernel: 3.7.10-antix.3-486-smp i686 (32 bit)
Desktop: IceWM 1.3.7 Distro: antiX-13.1_386-full Luddite 19 June 2013
Machine: No /sys/class/dmi, using dmidecode: you must be root to run dmidecode
CPU: Single core Pentium II (Deschutes) (-UP-) cache: 512 KB flags: (pae) clocked at 233.275 MHz
Graphics: Card: Chips and F65555 HiQVPro X.Org: 1.12.4 drivers: chips (unloaded: fbdev,vesa) Resolution: [email protected]
GLX Renderer: Gallium 0.4 on softpipe GLX Version: 2.1 Mesa 8.0.5
Network: Card: Edimax EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
IF: N/A state: N/A mac: N/A
Drives: HDD Total Size: 40.0GB (8.7% used) 1: id: /dev/sda model: TOSHIBA_MK4032GA size: 40.0GB
Partition: ID: / size: 9.9G used: 3.0G (32%) fs: ext4 ID: /home size: 25G used: 284M (2%) fs: ext4
ID: swap-1 size: 2.15GB used: 0.00GB (0%) fs: swap
Sensors: System Temperatures: cpu: 71.0C mobo: N/A
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 88 Uptime: 2:57 Memory: 72.4/151.4MB Client: Shell (bash) inxi: 1.9.9
During booting, the following errors appear on the screen, caused while executing the /etc/network/if-pre-up.d/linux-wlan-ng-pre-up script:
FATAL: Module p80211 not found.
/etc/network/if-pre-up.d/linux-wlan-ng-pre-up
Failed to load p80211.ko.
Listening on LPF/wlan0/00:1f:1f:bf:45:7a
Sending on LPF/wlan0/00:1f:1f:bf:45:7a
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
The error messages can be reproduced by issuing respectively the sudo modprobe p80211 and sudo dhclient -v wlan0 commands.
The following modules are loaded:
$ lsmod
Module Size Used by
mperf 870 0
cpufreq_stats 2600 0
cpufreq_powersave 575 0
cpufreq_conservative 3562 0
ppdev 4124 0
lp 6127 0
uinput 5093 1
nfsd 156046 2
auth_rpcgss 19755 1 nfsd
nfs_acl 1576 1 nfsd
nfs 88586 0
lockd 42731 2 nfs,nfsd
fscache 21695 1 nfs
sunrpc 122417 6 nfs,nfsd,auth_rpcgss,lockd,nfs_acl
af_packet 19031 6
dm_crypt 10846 0
arc4 1400 2
rtl8192cu 45534 0
rtlwifi 43564 1 rtl8192cu
rtl8192c_common 23999 1 rtl8192cu
mac80211 192647 3 rtlwifi,rtl8192c_common,rtl8192cu
cfg80211 123731 2 mac80211,rtlwifi
microcode 8484 0
evdev 6815 10
mac_hid 2214 0
psmouse 52159 0
pcspkr 1273 0
serio_raw 3177 0
i2c_piix4 6769 0
toshiba_acpi 10065 0
sparse_keymap 1937 1 toshiba_acpi
parport_pc 23969 1
rfkill 10599 3 cfg80211,toshiba_acpi
parport 21942 3 lp,ppdev,parport_pc
wmi 6240 1 toshiba_acpi
pcmcia 24870 0
battery 5391 0
yenta_socket 15802 0
ac 1753 0
pcmcia_rsrc 5995 1 yenta_socket
pcmcia_core 8446 3 pcmcia,pcmcia_rsrc,yenta_socket
processor 23837 1
button 3513 0
btrfs 555574 0
zlib_deflate 15207 1 btrfs
dm_mod 51354 1 dm_crypt
floppy 41663 0
fan 1818 0
thermal 6606 0
thermal_sys 10423 3 fan,thermal,processor
Proof that this is not an authentication issue:
$ sudo cat /var/log/dmesg |grep wlan0
[ 36.321107] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 38.921480] wlan0: authenticate with 00:xx:xx:xx:xx:xx
[ 38.971473] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 1/3)
[ 38.996892] wlan0: authenticated
[ 39.000218] wlan0: associate with 00:xx:xx:xx:xx:xx (try 1/3)
[ 39.055578] wlan0: RX AssocResp from 00:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=2)
[ 39.056549] wlan0: associated
[ 39.056781] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 49.062856] wlan0: disassociating from 00:xx:xx:xx:xx:xx by local choice (reason=3)
[ 49.086100] wlan0: deauthenticating from 00:xx:xx:xx:xx:xx by local choice (reason=3)
[ 50.431396] wlan0: authenticate with 00:xx:xx:xx:xx:xx
[ 50.481575] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 1/3)
[ 50.684150] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 2/3)
[ 50.888146] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 3/3)
[ 51.092212] wlan0: authentication with 00:xx:xx:xx:xx:xx timed out
$ sudo iwconfig
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr:off
Encryption key:off
Power Management:off
lo no wireless extensions.
I already tried:
Installing the Linux driver from the Realtek site whilst uninstalling the linux-wlan-ng package and blacklisting the kernel's rtl8192cu module (what worked before with antiX 12M), and
Giving ipv6.disable=1 as a grub boot parameter to the kernel.
Questions
Why can the p80211 module not be found in a distribution that is supposed to be based on Debian Wheezy stable?
How do I get DHCP working for this wireless adapter?
|
FATAL: Module p80211 not found. is usually an indication that the provided driver is outdated for the used kernel.
Moreover, current version 3.4.4_4749.20121105 of Realtek's driver will not compile with the latest Linux kernels. The solution consist in installing a downgraded kernel, compiling Realtek's driver on it and blacklisting the driver provided by the downgraded kernel.
Press Ctrl+Alt+F1 to obtain a command line outside the display manager.
Execute the smxi.sh script that comes packed with Antix.
sudo smxi
For other GNU/Linux distributions, download the script from smxi.org. Follow the instructions. A dist-upgrade is not always necessary.
Choose: 6) kernel-options > 1) alternate-kernel-install
Kernel 3.6.0-11.dmz.1-liquorix-686 or lower work, kernel 3.7.0-10.dmz.1-liquorix-686 and higher do not. The latest stable kernel with long-term support that does work is 3.4.0-35.dmz.1-liquorix-686.
Be sure to reboot into the new kernel before proceeding.
This kernel can be made to boot by default; simply edit...
sudo nano /boot/grub/menu.lst
Download the RTL8192CUS Linux driver from Realtek's web site.
Extract the driver. Then, save below bash script as setup.sh in the same directory as install.sh. (I got this script from Schoelje of SolydXK-distro fame.)
#!/bin/bash
if [ $UID -ne 0 ]; then
echo "Please, type the root password..."
su -c "$0 $@"
exit
fi
apt-get install linux-headers-`uname -r`
apt-get install build-essential
rmmod rtl8192cu
chmod +x install.sh
./install.sh
echo "blacklist rtl8192cu" > /etc/modprobe.d/blacklist-rtl8192cu.conf
echo 8192cu >> /etc/modules
Make the script executable and execute it.
chmod +x setup.sh
./setup.sh
After succesfull completion of the script, issue
sudo service network restart
Your RTL8192CUS wireless adapter should now function properly.
Use the Wicd application to connect to a wireless network.
If always the same WLAN is used, one can also hardcode the security credentials in as follows:
sudo chmod 600 /etc/network/interfaces
sudo nano /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-ssid xxxxxxxxxxx
wpa-psk xxxxxxxxxxxx
| FATAL: Module p80211 not found. RTL8192CUS WLAN regression under antiX 13.1 (Debian Wheezy) |
1,406,187,154,000 |
I have recently installed Debian 10.9 with KDE. And tried to use WiFi and learned that my wlan is unclaimed by doing this:
neevan@nebian:~$ sudo lshw -C network
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
...
...
*-network UNCLAIMED
description: Network controller
product: Realtek Semiconductor Co., Ltd.
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress cap_list
configuration: latency=0
resources: ioport:3000(size=256) memory:b1000000-b100fff
Here's what I have done to fix it:
sudo apt install firmware-realtek and restart didn't work
I have also installed lot of unofficial drivers from GitHub
I have followed every answer of this question on unix & linux
I have learned that my particular wlan device doesn't have drivers in kernel <= 4, so i enabled back ports(by adding deb http://deb.debian.org/debian buster-backports main contrib non-free to my "/etc/apt/sources.list") and upgraded my kernel to 5.10 and did sudo apt update && sudo apt upgrade, nothing happened then too.
After doing all the above, I could neither see WiFi on the bottom right panel nor could I see anything when did nmcli dev wifi.
More information about my OS and device:
neevan@nebian:~$ uname -a
Linux nebian 5.10.0-0.bpo.4-amd64 #1 SMP Debian 5.10.19-1~bpo10+1 (2021-03-13) x86_64 GNU/Linux
neevan@nebian:~$ lspci -k
...
...
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Hewlett-Packard Company RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel driver in use: r8169
Kernel modules: r8169
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723DE 802.11b/g/n PCIe Adapter
Subsystem: Hewlett-Packard Company RTL8723DE 802.11b/g/n PCIe Adapter
Kernel modules: rtw88_8723de
neevan@nebian:~$ sudo ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether ea:7a:10:67:8b:af brd ff:ff:ff:ff:ff:ff
neevan@nebian:~$ nmcli dev
DEVICE TYPE STATE CONNECTION
eno1 ethernet connected Wired connection 1
lo loopback unmanaged --
neevan@nebian:~$ sudo dmesg | grep -i wlan
[ 3.266679] usb 1-4: Product: 802.11n WLAN Adapter
I have Windows 10 on dual boot and has no problems with WiFi there and I had Ubuntu 20.04LTS with GNOME before this Debian 10 installation and I had no WiFi problems then too. How do I install WiFi drivers and claim that device and use WiFi?
|
Install the wifi driver from lwfinger/rtw88 git repository:
sudo apt-get update
sudo apt-get install make gcc linux-headers-$(uname -r) build-essential git
git clone https://github.com/lwfinger/rtw88.git
cd rtw88
make
sudo make install
sudo modprobe -r rtw_8723de
sudo modprobe rtw_8723de
echo "options rtl8723de ant_sel=2" | sudo tee /etc/modprobe.d/rtl8723de.conf
The ant_sel may take 1,2,3 or 4 value.
| drivers issue for Realtek RTL8723DE wlan on debian 10 with kernel 5.10 |
1,406,187,154,000 |
tcpdump -i mlan0 -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol
decode listening on mlan0, link-type EN10MB (Ethernet), capture size
262144 bytes
Why is this Ethernet here? I am using wifi, not an Ethernet.
decode listening on mlan0, link-type EN10MB (Ethernet), capture size
262144 bytes
I'm not sure how I can research this. I can find man pages on tcpdump usage. But nothing to explain this particular line.
|
Why is this Ethernet here? I am using wifi, not an Ethernet.
Because you're not capturing in monitor mode; on most operating systems, the only way to get 802.11 headers, rather than fake Ethernet headers, on a Wi-Fi capture is to capture in monitor mode. This includes Linux, OS X, and Windows (although WinPcap doesn't currently support monitor mode).
If you only want to see traffic to and from your machine, you can capture without monitor mode. You won't see packets other than data packets.
If you want to see other traffic on your network, or want to see non-data packets, or want to see 802.11 headers, or want to see 802.11 headers and radio information (data rate, signal strength, etc.), you need to capture in monitor mode. However, in monitor mode, packets on a protected network (network using WEP or WPA/WPA2) will not be decrypted; Wireshark can decrypt them if you supply the network's password and, if the network uses WPA/WPA2, if you've captured the initial EAPOL handshakes for each device whose traffic you want to decrypt.
| Itcpdump output - why is it showing an Ethernet status? |
1,406,187,154,000 |
I have downloaded g2ipmsg from http://www.ipmsg.org/archive/g2ipmsg-0.9.6.tar.gz
While installing this package, it is causing some error.
checking for G2IPMSG... configure: error: Package requirements (libgnomeui-2.0 >= 2.14
gtk+-2.0 >= 2.4
glib-2.0 >= 2.8) were not met:
No package 'libgnomeui-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables G2IPMSG_CFLAGS
and G2IPMSG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
How to resolve this error please let me know.
|
Ensure that you have the package libgnomeui-2.0 mentionned into the error message correctly installed. Depending of your distribution, use apt-get or yum to install it.
You may also need to install gtk+-2.0 and glib-2.0 (install first package and check the updated error message if any).
| Installation causing error |
1,406,187,154,000 |
I have two network interfaces on a client PC, one wired, one wireless. The
wired is connected directly to a server PC running DHCP, which gives the
client PC a 10.0... address. The client PC also connects to a wireless
router, which gives it a 192.168... address. This was all set up and
detected automatically by NetworkManager. I am able to ping the server PC
and wireless router.
The problem is I want to use the wired connection as a LAN only, and the
wireless for WAN access to the wider Internet. But NetworkManager thinks the
opposite, and tries to use the LAN to go to the outside Internet. If I
unplug the cable it correctly uses wireless. But I'd like to have them both
connected at the same time.
I'm running Debian unstable if that matters.
Is there some way to configure this?
|
Ok, I figured it out by looking at the answer to this question:
NetworkManager changes default routing policy
To summarize:
Open up NetworkManager's graphical connection editor
$ nm-connection-editor
In the GUI:
Click on "Wired connection 1".
Click on the gear button for settings.
Click on the "IPv4 Settings" tab.
Click on the "Routes..." button.
Check the "Use this connection only for resources on its network" box.
| Set up wired ethernet LAN to coexist with wireless WAN using NetworkManager |
1,406,187,154,000 |
Straight forward wifi client to infra AP connectivity from debian by using wpa_supplicant
wpa_cli -iwlan0 add_network
1
wpa_cli -iwlan0 set_network 1 ssid '"myssid"'
OK
wpa_cli -iwlan0 set_network 1 psk '"mypwd"'
OK
wpa_cli -iwlan0 enable_network 1
As result "Association request to the driver failed"
in syslog strange entries
nl80211: MLME connect failed: ret=-1 (Operation not permitted)
wlan0: Association request to the driver failed
SSID and PSK are correct obviously. Tearing my hairs out - what is the problem?
The same problem with any other ssid.
dmesg output
brcmfmac: brcmf_c_set_joinpref_default: Set join_pref error (-1)
brcmfmac: brcmf_cfg80211_connect: BRCMF_C_SET_SSID failed (-1)
Ideas? Direction? Where to look?
UPDATE: the issue was solved
It is related to interesting side effect of driver initialization optimization.
I have one physical wireless adapter with two virtual interfaces: client (managed) and hotspot (access point). The correct order of load is AP and then Managed (this is another issue, not sure where it comes from).
When both interfaces are brought up at the same time or close enough one to another, later interface tries to reuse already loaded instance of device driver, which is obviously impossible (and this is where "Operation not permitted" comes from), so wpa_supplicant is not being initialized properly.
The solution is make AP to be loaded automatically at early stage, while leave Managed to manual mode. Then modify rc.local (or any other late running trigger) to enable Managed interface.
For me (sleep 20 || sudo ifup wlan1) & works perfectly, so problem is solved.
Having said that, i think that it is required to open ticket for Debian to fix this issue, since, it is clearly OS bug.
|
It is related to interesting side effect of driver initialization optimization. I have one physical wireless adapter with two virtual interfaces: client (managed) and hotspot (access point). The correct order of load is AP and then Managed (this is another issue, not sure where it comes from). When both interfaces are brought up at the same time or close enough one to another, later interface tries to reuse already loaded instance of device driver, which is obviously impossible (and this is where "Operation not permitted" comes from), so wpa_supplicant is not being initialized properly.
The solution is make AP to be loaded automatically at early stage, while leave Managed to manual mode. Then modify rc.local (or any other late running trigger) to enable Managed interface. For me (sleep 20 || sudo ifup wlan1) & works perfectly, so problem is solved.
Having said that, i think that it is required to open ticket for Debian to fix this issue, since, it is clearly OS bug.
| Unable to establish connection with MLME connect failed: ret=-1 (Operation not permitted) |
1,406,187,154,000 |
I am using rpi v3 so I have wlan as well. With this network config, when I am connected to wlan, I have internet access:
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
With this one I dont (even though still connected to same wlan):
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.10.10.1
netmask 255.255.255.0
gateway 10.10.10.5
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
What does eth0 have to do with anything here? Why does its configuration affect my lack of connection on wlan? I would appreciate all help really!
|
Remove the gateway entry under eth0. This adds a default route via 10.10.10.5, which is not what you want if internet traffic is supposed to go through wlan0.
| No internet on wlan then eth0 set to static |
1,406,187,154,000 |
I know how to make a wifi hotspot on my linux machine(using Manjaro with i3 DE), also I managed to connect my iPhone to the wifi connection I made, but the goal is to start lampp and make my iPhone and other devices, like another PC, a smart TV have access to my localhost server.
Is it possible to make this even without an Internet connection? Like without my wifi router on, or without any ethernet? I guess you could say that is somehow a fake hotspot without access to the outer world :D
Basically I need something like a wifi lan, so if anybody could suggest some ideas, software or some tutorials/documentation on net, I would be grateful.
|
Thanks for the replies, actually it worked by itself :D
I had to create the hotspot via NetworkManager, and then start lampp, or the other way, the order doesn't matter.
The problem was that I tried to access localhost, instead of the my IP :D
So after I tried to access my IP, it worked as desired. Sorry for wasting your time, I was just a bit confused.
| How can I create a wifi hotspot and share my localhost across |
1,406,187,154,000 |
Im using a 3G USB huawei modem to get access to the internet, therefore, i have an active ppp interface addressed.
I want to share this access with my wlan interface so that every device that will get connected to my wifi hotspot will get access to the internet too.
How can i do that?
Thanks
|
In ubuntu 14 or ubuntu 15, you can use this command :
- first, you activate routing :
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
- second, you write a dynamic translation rule source IP address.
sudo iptables -A POSTROUTING -t nat -s address/mask -o internet_interface -j MASQUERADE
where adress/mask is a address range who don't have the internet access, and then internet_interface is the interface who have the internet access.
Example of this rule :
sudo iptables -A POSTROUTING -t nat -s 192.168.7.0/24 -o ppp0 -j MASQUERADE
| How to share a ppp internet connection over wlan interface on ubuntu? |
1,406,187,154,000 |
My router (Netgear DGN-2200-64) has a USB port usable as SMB storage (with the default firmware - I guess it's Linux under the hood). I plugged in an old flash disk (FAT formatted I think) & set it up without access restrictions (it's only accessible from the local network).
I'd like to set permissions on a folder (eg for backups that won't get delete by mistake). In smbclient:
smb: \> chmod 750 <foldername>
didn't work - I could delete the folder from a different (Windows) computer on the network.
I realised the FAT formatting of the flash disk is probably the problem - but it that the sole problem?
Or would I also need to password protect the SMB share? (Another password for forget, particularly for my parents, so I'm reluctant.)
|
The FAT formatting won't allow you to set any permissions. There is no way to change that since FAT can't store that kind of meta-data.
(Well, actually, from Linux side, you can specify permissions while mounting the FAT device, but the permissions will be the same for all that device and I think you can't change the mount options of your router)
NTFS manages permissions, but it may be tricky to set them on your router.
I'd format your USB flash disk with something like ext3, ext4 or xfs (maybe ext3 has more chance to be "recognized" by your router), and set permissions as you did with chmod.
Whatever the Samba permissions are, they can't override a restriction done with chmod. Say you set your file 750, Samba could deny the read access to the group, but it couldn't allow write access to that group.
However, you'd have to know from which user the samba process of your router is run in order to set the correct user and group to your directory.
(if you can't SSH, just try to create a dummy file on your USB disk from SMB, then see the owner and group IDs).
You'd also have to ensure the samba can manage user sessions (else, each user of your house is actually seen as the same user from samba point of view. In that case, setting permission is quite useless...). Unfortunately, for that point, you'd need to see the samba configuration.
| Setting permissions on SMB |
1,406,187,154,000 |
I removed gnome(running bare openbox)and now lan and wlan both do not work anymore.
I used this to set up my wifi before, but now it does not work anymore and insmod tells that the file already exists, even though I did not insert the module yet:
How to check if USB WiFi-Adapter is not working or router is out of range?
For lan, could be caused by a cable defect, but that is pretty unlikly. Unfortunetely, I cannot test that right now.
Anyone has any idea on how to fix this?
(Sorry for the bad writing, forced to type on a tablet right now which is a pain in the neck.)
|
Check all interfaces by running ifconfig -a and then run ifup command on disabled interfaces, e.g. ifup eth0
| No internet connection after uninstalling gnome [Fedora + Openbox] |
1,406,187,154,000 |
I have a tftp server on lan 192.168.0.0/24
I want a qemu vm reach it, with ethernet is simple
a) First create br0
MAC1="52:54:$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4/')";
nmcli con add ifname br0 type bridge con-name br0 bridge.mac-address $MAC1
b) then add eth0 as slave, then you can add vnet* or tap* interfaces with qemu or libvirt
With wlan is impossible
brctl addif br0 wlan1
can't add wlan1 to bridge br0: Operation not supported
nmcli fail also with timeout
So I have two solutions, create a "virbr" with libvirt and the use iptables rules
for natting it, but the virbr must have a different lan address (192.168.1.0/24 or 10.2.1.0/24 or whatever you want but not an address of ip range used by wlan because exit with errors) or create an empty br0 with network-manager and then assign a ip address to it and with iptables route to wlan0
iptables -A FORWARD -i br0 -o wlan1 -j ACCEPT
iptables -A FORWARD -i wlan1 -o br0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
but when I try to get a dhcp address from 192.168.0.0/24 lan it fail.
Any advice to use 192.168.0.0/24 ip for wlan "bridge"? Thanks
Edit: the iw command to "enable" the wlan0 as slave fail
iw dev wlan1 set 4addr on
command failed: Operation not supported (-95)
|
Waiting for better solution
I consider ok this solution atm: the wifi cannot be "bridged" for a driver issue or limit.
| A solution to bridge wlan0 or permit to use the same lan for tap/br? |
1,406,187,154,000 |
I have computer that only have Wifi network. There is no RJ45 socket. I have to configure Wifi using command line.
My Wifi:
Authentication : WPA2-Personal
Cipher : CCMP
Connection mode : Profile
Channel : 1
On FreePBX I have file: /etc/wpa_supplicant/wpa_supplicant.conf:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="mynetworkname"
psk="mypassword"
}
When I type command:
wpa_supplicant -B -i wlan0 -c wpa_supplicant.conf -D wext
and I get error:
Successfully initialized wpa_supplicant
Failed to open config file '/etc/wpa_supplicant.conf', error: No such file or directory
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before starting wpa_supplicant again.
|
You should give the full path to the configuration file wpa_supplicant.conf
killall wpa_supplicant
wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf
| FreePBX configure wifi from command line WPA2 |
1,406,187,154,000 |
LG G3 Android 5.0 device, rooted with Linux Deploy app, Kali Linux 2.0 installed with all components.
I'm connected to Kali Linux through SSH and trying to monitor wireless traffic.
$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 34:...:b9
inet addr:172.20.10.6 Bcast:172.20.10.15 Mask:255.255.255.240
inet6 addr: f0...b9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:428 errors:0 dropped:1 overruns:0 frame:0
TX packets:477 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:185189 (180.8 KiB) TX bytes:91160 (89.0 KiB)
$ airmon-ng
PHY Interface Driver Chipset
phy0 p2p0 wcnss_wlan Not pci, usb, or sdio
phy0 wlan0 wcnss_wlan Not pci, usb, or sdio
$ airmon-ng start wlan0
Found 2 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
PID Name
1588 wpa_supplicant
8679 dhcpcd
PHY Interface Driver Chipset
phy0 p2p0 wcnss_wlan Not pci, usb, or sdio
phy0 wlan0 wcnss_wlan Not pci, usb, or sdio
Failed to set wlan0mon up using ip
command failed: No such device (-19)
(mac80211 monitor mode vif enabled for [phy0]wlan0 on [phy0]wlan0mon)
(mac80211 station mode vif disabled for [phy0]wlan0)
After this wlan0 is no longer available and it does not appear in ifconfig. There doesn't seem to be any running aircrack-ng process, the only way I managed to bring it back is by restarting the phone.
# after running airmon-ng start wlan0
$ airmon-ng
PHY Interface Driver Chipset
phy0 p2p0 wcnss_wlan Not pci, usb, or sdio
What is the cause for this failure?
|
This may happen if wlan0 WiFi adapter does not support monitor mode.
Specifically, LG G3's internal WiFi device does not support monitor mode.
| wlan0 disappears after running airmon-ng on Android running Kali Linux |
1,406,187,154,000 |
I have a TP-LINK TL-WN823N wireless usb stick (Realtek Module 8192cu) for my desktop. I cannot get the network manager to use it.
Wicd says no wireless networks found and the standard network monitor says wireless is disconnected.. I have executed the instructions at https://wiki.debian.org/rtl819x. At the bottom I have the contents of the /etc/apt/sources.list file and have run apt-get update.(while performing these tests the computer was connected through the ethernet cable)
from looking at iwconfig
lo no wireless extensions.
wlan1 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=off
Retry long limit:7 RTS thr=2347 B Fragment thr:off
Encryption key:off
Power Management:off
eth0 no wireless extensions.
ifconfig wlan1:
wlan1 Link encap:Ethernet HWaddr c4:e9:84:16:63:ed
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ifup wlan1:
Ignoring unknown interface wlan1=wlan1.
output from lsb_release -a for the OS version:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.9 (wheezy)
Release: 7.9
Codename: wheezy
relevant output from lsusb:
Bus 001 Device 004: ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter
The output from apt-cache search Realtek:
flashrom - Identify, read, write, erase, and verify BIOS/ROM/flash chips
nictools-pci - Diagnostic tools for many PCI ethernet cards
firmware-realtek - Binary firmware for Realtek wired and wireless network adapters
From doing, apt-get install firmware-realtek:
Reading package lists... Done
Building dependency tree
Reading state information... Done
firmware-realtek is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
relevant output from dmesg:
[ 19.751049] rtl8192cu: MAC auto ON okay!
[ 19.783738] rtl8192cu: Tx queue select: 0x05
[ 19.784619] rtl8192c_common: Loading firmware file rtlwifi/rtl8192cufw.bin
[ 20.202574] ADDRCONF(NETDEV_UP): wlan1: link is not ready
[ 20.499417] r8169 0000:02:00.0: firmware: agent loaded rtl_nic/rtl8168e-3.fw into memory
trying to bring the wlan0 up, with ifconfig wlan0 up:
wlan0: ERROR while getting interface flags: No such device
but ifconfig wlan1 up works in that no error is presented
From looking at lsmod | grep rtl:
rtl8192cu 74897 0
rtlwifi 81393 1 rtl8192cu
rtl8192c_common 52602 1 rtl8192cu
mac80211 192806 3 rtl8192c_common,rtlwifi,rtl8192cu
cfg80211 137243 2 mac80211,rtlwifi
usbcore 128741 5 ehci_hcd,usbhid,rtlwifi,rtl8192cu
contents of /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
The /etc/apt/sources.list contents
# deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 NETINST Binary-1 20141018-13:04]/ wheezy main
# deb cdrom:[Debian GNU/Linux 7.7.0 _Wheezy_ - Official amd64 NETINST Binary-1 20141018-13:04]/ wheezy main
deb http://ftp.uk.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates, previously known as 'volatile'
deb http://ftp.uk.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ wheezy-updates main contrib non-free
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
# Debian 7 "Wheezy"
deb http://http.debian.net/debian/ wheezy main contrib non-free
|
Edit the configuration file in wicd to direct it to wlan1, since it is being registered but not seen.
sudo nano /etc/wicd/manager-settings.conf
and set instead of wlan0 or none
wireless_interface = wlan1
| Cannot get TP_LINK / TL-WN823N / Realtek 8192cu usb wireless adapter to be utilized on Debian Wheezy |
1,406,187,154,000 |
I have 150 mining servers. They all have own ssd drives, and EthOS distribution based on Ununtu. Now I want to crate centralized server without ssd. All machines will connect by wlan and take the image of OS from central server. I have read about LTSP open source project that gives you posibility to make this. But this package are for ubuntu, but OS on servers must be other. How can I make them to boot OS that are not installed on my central server?
|
LTSP is probably not the best option here. DRBL might be a reasonable option, but I don't know how well it works (if at all) with ethOS. I would suggest asking on the ethOS IRC channel about netbooting diskless systems. I would be kind of surprised if it's not reasonably possible (though some distros, notably Alpine, have no way to do it natively), but from a cursory look at their site, it probably is not easy (otherwise they would have info on how to do it there).
It's also worth noting that if you want the root filesystem to be served over the network (which is the only practical option for what you want to do), you should not be using WiFi. All the protocols Linux supports for this have issues with packet loss, and even if that isn't an issue for you (by some miracle), you will get horrible performance accessing the root filesystem (unless you've shelled out multiple hundreds of dollars on a 6 transceiver AP, but even then you'll probably see performance issues just by virtue of how many systems are involved).
| Creating "fat" Termimal multiboot server LTSP |
1,577,802,032,000 |
we want to capture the disk device that belong to the OS ( Linux )
since each linux machine have list of disks that are not the OS , we want to capture the disk that belong to the OS
so by fdisk we can see that boot is on sda1
# sfdisk -l | grep Linux
/dev/sda1 * 0+ 63- 64- 512000 83 Linux
/dev/sda2 63+ 19581- 19518- 156773376 8e Linux LVM
so according to that I created the following command , in order to capture the disk that belong to the OS ( linux )
# OS_DISK=` sfdisk -l | grep Linux | awk '$2 == "*" {print $1}' | sed s'/\// /g' | awk '{print $2}' | sed 's/[0-9]*//g' `
# echo $OS_DISK
sda
seems the command do the Job
but Ifeel that this cli is too long and little clumsy
|
I find the simplest command to identify the operating system disk
to be df /.
Unfortunately, it produces a lot of output
(by which I mean a header line and many fields),
so you would still need to do some filtering
to get just the device name.
You're right; your command is overly long and somewhat clumsy.
awk is a very powerful program; you rarely need
to combine it with grep and/or sed,
and having multiple awk commands in the same pipeline
is almost never necessary.
Your pipeline can be replaced withsfdisk -l | awk '/Linux/ && $2 == "*" { gsub("[0-9]", "", $1); split($1, a, "/"); print a[3]; }'
OK, it's only about a dozen characters shorter,
but it's one command instead of five.
P.S. sed 's/[0-9]*//g' is a slightly dangerous command.
Because of the g,
it doesn't really make sense to have the * also.
To see what I mean, try sed 's/[0-9]*/X/g' with various inputs,
and compare to s/[0-9]/X/g and s/[0-9]\+/X/g.
OS_DISK=` command ` can be changed
to OS_DISK=$(command),
and the second form (with the parentheses) is preferred.
| Linux + how to capture the OS disk device [closed] |
1,577,802,032,000 |
lsblk -d -o NAME,SIZE,TYPE | grep disk
show me the such things
sda 894.3G disk
sdb 894.3G disk
sdc 3.7T disk
sdd 3.7T disk
nbd0 64G disk
Are the sda and sdc have sdb and sdd similarly physical devices?
Either they're "physical" and "logical" devices?
It's not my own server, so I cannot see its specifications. The server was deployed without my participation.
|
Yes, those are 5 separate disks. You have 4 disks connected via the SCSI interface (sda, sdb, sdc and sdd). You also have one network block device, a physical disk on a remote machine that has been made available to your machine over NBD.
This is quite a normal setup (apart from the NBD which isn't very common these days). You very often have similar disks on a server since the server's administrator would have bought a few together and since having disks of the same size makes setting up RAID systems is much simpler. It isn't strange or surprising.
You can investigate further using parted -l which will will show the model and make of the disks. Or you can use more general commands for hardware information like lshw or hwinfo.
| Why the output of lsblk have almost the same lines? |
1,577,802,032,000 |
sudo lsblk --fs -o NAME,FSTYPE,SIZE,FSSIZE,FSUSED,FSAVAIL,FSUSE%,MOUNTPOINTS,LABEL,PATH | grep -v '^loop'
NAME FSTYPE SIZE FSSIZE FSUSED FSAVAIL FSUSE% MOUNTPOINTS LABEL PATH
zram0 8G [SWAP] /dev/zram0
nvme0n1 1.8T /dev/nvme0n1
├─nvme0n1p1 ext4 768M /dev/nvme0n1p1
├─nvme0n1p2 ext4 768M 738.4M 240.9M 443.8M 33% /boot FedoraBoot /dev/nvme0n1p2
├─nvme0n1p3 ext4 768M UnassignedBoot /dev/nvme0n1p3
├─nvme0n1p4 vfat 128M 127.7M 22.4M 105.3M 18% /boot/efi EFI-SP /dev/nvme0n1p4
└─nvme0n1p5 LVM2_member 1.8T /dev/nvme0n1p5
├─vgubuntu-FedoraRoot ext4 100G 98.1G 47.9G 45.2G 49% / FedoraRoot /dev/mapper/vgubuntu-FedoraRoot
├─vgubuntu-FedoraSwap swap 32G [SWAP] /dev/mapper/vgubuntu-FedoraSwap
├─vgubuntu-UbuntuSwap swap 32G /dev/mapper/vgubuntu-UbuntuSwap
├─vgubuntu-UbuntuRoot ext4 50G /dev/mapper/vgubuntu-UbuntuRoot
├─vgubuntu-UbuntuHome ext4 18G /dev/mapper/vgubuntu-UbuntuHome
├─vgubuntu-FedoraHome ext4 18G 17.5G 6.5G 10.1G 37% /home FedoraHome /dev/mapper/vgubuntu-FedoraHome
├─vgubuntu-Data ext4 100G 98.1G 82G 11.6G 84% /mnt/Data Data /dev/mapper/vgubuntu-Data
├─vgubuntu-Documents ext4 250G 245G 208.5G 24G 85% /mnt/Documents Documents /dev/mapper/vgubuntu-Documents
├─vgubuntu-Media ext4 500G 491.1G 331.2G 134.8G 67% /mnt/Media Media /dev/mapper/vgubuntu-Media
└─vgubuntu-Backup ext4 100G 97.9G 9.1G 83.7G 9% /mnt/Backup Backup /dev/mapper/vgubuntu-Backup
|
ext4 by default reserves 5% of the filesystem for root-only use. This reserved space isn't counted in FSUSED.
For example, if we create a 10G filesystem:
truncate -s10g disk.img
loopdev=$(losetup -fP --show disk.img)
mkfs.ext4 $loopdev
mount $loopdev /mnt
...and then run your lsblk command:
lsblk --fs -o NAME,FSTYPE,SIZE,FSSIZE,FSUSED,FSAVAIL,FSUSE%,MOUNTPOINTS,LABEL,PATH | grep loop
We see:
NAME FSTYPE SIZE FSSIZE FSUSED FSAVAIL FSUSE% MOUNTPOINTS LABEL PATH
loop0 ext4 10G 9.7G 24K 9.2G 0% /mnt /dev/loop0
Here we see that FSUSED (0) + FSAVAIL (9.2G) is exactly 5% less than FSSIZE (9.7G):
>>> 9.7 - (9.7 * 0.05)
9.215
You can see these reserved blocks by running dumpe2fs:
# dumpe2fs /dev/loop0 | grep -i 'block count'
dumpe2fs 1.46.5 (30-Dec-2021)
Block count: 2621440
Reserved block count: 131072
We can modify the amount of reserved space with the -m argument to mkfs.ext4. If instead we had run:
mkfs.ext4 -m0 $loopdev
We would see:
NAME FSTYPE SIZE FSSIZE FSUSED FSAVAIL FSUSE% MOUNTPOINTS LABEL PATH
loop0 ext4 10G 9.7G 24K 9.7G 0% /mnt /dev/loop0
We can change the amount of reserved space on an existing filesystem using the tune2fs command.
| lsblk: Why FSSIZE is not equal to FSAVAIL + FSUSED |
1,577,802,032,000 |
I intend to get a list of all partitions with their corresponding types but arranged in the proper tree order.
This is what I get with lsblk -o NAME,TYPE -i
sda disk
|-sda1 part
|-sda2 part
|-sda3 part
| |-2cl-root lvm
| |-2cl-swap lvm
| |-2cl-home lvm
| |-2cl-data2 lvm
| `-2cl-data4 lvm
|-sda4 part
| |-1cl00-data3 lvm
| |-asf1 lvm
| `-asf2 lvm
`-sda5 part
sdb disk
`-sdb1 part
`-md126 raid1
sdc disk
`-sdc1 part
`-md126 raid1
sdd disk
`-sdd1 part
`-md127 raid0
`-3-data6 lvm
sde disk
`-sde1 part
`-md127 raid0
`-3-data6 lvm
sr0 rom
But I want it to display this way
sda disk
sda1 part
sda2 part
sda3 part
2cl-root lvm
2cl-swap lvm
2cl-home lvm
2cl-data2 lvm
2cl-data4 lvm
sda4 part
1cl00-data3 lvm
asf1 lvm
asf2 lvm
sda5 part
sdb disk
sdb1 part
md126 raid1
sdc disk
sdc1 part
md126 raid1
sdd disk
sdd1 part
md127 raid0
3-data6 lvm
sde disk
sde1 part
md127 raid0
3-data6 lvm
sr0 rom
I tried with -s -l option, but the results became much weirder. How do I format it properly, but still get the correct order as the tree? I would not mind if there is only 1 space between name and type.
|
This should do it:
lsblk -o NAME,TYPE -n -i -r
If you cannot ask lsblk to format the output as you want, you can pipe it and change it.
For example, if the tab is really important:
lsblk -o NAME,TYPE -n -i -r | tr ' ' '\t'
| How to output only dev names and types in lsblk? |
1,577,802,032,000 |
the linux ( OS ) installed on sda
and machine also have additional disk - sdb
sdb 8:16 0 20G 0 disk
but we want to add two new partitions as sdb1 and sdb2
as the following:
sdb 8:16 0 20G 0 disk
├─sdb1 8:1 0 500M 0 part
└─sdb2 8:2 0 500M 0 part
how to create the disk to be parted with partitions - sdb1 and sdb2?
|
Assuming GNU parted, and assuming the snippets you are showing are from the output of lsblk, here is a minimal set of actions you can perform to accomplish what you are asking for:
Running parted as root, select the device you want to act upon:
(parted) select /dev/sdb
Create a MBR partition table (no particular reason for choosing this type; in parted, type help mklabel for a list of available types):
(parted) mklabel msdos
Then, create the partitions:
(parted) unit MiB
(parted) mkpart primary 1 501
(parted) mkpart primary 501 1000
parted is instructed here to use the mebibyte as unit because that is the default for lsblk. This way you can outright type the same numbers posted in your question.
The starting point of the first partition is arbitrarily at 1 MiB because 1) it cannot be at 0 and 2) 1 MiB is a relatively lazy but safe choice for alignment. A discussion on partition alignment seems out of scope here.
You can then check your changes with:
(parted) print
| how to create parted disk |
1,577,802,032,000 |
so I can see in lsblk that I have a 250G disk, but when I run pvresize /dev/sda3 I am not able to see the free space to extend the volume group.
Do I need to modify the partition table in single user mode since this is the root filesystem?
On a similar system, I was able to run pvresize, vgextend, lvresize and then resize2fs
|
You'll need to expand the sda3 partition first, as doneal24 said in the comments.
If your distribution has the growpart command (sometimes packaged as its own package, sometimes as cloud-utils or cloud-utils-growpart), it would offer an easy and safe way to extend the sda3 partition: growpart /dev/sda 3.
As the sda3 appears to be the "rightmost" partition on the disk, this command would most likely be able to extend the partition while the system is running, and have it take effect immediately, unless the kernel version is very old (and with very old kernels, it would take a reboot to make the partition table change effective).
If you have to do the partition table modification manually, remember two things:
you can delete and recreate the partition entry, as long as the partition starting point will be exactly on the same block as before
if the partitioning tool asks whether you want to clear any filesystem or LVM signatures from the partition, the answer is no.
If the partitioning change won't take effect immediately, you can try partprobe /dev/sda to make it take effect without rebooting. Eventually the partitioning tools will include all the things partprobe can do to update the kernel's idea of the partition table, but with some (older) versions of CentOS/RHEL, there is a chance partprobe knows some tricks the standard versions of partitioning tools won't have yet.
After that, pvresize /dev/sda3, then you can proceed to lvresize.
You don't need vgextend if you are expanding an existing LVM physical volume (PV): it's for extending an existing LVM volume group (VG) by adding other PVs to it. Since you have a separate /boot partition, there should be no problems in letting the LV containing the root filesystem extend to multiple PVs on different physical disks, if necessary.
| Extending rootfs on centos |
1,577,802,032,000 |
I have a SD card that is giving me some trouble.
I followed some instructions from here https://forums.linuxmint.com/viewtopic.php?t=368230 and used the command
sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1
(I know this is dangerous. i've done it because the card was really cheap, and I suspect it is bogus). it ran without errors, but now my system doesnt recognize the card anymore. Gparted and lsblk can't find it (they don't return any sdb). running 'sudo dmesg -w' gives me this:
[ 6333.845914] sd 2:0:0:0: [sdb] 1048780800 512-byte logical blocks: (537 GB/500 GiB)
[ 6333.846242] sd 2:0:0:0: [sdb] Write Protect is off
[ 6333.846249] sd 2:0:0:0: [sdb] Mode Sense: 2f 00 00 00
[ 6333.846572] sd 2:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 6333.851162] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 6334.376852] exFAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 6334.916786] exFAT-fs (sdb): error, invalid access to FAT (entry 0x00000007) bogus content (0x3eac7bca)
[ 6334.916798] exFAT-fs (sdb): Filesystem has been set read-only
[ 6334.916802] exFAT-fs (sdb): failed to initialize root inode
[ 6342.202999] exFAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 6342.767908] exFAT-fs (sdb): error, invalid access to FAT (entry 0x00000007) bogus content (0x3eac7bca)
[ 6342.767925] exFAT-fs (sdb): Filesystem has been set read-only
[ 6342.767930] exFAT-fs (sdb): failed to initialize root inode
[ 6365.545658] sdb: detected capacity change from 1048780800 to 0
So i'd like to know if it still can be saved. to be honest, being unable to fix it bugs me more than losing the card itself. i'm sure some of you share this feeling sometimes :)
I'm in Debian Testing/Bookworm
thanks in advance!
EDIT: as suggested by zomega, I tried modprobe usbmon + wireshark. i just don't understand much of it
Frame 22971: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface usbmon0, id 0
Section number: 1
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Jan 24, 2023 08:28:54.570098000 -03
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1674559734.570098000 seconds
[Time delta from previous captured frame: 0.099905000 seconds]
[Time delta from previous displayed frame: 0.099905000 seconds]
[Time since reference or first frame: 233.430201000 seconds]
Frame Number: 22971
Frame Length: 71 bytes (568 bits)
Capture Length: 71 bytes (568 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: 1.2.1]
[Destination: host]
URB id: 0xffff9197d7386480
URB type: URB_COMPLETE ('C')
URB transfer type: URB_INTERRUPT (0x01)
Endpoint: 0x81, Direction: IN
1... .... = Direction: IN (1)
.... 0001 = Endpoint number: 1
Device: 2
URB bus id: 1
Device setup request: not relevant ('-')
Data: present ('\0')
URB sec: 1674559734
URB usec: 570098
URB status: Success (0)
URB length [bytes]: 7
Data length [bytes]: 7
[Request in: 22970]
[Time from request: 0.099905000 seconds]
[bInterfaceClass: Unknown (0xffff)]
Unused Setup Header
Interval: 1
Start frame: 0
Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .1.. = No transfer DMA map: True
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..1. .... .... = Dir IN: True
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
Leftover Capture Data: 0200ff0f000000
|
When a card suddenly changes to 0 capacity, that's not under the control of your PC: that's the controller within the SD card stopping to work.
Since you have no way of debugging the software running on that controller, nor any way to look inside its hardware:
Your card is e-waste. That was essentially clear when you said "I suspect it is bogus", as a data storage medium which you can't trust is worse than none.
| unable to find or mount sd card |
1,577,802,032,000 |
I recently tried to power up my laptop and received a "Reboot and Select Proper Boot Device" error. This seems to indicate that the firmware is not able to find the boot partition. So, I opened up the laptop and pulled out the NVME SSD, which I then plugged into another computer with a USB NVME adapter.
lsblk finds the device and partitions ok:
sdd 8:48 0 953.9G 0 disk
├─sdd1 8:49 0 550M 0 part
└─sdd2 8:50 0 953.3G 0 part
But fdisk fails:
sudo fdisk -l /dev/sdd
fdisk: cannot open /dev/sdd: No such device or address
smartctl also gives a No such device or address error.
Here's the relevant output from dmesg:
[77502.928766] sd 6:0:0:0: [sdd] 2000409264 512-byte logical blocks: (1.02 TB/954 GiB)
[77502.928768] sd 6:0:0:0: [sdd] 4096-byte physical blocks
[77502.928845] sd 6:0:0:0: [sdd] Write Protect is off
[77502.928846] sd 6:0:0:0: [sdd] Mode Sense: 5f 00 00 08
[77502.929002] sd 6:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[77502.929200] sd 6:0:0:0: [sdd] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[77502.937163] sdd: sdd1 sdd2
[77502.938203] sd 6:0:0:0: [sdd] Attached SCSI disk
[77646.973768] sd 6:0:0:0: [sdd] tag#28 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[77646.973770] sd 6:0:0:0: [sdd] tag#28 CDB: Read(10) 28 00 00 11 37 80 00 00 08 00
[77646.979769] scsi host6: uas_eh_device_reset_handler start
[77647.093855] usb 2-2: reset SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
[77647.106476] scsi host6: uas_eh_device_reset_handler success
[77657.202706] sd 6:0:0:0: [sdd] tag#28 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD
[77657.202708] sd 6:0:0:0: [sdd] tag#28 CDB: Test Unit Ready 00 00 00 00 00 00
[77657.202710] scsi host6: uas_eh_device_reset_handler start
[77657.316787] usb 2-2: reset SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
[77657.329369] scsi host6: uas_eh_device_reset_handler success
[77657.329371] sd 6:0:0:0: Device offlined - not ready after error recovery
[77657.329375] sd 6:0:0:0: [sdd] tag#28 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_TIMEOUT cmd_age=40s
[77657.329376] sd 6:0:0:0: [sdd] tag#28 CDB: Read(10) 28 00 00 11 37 80 00 00 08 00
[77657.329378] blk_update_request: I/O error, dev sdd, sector 1128320 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[77657.329400] sd 6:0:0:0: rejecting I/O to offline device
[77657.329403] blk_update_request: I/O error, dev sdd, sector 1128320 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[77657.329404] Buffer I/O error on dev sdd1, logical block 140784, async page read
Does this mean that the drive is broken? Are there any other possibilities (besides connectors/cables, which I think we can rule out because I get the same error on my laptop and from another computer where the only consistency is the NVME device itself)?
I'm making sure this really is a device failure before ordering another because I'm a bit surprised by this. The SSD is (supposedly) of high-quality (it's a Samsung 970 Pro) and less than 2 years old.
|
lsblk shows the information the kernel receives on boot, fdisk -l tries to read the partition table directly off the device and since the device is seemingly dead (considering the errors in dmesg) fdisk fails.
smartctl -a /dev/sdd could confirm "the patient is dead" status but the fact that basic reads off the device fail, smartctl is not really necessary but you could try running it and updating your question with its output.
I see some USB related errors as well, so you could try changing your cable/USB port but it's unlikely to help.
| lsblk shows disk partitions but fdisk fails |
1,577,802,032,000 |
I don't know what my colleague exactly did but I know that he was trying to increase the size of LVM. For now I can see such an output after executing the command lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 39G 0 part
│ ├─rhel-root 253:0 0 95G 0 lvm /
│ └─rhel-swap 253:1 0 4G 0 lvm [SWAP]
└─sda3 8:3 0 60G 0 part
└─rhel-root 253:0 0 95G 0 lvm /
As you see, there are two same names rhel-root under sda2 and sda3, and both of them are mounted on thr root directory /.
However, the output of df -h is:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.6M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 35G 28G 7.3G 80% /
/dev/sda1 1014M 285M 730M 29% /boot
tmpfs 783M 8.0K 783M 1% /run/user/42
tmpfs 783M 0 783M 0% /run/user/1001
It seems that the size of / is still 35G, meaning that it is not expanded.
It seems that I need to merge sda3 and sda2 but I don't know how to fix this issue.
Output of lvs:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- 94.99g
swap rhel -wi-ao---- 4.00g
Output of vgs:
VG #PV #LV #SN Attr VSize VFree
rhel 2 2 0 wz--n- 98.99g 0
Output of pvs:
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <39.00g 0
/dev/sda3 rhel lvm2 a-- <60.00g 0
Output of vgdisplay:
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 98.99 GiB
PE Size 4.00 MiB
Total PE 25342
Alloc PE / Size 25342 / 98.99 GiB
Free PE / Size 0 / 0
VG UUID tPY1JO-AwK2-ULra-Matz-5VVy-lxWK-CL60ng
|
Your colleague has successfully extended the rhel-root LV with lvextend, so one part of it is now on sda2 and another on sda3. But the filesystem inside the LV has not been extended yet.
There is just one rhel-root LV, but lsblk shows it here in a way that can be a bit confusing: it shows the total size of the LV apparently in association with each individual part.
The sda2 and sda3 PVs are already merged into the rhel VG, so LVs within that VG can grow beyond the limits of a single PV. Apparently your colleague wanted to avoid the risks associated with editing the partition containing the root filesystem on-the-fly, and just created a new partition using the new space, and added it as a new PV to the existing VG. In my opinion, this is the safest way to extend a VG on a bootable disk: although it leaves you with multiple partitions-as-PVs which may offend your sense of neatness, it really has no other significant effect.
At this point, if you really want, you can still remove sda3 and extend sda2 instead. The procedure is as follows:
First, very carefully use lvreduce to shrink the root LV back to what it used to be. You can use the LVM backup files at /etc/lvm/archive to find out the exact size, or you could use lvdisplay -m /dev/mapper/rhel-root to see how many extents are located on the sda2 PV, and use that value. If you choose to do this, you must be very careful not to shrink the LV any smaller than the current size of the filesystem inside it: you don't want to cut off the tail end of the filesystem, not even a tiny bit.
Then remove the now-empty sda3 PV from the rhel VG with vgreduce rhel /dev/sda3, then edit the partition table to delete sda3 and extend sda2, use partprobe /dev/sda to make the system accept the new partition table while the disk is in use (or reboot if partprobe is not available or fails to do the job), then pvresize /dev/sda2 to extend the rhel VG by extending the sda2 PV to take up the new space. Use lvextend -l +100%FREE /dev/mapper/rhel-root to re-extend the root LV.
Now you are at the same point your colleague got to, but without the aesthetically-displeasing sda3.
The last step your colleague missed is actually extending the filesystem to take advantage of the increased capacity of the LV. By the presence of /run in df -h output, and the VG name rhel, I assume this system is RHEL 7 or newer. So the default filesystem type is XFS, which means the command to extend the filesystem will be:
fsadm resize /dev/mapper/rhel-root
or
xfs_growfs /
Note: think carefully before doing this, as there is currently no production-quality tool to shrink a XFS filesystem, neither on-line or offline. So once you extend the filesystem, you won't be able to shrink it back to a smaller size.
This command will be the same, no matter whether you chose to remove sda3 and extend sda2 instead, or keep your colleague's work as-is.
| How to merge lvm |
1,577,802,032,000 |
when I want to get the size of sdb size on remote machine - master
I get that:
# ssh master "lsblk | grep \"^sdb\" | awk '{print \$4}' "
100G
but
when we want to set the size value in variable and then to print it
then we get that:
# VAR=` ssh master "lsblk | grep \"^sdb\" | awk '{print \$4}' " `
# echo $VAR
sdb 8:16 0 100G 0 disk
why the last test not give only the 100G size ?
what is the diff here
|
Don't run stuff remotely that you could run locally.
var=$( ssh master lsblk | awk '/^sdb/ { print $4 }' )
For when the value sdb is in a variable (from comments below):
var=$( ssh master lsblk | awk -v disk="$variable" '$0 ~ disk { print $4 }' )
or, to force a match at the start of the line,
var=$( ssh master lsblk | awk -v disk="$variable" '$0 ~ "^" disk { print $4 }' )
| why we get values in variable that are different |
1,577,802,032,000 |
I am trying to crate a folder with the label and uuid of a media device plugged in as its name, on another flash drive which I am using to log.
I have the following code:
LOGDEVICELABEL=FLASHDRIVENAME
MD=`lsblk -I 8 -o label,uuid -n|sed -e '/^$/ d' -e '/^$LOGDEVICELABEL.*$/ d'`
MDLOGDIR=/media/$LOGDEVICELABEL/Log/$MD
mkdir $MDLOGDIR
The problem is that the value pf the variable $MD has a space in the beginning which I cannot get rid of. That space causes mkdir to treat /media/$LOGDEVICELABEL/Log/ and $MDas two separate arguements.
I tried:
MDLOGDIR=`sed 's/ // g' <<</media/$LOGDEVICELABEL/Log/$MD`
Which only removes the space between the UUID and the Label (which is also necessary) but does not remove the space between /media/$LOGDEVICELABEL/Log/ and $MD.
|
One thing I'll do is use echo to strip unwanted whitespace. In this context, it's important to omit any quotes:
LOGDEVICELABEL=FLASHDRIVENAME
MD=$(lsblk -I 8 -o label,uuid -n|sed -e '/^$/ d' -e '/^$LOGDEVICELABEL.*$/ d')
MD=$(echo $MD) # <-- This line
MDLOGDIR=/media/$LOGDEVICELABEL/Log/$MD
mkdir $MDLOGDIR
The shell invokes the echo command and supplies it with a series of tokens, and the echo command prints those tokens separated by a space character. This has the effect of (1) skipping leading and trailing whitespace and (2) converting one or more whitespace characters between tokens to a single space.
My use of $(...) instead of the back-tick version in this context is equivalent to the back-tick version. Generally I find this version easier to read. It also has the nice benefit that it can be nested ($(...$(...))) where the back-tick version cannot.
| Can't remove space from beginning of variable |
1,577,802,032,000 |
The following code was tested on RedHat 7 using df verison 8.2 and lsblk version 2.23.2. This is important as the lsblk utility has signficantly more output options than the RedHat 6 version (2.17.2)
It is rather easy to determine the filesystem that contains a file:
df -h /path/to/file | tail -n 1 | awk '{print $1}'
However it is surprisingly difficult to determine what block device contains that filesystem. Sure, you can manually determine the block device with lsblk -f, but I'm wondering how you do this in an automated way.
I have done some pretty deep digging, but I havent been able to find any way to do this. Which is strange because it seems like there is a common use case (scanning a directory on a drive, and returning the serial number of the physical disk that you scanned!)
I created a recursive bash function that does some ugly text parsing, which works, it just seems pretty hackish. Although the lsblk documentation does seem to suggest that if you use the --output switch, then you will have reliable scripts across version updates
function findBlockDevice {
fileSystem="${1}"
count="${2}"
potentialBlockDeviceOutput=$(lsblk --paths --output name,type | grep "${fileSystem}" -B${count} | head -n 1)
blockDevice=$(echo ${potentialBlockDeviceOutput} | awk '{print $1}')
blockType=$(echo ${potentialBlockDeviceOutput} | awk '{print $2}')
if [[ "${blockType}" != "disk" ]]; then
count=$(( count + 1 ))
findBlockDevice "${fileSystem}" "${count}"
else
echo "${blockDevice}"
fi
}
Usage:
# Assume directory is on /dev/sda1
scanDirectory='/media/suspiciousDrive'
fileSystem=$(df -h ${scanDirectory} | tail -n 1 | awk '{print $1}')
blockDevice=$(findBlockDevice ${fileSystem} 0)
echo "${fileSystem}" # /dev/sda1
echo "${blockDevice}" # /dev/sda
# Now we can get the disk information to use in a report
lsblk --nodeps --paths --pairs --output NAME,SERIAL,MOUNTPOINT,VENDOR,\
FSTYPE,UUID,MODEL,SIZE,TYPE,WWN,STATE ${fileSystem}
EDIT:
The output of df is not sufficient, because the results returned from the lsblk utility are different when given a filesystem, versus a disk. The following command returns much different information when given the entire block device, opposed to just the filesystem
# Run this on your machine and notice the significant difference
lsblk --nodeps --paths --pairs --output NAME,SERIAL,VENDOR,MODEL /dev/sda
lsblk --nodeps --paths --pairs --output NAME,SERIAL,VENDOR,MODEL /dev/sda1
Ultimately I wanted a simple solution to solve the problem with the nature of
"Scan this hard drive and also automatically return the drive information of the physical device, regardless of what directory you are scanning on the drive"
I have a solution, its just pretty complex, and was wondering if there was something easier.
Another Edit:
Im surprised so many people think this is a duplicate, or are confused as to why the output of df is not sufficient. df returns the filesystem, NOT the block device. Querying information on the filesystem does NOT return any metadata about the block device such as its serial number or model.
Why would i programatically want to know the serial number or hard drive model of hard disks? I hope that wouldn't be a serious follow up question from anyone.
|
Looking at the code you've provided, it seems that you want to be able to map a file on a filesystem back to a physical disk on which it resides. There appears to be no consideration of RAID, LVM, or encrypted filesystems.
The following code will print the disk device(s) that contain the specified file. For RAID and LVM it's possible the file will be present on more than one device; in this situation all relevant disk device names will be printed, one per line.
read -p 'Filename: ' file
devpart=$(mount | awk -v mount=$(stat --format '%m' "$file") '$3 == mount {print $1}')
lsblk --list | awk -v part="${devpart/#*\/}" '$6 == "disk" {disk = $1} $6 != "disk" && $1 == part {print disk}'
| Programmatically identify block device of filesystem [closed] |
1,577,802,032,000 |
we have a lot of linux working machines
all mount point are configured in the /etc/fstab
as the following:
/dev/sdc /grd/sdc ext4 defaults,noatime 0 0
/dev/sdd /grd/sdd ext4 defaults,noatime 0 0
/dev/sdb /grd/sdb ext4 defaults,noatime 0 0
/dev/sde /grd/sde ext4 defaults,noatime 0 0
/dev/sdf /grd/sdf ext4 defaults,noatime 0 0
I want to change the /etc/fstab configuration to use the UUID instead the current conf
can we reconfigure the fstab to use UUID , after machines are working for along time is OK ?
or maybe too late? , or risky ?
example:
UUID="14314872-abd5-24e7-a850-db36fab2c6a1" /grd/sdc ext4 defaults,noatime 0 0
|
There shouldn't be any issues. If you do changes to your machine configuration (for example add or replace disks) the device names (/dev/sdX) might change at next boot. Using UUIDs avoids this issue.
Since you use device names to name the mount points (/grd/sdX), those might not match the device name anymore should the device names change for any reason.
| reconfigure the fstab file with UUID |
1,530,474,646,000 |
I'm launching a VM using qemu-system-x86_64. I know two ways to pass through a USB device.
Say for example, I had a mouse that showed up in lsusb like
Bus 003 Device 011: ID 6ade:9582 Amazing Mouse Maker
I could pass it through using
-device usb-host,vendorid=0x6ade,productid=0x9582
or
-device usb-host,hostbus=3,hostaddr=11
Neither of these I really like. If I grab it by Vendor/Product ID then I will never be able to reclaim that mouse until the VM is turned off.
If I grab it by BUS and Device number, then I will have to tell Qemu to reacquire it if I unplug it.
Is it possible for me to send it by Port (the actual physical slot)? Say it's plugged in to Bus 3 Port 2. Can I pass it by that?
|
For some reason this is not documented on the Qemu 2.12.50 User Doc and I had to learn what I learned from this guy
They mention:
-device usb-host,hostbus=bus,hostaddr=addr
Pass through the host device identified by bus and addr
-device usb-host,vendorid=vendor,productid=product
Pass through the host device identified by vendor and product ID
But they don't mention that you can also do:
-device usb-host,hostbus=bus,hostport=port
For example...
Running lsusb -t, I get:
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
|__ Port 10: Dev 8, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 11: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M
I could decide to pass these with:
-device usb-host,hostbus=3,hostport=10 \
-device usb-host,hostbus=3,hostport=11 \
And those correspond to the physical slots.
However the bus and port will differ for a USB 3.0 slot depending on if a USB 2.0 device or USB 3.0 device is plugged into it, but the port for each device will remain consistent.
Such variance does not exist for USB 2.0 slots.
With USB hubs, use dots to separate the ports. So if you had ...
/: Bus 03
|__ Port 2: some stuff
|__ Port 1: some stuff
You would use -device usb-host,hostbus=3,hostport=2.1
| Can I pass through a USB Port via qemu Command Line? |
1,530,474,646,000 |
I was wondering why some of my USB devices where not recognized by lsusb and stumbled upon /usr/share/hwdata/usb.ids.
When I read the contents of the file I could see that the hardware database was dated from mid-2015 (roughly two years before the distribution, Debian 9 "Stretch", was released in June 2017).
I ran the following to update the database:
update-usbids
And was surprised to find that it was dated from last March.
How comes that it is not updated automatically?
|
Running update-usbids by default isn’t an option because users don’t necessarily want their systems to “phone home” in any way (which update-usbids does, even if the download URL is currently trustworthy), and Debian avoids configuring them to do so.
I imagine the package maintainer didn’t think of uploading a package with an updated list of ids before the Debian 9 freeze in early 2017. The package which was released in Debian 9 was uploaded in 2015, so the age of the database makes sense. You might think that the package could update its own database during the build, which would allow an automated rebuild to update the database for everyone, but package builds aren’t allowed to access remote hosts.
Later releases of usbutils switched to the systemd database. The switch to systemd in general meant reduced support for sysvinit-based systems; supporting those is still a requirement for Debian, so the newer packages were only uploaded to experimental until recently. Debian 10 will feature a newer release, using the systemd database.
If system administrators wants to update the USB identifiers, they can add a monthly cron job...
| Why is the hardware database of usbutils not updated? |
1,530,474,646,000 |
I've recently installed Fedora 25 Server on a relatively old machine (HP Compaq dc7700 Small Form Factor). It previously used to run Windows 10, but all the USB ports suddenly stopped working (I don't recall if it's worked since); I've installed Fedora in the hope of resolving the USB issue.
My understanding is that after I've plugged in a USB device, it should appear when running lsusb. However, I only see the hubs, and not the device (in this case, a keyboard):
[root@fedora zspitz]# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@fedora zspitz]# lsusb -t
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/4p, 480M
lsusb -v shows the following (presumably on stderr), interspersed with the rest of the output:
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
I've tried multiple USB ports, with the same result.
The keyboard works normally on other (Windows) systems.
How can I determine whether this is a hardware issue, or a driver issue -- USB device or system device? What further steps can I take to troubleshoot this?
Full output of libusb -v:
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0002 2.0 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 ehci_hcd
iProduct 2 EHCI Host Controller
iSerial 1 0000:00:1d.7
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0004 1x 4 bytes
bInterval 12
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 6
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 10 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
Port 3: 0000.0100 power
Port 4: 0000.0100 power
Port 5: 0000.0100 power
Port 6: 0000.0100 power
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0001 1.1 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 uhci_hcd
iProduct 2 UHCI Host Controller
iSerial 1 0000:00:1d.2
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 2
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 1 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0001 1.1 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 uhci_hcd
iProduct 2 UHCI Host Controller
iSerial 1 0000:00:1d.1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 2
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 1 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0001 1.1 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 uhci_hcd
iProduct 2 UHCI Host Controller
iSerial 1 0000:00:1d.0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 2
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 1 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0002 2.0 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 ehci_hcd
iProduct 2 EHCI Host Controller
iSerial 1 0000:00:1a.7
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0004 1x 4 bytes
bInterval 12
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 4
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 10 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
Port 3: 0000.0100 power
Port 4: 0000.0100 power
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0001 1.1 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 uhci_hcd
iProduct 2 UHCI Host Controller
iSerial 1 0000:00:1a.1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 2
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 1 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
idProduct 0x0001 1.1 root hub
bcdDevice 4.08
iManufacturer 3 Linux 4.8.6-300.fc25.x86_64 uhci_hcd
iProduct 2 UHCI Host Controller
iSerial 1 0000:00:1a.0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 2
wHubCharacteristic 0x000a
No power switching (usb 1.0)
Per-port overcurrent protection
bPwrOn2PwrGood 1 * 2 milli seconds
bHubContrCurrent 0 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0100 power
Port 2: 0000.0100 power
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
Full output of lspci -nn:
00:00.0 Host bridge [0600]: Intel Corporation 82Q963/Q965 Memory Controller Hub [8086:2990] (rev 02)
00:02.0 VGA compatible controller [0300]: Intel Corporation 82Q963/Q965 Integrated Graphics Controller [8086:2992] (rev 02)
00:03.0 Communication controller [0780]: Intel Corporation 82Q963/Q965 HECI Controller [8086:2994] (rev 02)
00:19.0 Ethernet controller [0200]: Intel Corporation 82566DM Gigabit Network Connection [8086:104a] (rev 02)
00:1a.0 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 [8086:2834] (rev 02)
00:1a.1 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 [8086:2835] (rev 02)
00:1a.7 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 [8086:283a] (rev 02)
00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) HD Audio Controller [8086:284b] (rev 02)
00:1c.0 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 [8086:283f] (rev 02)
00:1d.0 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 [8086:2830] (rev 02)
00:1d.1 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 [8086:2831] (rev 02)
00:1d.2 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 [8086:2832] (rev 02)
00:1d.7 USB controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 [8086:2836] (rev 02)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev f2)
00:1f.0 ISA bridge [0601]: Intel Corporation 82801HO (ICH8DO) LPC Interface Controller [8086:2814] (rev 02)
00:1f.2 IDE interface [0101]: Intel Corporation 82801H (ICH8 Family) 4 port SATA Controller [IDE mode] [8086:2820] (rev 02)
|
It's probably a hardware issue on the machine, especially if this intermittent behavior was seen on it with Windows installed. Here's a few things you could try:
Try some other USB devices, particularly flash drives while doing some file transfers. The keyboard is probably fine, but this would be another confirmation.
When you plug in a usb device, you can do an ls -l /dev/disk/by-* to see what crops up there, since usb devices will be explicitly named/listed there. Regardless of what lsusb states, this should at least show connected devices (and they may disappear when they stop working, too... potentially another clue). Note: lsusb may key off of this information anyways, so you may not see a difference between the two.
Looks like your machine identifies with a mix of 1.0/2.0 hubs. Is this correct as far as you know, per your machine's official specs? You could limit your usage/testing to the 2.0 ports to be more precise.
You could try using an external usb hub and see how that goes. For example, do the intermittent connections occur less often while using an external hub on a 2.0 root hub?
Finally, you could always take a more direct route to a solution and perform the cheap experiment of installing a PCI-USB card (less than $20) to see if the issue goes away completely by using something like this.
| lsusb error -- can't get device qualifier / descriptor: Resource temporarily unavailable |
1,530,474,646,000 |
I have a CH341a Programmer and when I plug it into a usb port everything seems to be working except it doesn't get assigned to a Device Path (eg /dev/ttyUSB0).
Does anyone have any clue as to why this might be happening, or how to resolve this issue?
Here are some of the things I've done to troubleshoot.
lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter
Bus 001 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
dmesg
[347.965641] usb 1-2.1: new full-speed USB device number 4 using uhci_hcd
[348.196659] usb 1-2.1: New USB device found, idVendor=1a86, idProduct=5512
[348.196661] usb 1-2.1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[348.196662] usb 1-2.1: Product: USB UART-LPT
You can see that the device is being recognized as connected, but no device path assignment.
I've connected this thing to 4 different devices and they all behave in the same way with the same output to lsusb and dmesg. This example output is from an Ubuntu VM, but the others were Linux Mint running on a Thinkpad P15s, Zorin running on an old Dell Latitude, and Kali on a Raspi 4.
Oh, I've also tried installing drivers from https://github.com/juliagoda/CH341SER and I've uninstalled the BRLTTY software from all test devices (which actually cleared up the issue for my Arduino Nano, but not this device).
All updates have been installed and every system is UTD as of the time of this posting.
Any and all help is much appreciated.
Thanks.
|
Your device isn't being assigned a serial device path because it's not a serial port. From your lsusb output, we see:
Bus 001 Device 004: ID 1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter
The key part is in EPP/MEM/I2C mode. The device is not configured as a UART; if it were, we would see:
Bus 001 Device 004: ID 1a86:5523 QinHeng Electronics CH341 in serial mode, usb to serial port converter
No amount of driver installation is going to make the device in its current configuration show up as a USB serial port. The issue is entirely in how the device itself is configured.
If you have a bare board, you can configure it yourself. According to the data sheet, the selection between UART and SPI/I2C mode is configured via the SCL and SDA pins (see section 5.3, "Function configuration").
If you have a consumer product that's meant to be a UART-to-USB device, I would return it for a replacement.
| Why isn't my CH341a Device Getting Assigned a Device Path (/dev/ttyUSB0) |
1,530,474,646,000 |
/dev/bus/usb/*/* lists all the usb devices connected on Alpine Linux. For example a phone could be /dev/bus/usb/001/009. When that phone is reconnected it will be /dev/bus/usb/001/010, i.e. it increments.
My question is what happens after 1001 connections?
/dev/bus/usb/001/009
010
...
100
...
500
...
999
???
Would the ??? go to 1000? Would it create a new folder say 003 under /dev/bus/usb/?
This is for manipulating the output of usb-devices and lsusb. Getting the Vendor and ProdID is not unique in my case.
I'd rather not plug in/out a usb cable 1000 times!
|
If I read correctly https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/drivers/usb/core/hub.c#n2030 (code for a function called choose_devnum), it may wrap far earlier than that, at value 127 in fact, and then going back to 1:
/* Try to allocate the next devnum beginning at
* bus->devnum_next. */
devnum = find_next_zero_bit(bus->devmap.devicemap, 128,
bus->devnum_next);
if (devnum >= 128)
devnum = find_next_zero_bit(bus->devmap.devicemap,
128, 1);
bus->devnum_next = (devnum >= 127 ? 1 : devnum + 1);
And later on the bus->devnum property is really set only if devnum is less than 128.
| What Happens to /dev/bus/usb After 1001 Connections |
1,530,474,646,000 |
I have tried to use a hub with hdmi port that connects to the USB-C port of my computer but this one doesn't work.
Checking other similar threads on Internet (and here), I see that the problem is probably that the USB-C port in question does not support video output (the hub itself has USB ports and they work properly).
So is there a way to demonstrate it from my PC to stay calm? Ar can I only check it using the manufacturer's documentation?
For more info:
lsusb -t before hub attachment:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 7: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 2, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 3, Class=Video, Driver=uvcvideo, 480M
|__ Port 10: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 10: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
lsusb -t after hub attachment:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M
|__ Port 3: Dev 8, If 0, Class=Hub, Driver=hub/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 7: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 2, Class=Video, Driver=uvcvideo, 480M
|__ Port 7: Dev 2, If 3, Class=Video, Driver=uvcvideo, 480M
|__ Port 8: Dev 41, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 10: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 10: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
xrander output before and after hub attachment:
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 310mm x 170m
1920x1080 60.01*+ 59.93
1680x1050 59.95 59.88
1400x1050 59.98
1600x900 60.00 59.95 59.82
1280x1024 60.02
1400x900 59.96 59.88
1280x960 60.00
1368x768 60.00 59.88 59.85
1280x800 59.81 59.91
1280x720 59.86 60.00 59.74
1024x768 60.00
1024x576 60.00 59.90 59.82
960x540 60.00 59.63 59.82
800x600 60.32 56.25
864x486 60.00 59.92 59.57
640x480 59.94
720x405 59.51 60.00 58.99
640x360 59.84 59.32 60.00
HDMI1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
And xrandr after HDMI port monitor attachment:
Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 310mm x 170mm
1920x1080 60.01*+ 59.93
1680x1050 59.95 59.88
1400x1050 59.98
1600x900 60.00 59.95 59.82
1280x1024 60.02
1400x900 59.96 59.88
1280x960 60.00
1368x768 60.00 59.88 59.85
1280x800 59.81 59.91
1280x720 59.86 60.00 59.74
1024x768 60.00
1024x576 60.00 59.90 59.82
960x540 60.00 59.63 59.82
800x600 60.32 56.25
864x486 60.00 59.92 59.57
640x480 59.94
720x405 59.51 60.00 58.99
640x360 59.84 59.32 60.00
HDMI1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
1920x1080 60.00*+ 50.00 59.94
1680x1050 59.88
1600x900 60.00
1280x1024 60.02
1440x900 59.90
1280x800 59.91
1280x720 60.00 50.00 59.94
1024x768 60.00
800x600 60.32
720x576 50.00
720x480 60.00 59.94
640x480 60.00 59.94
720x400 70.08
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
|
Finally, my laptop's USB-C doesnt support Video output, and it seems that it cannot be demonstrated by software, just going to the hardware manufacturer.
Therefore I had to install a USB 3.0 to HDMI adapter that supports displaylink drivers and install it to get a second external monitor.
| How can I find out if the USB-C port on my laptop has video output (for adapter USB-C - HDMI)? |
1,530,474,646,000 |
I have a USB device that I wish to reset automatically, there are two USB devices currently, but at times there may be more.
[user1@gs10 devt]$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 1604:10c0 Tascam Dell Integrated Hub
Things to note:
The device number will change periodically (firmware issues (my end))
The ID will be dynamic as different Tascam Hubs are plugged in
The string may also change, whitespaces, dashes.
The device I wish to reset is Device 007. My method to identify the device ID is as follows:
[user1@gs10 devt]$ lsusb | grep "Tascam" | awk '{printf $6 "\n"}'
1d6b:0003
Works OK. Now I want to run the kernerl's usbreset command as a one liner without manually typing in the vendor ID, any reccomendations?
My attempt and goal:
lsusb | grep "Tascam" | awk '{printf "/usr/bin/usbreset %d", $6}'
[user1@gs10 devt]$ sudo /usr/bin/usbreset 1d6b:0003
|
One option could be to use system() directly from within awk:
1. Validate
Validate by requesting device from lsusb:
lsusb | awk '/Tascam.*Hub$/{ system("lsusb -d " $6) }'
That would take vendor:product, (field 6), from whole lines matching:
Tascam<Anything zero or more times>Hub<END-OF-LINE>
and execute: lsusb -d vendor:product
This would execute on all matching Tascam hubs.
2. Real call
Actually call usbreset:
lsusb | sudo awk '/Tascam.*Hub$/{ system("/usr/bin/usbreset " $6) }'
Or perhaps better, exit if error:
lsusb | sudo awk '/Tascam.*Hub/{ if (system("/usr/bin/usbreset " $6)) exit 1 }'
As system(expression) return exit status of the command, and 0 is success, one can use if () to check as if status is <> 0 it would proceed with exit 1. Exit with something else then 0 to signal error.
Optionally use != 0 if you find that easier to read. And perhaps throw in an error.
lsusb | sudo awk '
/Tascam.*Hub/ {
if (system("/usr/bin/usbreset " $6) != 0) {
print "usbreset failed" >"/dev/stderr"
exit 1
}
}'
3. Wrapper + filter on Device
If you want to filter by device-number, it would likely be best to wrap it in a shell-script (which you likely would anyhow), and then do something like:
#! /bin/sh -
# Check argument is given
if [ -z "$1" ]; then
printf 'Missing device number\n' >&2
exit 1
fi
# Check sudo or abort
sudo echo >/dev/null || exit 1
lsusb |
sudo awk -v dev="$1" '
BEGIN {
dev = sprintf("%03d:", dev)
eno = 1
}
$4 == dev && /Tascam.*Hub/ {
if (system("/usr/bin/usbreset " $6) != 0) {
eno = 2
} else {
eno = 0
}
# Exit on first match of device-number + name
exit
}
END {
if (eno == 0)
print "OK"
else if (eno == 1)
print "No device found" >"/dev/stderr"
else if (eno == 2)
print "usbreset failed" >"/dev/stderr"
exit eno
}'
Note on usbreset
Not able to install it locally, but looks like some take argument as:
/dev/bus/usb/<bus>/<device-number>
In that case you might need to use something like:
# Testing:
system(sprintf("ls -l /dev/bus/usb/%03d/%03d", $2, $4))
# Testing:
system(sprintf("/usr/bin/usbreset /dev/bus/usb/%03d/%03d", $2, $4))
4. Note on things in question:
grep when awk is next up is an unnecessary step. awk matches regular expressions – and it in this case it is a simple string (in your code).
awk '/^foo/{ this line starts with foo }' etc.
printf $6 "\n"
Looks like you want to print $6 + line-feed. That would be either of:
print $6
printf "%s\n", $6
It also tells awk to use $6 as format string. This can go bad, and is in general not a good thing to do. If $6 was for example foo%dbar, awk would expect a digit as arameter. etc.
printf "/usr/bin/usbreset %d", $6, say "print digit" and here value is "$6". As field six is hex:hex the printf statement will only print the first digits, if any, else zero.
12a1:06df -> 12
a112:3619 -> 0
| USB reset using lsusb output |
1,530,474,646,000 |
I am building a script that will let the user select a USB disk as a backup target. The idea is to create a partition spanning the entire device. lsusb gives the vendor ID and name, which I intend to present to the user.
I obviously only want to list disks, no other devices. I also need to figure out the /dev device name of the disk that the user selects in order to create a partition on it. I have looked through /dev/disk/ and /sys/ trying to find cross references in the various symlinks there. I also have not been able to utilize lsblk and df to achieve my goal. I would like to know:
How can I use the information that lsusb provides to figure out which USB devices are disks?
How can I use the information that lsusb provides to get the /dev device name of a specific device?
|
The answer to your question depends somewhat on what mechanism will be used to trigger the script.
Assuming that the script is called from some kind of backup program which is not immediately called when the USB device is attached (as would be the case if you trigger it from a udev rule, for example), then you can use udevadm info to gather all information needed.
The idea would be as follows:
any USB drive attached is automatically assigned a device node /dev/sdX by the kernel
if you loop over all device nodes /dev/sd[a-z] (or rather, whichever are actually present under /dev/) and call udevadm info --query=all /dev/sdX on each, you are able to determine which of these is a USB drive, because the output will have one line stating
E: ID_BUS=usb
similarly, you will find output lines containing vendor and model, as in
E: ID_MODEL=Flash_Disk
< ... >
E: ID_VENDOR=Generic
Therefore, by parsing the output of udevadm using grep or similar, you will be able to gather all necessary information for you purposes.
| How can I derive block device information using the output of lsusb |
1,530,474,646,000 |
I'm looking at one of those detachable hybrid laptops, which has extra hard drive in the keyboard base; this laptop runs Ubuntu. Sometimes these drives mount at startup, sometimes not - and in inspecting, I just noticed something that I don't understand.
So when this drive is mounted and working properly, here is the relevant output of lshw:
$ sudo lshw -businfo | grep 'disk\|volume'
scsi@4:0.0.0 /dev/sdb disk 500GB HTS545050A7E380
scsi@4:0.0.0,1 /dev/sdb1 volume 222GiB EXT4 volume
scsi@4:0.0.0,2 /dev/sdb2 volume 222GiB EXT4 volume
scsi@4:0.0.0,3 /dev/sdb3 volume 20GiB Windows NTFS volume
With lshw -v, I get the following for this drive:
*-scsi:1
physical id: 2
bus info: usb@2:1.2
logical name: scsi4
capabilities: emulated scsi-host
configuration: driver=usb-storage
*-disk
description: SCSI Disk
product: HTS545050A7E380
vendor: Hitachi
physical id: 0.0.0
bus info: scsi@4:0.0.0
logical name: /dev/sdb
version: AD04
serial: TE85313R0LU5JK
size: 465GiB (500GB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=6 guid=d0ba2288-a760-46db-8675-fe22d9becf8e sectorsize=512
So, it does tell me this drive is connected somehow through USB; and that it is a Hitachi. However, when I do lsusb, it is not listed at all:
$ sudo lsusb
Bus 004 Device 005: ID 03eb:8808 Atmel Corp.
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 114d:0140 Alpha Imaging Technology Corp.
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 05e3:0735 Genesys Logic, Inc.
Bus 002 Device 002: ID 05e3:0612 Genesys Logic, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0483:91d1 STMicroelectronics Sensor Hub
Bus 001 Device 005: ID 2a47:0c02
Bus 001 Device 004: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
In other words, no Hitachi here. System log /var/log/syslog relevant logs:
kernel: [ 2.963255] scsi 4:0:0:0: Direct-Access Hitachi HTS545050A7E380
kernel: [ 2.963490] sd 4:0:0:0: Attached scsi generic sg1 type 0
kernel: [ 2.964196] sd 4:0:0:0: [sdb] 976773152 512-byte logical blocks: (500 GB/465 GiB)
kernel: [ 2.966060] sd 4:0:0:0: [sdb] Write Protect is off
kernel: [ 2.966063] sd 4:0:0:0: [sdb] Mode Sense: 5f 00 10 08
kernel: [ 2.967007] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
kernel: [ 3.019250] sdb: sdb1 sdb2 sdb3
kernel: [ 3.021523] sd 4:0:0:0: [sdb] Attached SCSI disk
kernel: [ 3.381991] clocksource: Switched to clocksource tsc
And finally I checked with udevadm info -a -n sdb; here it finds the "Hitachi" as vendor of device, and in the parent walk, it comes to usb-storage, which is a child of vendor/product 05e3 0735, which is listed by lsusb (Genesys Logic, Inc.,), and for which lsusb -v reports:
iManufacturer 1 USB Storage
iProduct 2 USB3.0 SATA Bridge
So, since lsusb will typically show vendor/product of, say, USB thumbdrives - why doesn't it show this drive, even if it connected through the USB bus?
|
This drive isn't a USB device, but a SATA device which is accessed via the Genesys bridge (which is a USB device). Since it isn't itself a USB device, it doesn't show up in lsusb's output.
USB thumb drives are USB devices without bridges (well, usually), so they do show up as-is on the USB bus and in lsusb's output.
| lsusb not listing a SCSI drive, connected through USB (SATA bridge)? |
1,530,474,646,000 |
Using Ubuntu 18.04, with my desktop motherboard I obtain:
$ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
|__ Port 13: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 14: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 14: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
Motherboard has exactly 14 USB physical connectors, like the number of ports of Bus 03.Port 1: Dev 1. Any new USB device (for example, a USB 2.0 storage key) shows up as a child device in Bus 03.
The ones shown by lsusb -t should be all the USB devices in this system. Then:
1) If Bus 003 alone is able to cover all the physical USB connectors in the motherboard, what are Bus 001, Bus 002 and Bus 004?
In this answer, dealing with USB buses, it is stated that:
Some or all of these might have external ports for plugging in various USB external devices.
implying that some USB buses may have no external ports. But then:
2) What could such phony buses be useful for, if no internal (for example, soldered) devices are connected to them, and no external device can be connected to them as well?
Edit: this (very useful) answer deals with bus numbering. My post deals instead with the possibility that some USB buses are listed by the Linux kernel, but they do not correspond to any real bus. Why these buses appear, and what they are used for? This is different than simply dealing with the bus numbering convention.
I am also convinced that this is a software question, because it is about how the Linux kernel represents hardware.
|
The USB3 standard brought the SuperSpeed mode, with new cables and connectors. Your bus 4 covers the SuperSpeed mode, which uses an entirely different set of wires in the USB cables. So as the higher-speed mode is physically separate from the old USB wiring, it makes sense for it to appear as a separate bus altogether.
That leaves buses 1 and 2. They are there basically to allow the easy installation of Windows 7 using USB keyboard, mouse and/or installation media :-)
Remember that Windows 7 (and any pre-USB3 operating systems) did not have XHCI USB controller drivers built-in. So, as a backwards compatibility feature, your system also has EHCI USB2 controllers too. The system firmware has the option of initially starting just the EHCI controllers and connecting them to the USB 2 lines instead of the XHCI controller. This allows operating system installation programs to get up and running using plain old EHCI USB drivers for keyboard, mouse and USB storage.
When the appropriate driver is installed and powers up the XHCI controller, there is a hand-over protocol that allows it to take over the control of USB2 side of the ports too. At that point, the EHCI controller can be completely disabled. So, your USB buses 1 and 2 are two cheap backward-compatibility EHCI controllers that have now handed over their respective USB ports to the shiny new XHCI controller.
Note that the two EHCI controllers only support 2 ports each, and they are connected with separate root hub objects, that support 8 and 6 ports respectively, giving a total of 14 USB2 ports - exactly the same number as handled by the single root hub of bus 3, which is the "slow" side of the XHCI controller.
(Back when USB 2 was introduced, there was a sort of similar solution to the backwards compatibility problem: the old USB 1.1 UHCI/OHCI controllers existed as "companion controllers" along with the USB 2.0 EHCI controller for a long time. But that solution did not include a hand-over protocol, so the two generations of USB controllers lived on side-by-side for quite a long time. With USB 3, the specification makers included the hand-over protocol to hopefully get rid of the legacy EHCI controllers a bit faster.)
| Phony USB hubs in Linux |
1,530,474,646,000 |
I put the USB wlan NIC into my server.
However it did not work correctly, I pull it off.
But it still remains the lsusb's result.
$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 04bb:0948 I-O Data Device, Inc. WN-G300U Wireless LAN Adapter
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
148f:5370 Ralink Technology is the removed one.
How can I remove that bogus interface?
My system is Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64).
** additional info ***
$ls /sys/bus/usb/devices/
1-0:1.0/ 1-1.6/ 1-1:1.0/ 2-1/ 3-0:1.0/ usb1/ usb3/
1-1/ 1-1.6:1.0/ 2-0:1.0/ 2-1:1.0/ 4-0:1.0/ usb2/ usb4/
|
You can try USBdetach :
./usbdetach -v -p /dev/ttyUSBx
There is brief explanation given on this blog you can refer to that page for more information.
| How to remove unplugged device from lsusb's result |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.