系统相关
首页 > 系统相关> > linux – samsung S7 android无法连接而且没有设置网络配置

linux – samsung S7 android无法连接而且没有设置网络配置

作者:互联网

通过USB将Samsung S7连接到您最喜爱的Linux机器.转到’设置 – >连接 – >移动热点和Tethering’并启用“USB tethering”.

Android现在将启用与Linux主机的网络共享,因此Linux应该从手机获取IP地址.这是它被打破的地方.永远不会进行正确的网络设置以允许与手机本身进行任何IP连接.

问题是三星S7发送无效/损坏的Mac地址:00:00:00:00:00:00.并且Linux网络堆栈根本不使用“零”mac地址.

这个问题似乎与三星S7(android 6.x和7.x)一起推出.我以前的手机三星S4和S5是没有问题的网络共享.

我正在使用NetworkManager运行Fedora 24/25,但任何Linux都很可能会暴露同样的问题.

PS:与Win7-64绑定工作

ifconfig -a
enp0s20u4: flags=4098<BROADCAST,MULTICAST>  mtu 1500
    ether 00:00:00:00:00:00  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Mar  7 08:56:02 m3800 kernel: usb 1-4: New USB device found, idVendor=04e8, idProduct=6863
Mar  7 08:56:02 m3800 kernel: usb 1-4: New USB device strings: Mfr=3, Product=4, SerialNumber=5
Mar  7 08:56:02 m3800 kernel: usb 1-4: Product: SAMSUNG_Android
Mar  7 08:56:02 m3800 kernel: usb 1-4: Manufacturer: SAMSUNG
Mar  7 08:56:02 m3800 kernel: usb 1-4: SerialNumber: cexxxxxxxxxxxxxxxx
Mar  7 08:56:02 m3800 mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4"
Mar  7 08:56:02 m3800 mtp-probe: bus: 1, device: 6 was not an MTP device
Mar  7 08:56:02 m3800 kernel: [  127.774244] usbcore: registered new     interface driver cdc_ether
Mar  7 08:56:02 m3800 kernel: usbcore: registered new interface driver cdc_ether
Mar  7 08:56:02 m3800 kernel: [  127.777443] rndis_host 1-4:1.0 eth0: register 'rndis_host' at usb-0000:00:14.0-4, RNDIS device, 00:00:00:00:00:00
Mar  7 08:56:02 m3800 kernel: [  127.777466] usbcore: registered new interface driver rndis_host
Mar  7 08:56:02 m3800 kernel: rndis_host 1-4:1.0 eth0: register 'rndis_host' at usb-0000:00:14.0-4, RNDIS device, 00:00:00:00:00:00
Mar  7 08:56:02 m3800 kernel: usbcore: registered new interface driver rndis_host
Mar  7 08:56:02 m3800 kernel: [  127.781049] rndis_host 1-4:1.0 enp0s20u4: renamed from eth0
Mar  7 08:56:02 m3800 kernel: rndis_host 1-4:1.0 enp0s20u4: renamed from eth0
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): carrier is OFF                                                      
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): new Ethernet device (driver: 'rndis_host' ifindex: 3)               
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): exported as /org/freedesktop/NetworkManager/Devices/2               
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]                                                                                                                              
Mar  7 08:56:02 m3800 NetworkManager[876]: <error> [1488905762.697751] [platform/nm-linux-platform.c:2278] link_change(): Netlink error changing link 3:  <UP> mtu 0 (1) driver 'rndis_host' udi '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/net/enp0s20u4': Invalid address for specified address family
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): preparing device
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>      read connection 'Wired connection 1'
Mar  7 08:56:02 m3800 NetworkManager[876]: <info>  (enp0s20u4): created default wired connection 'Wired connection 1'

解决方法:

Linux网络堆栈不适用于具有“零”MAC地址的接口.尝试设置网络配置时,与Android手机的网络共享设置只是在Linux端暂停.

此时,通过手动设置界面和路由,以下内容适用于我.我把它包装在一个shell脚本中:

# cat tetherS7_nwsetup.sh 

IFNAME=enp0s20u4
ip a add 192.168.42.2/24 brd + dev $IFNAME
ip link set dev enp0s20u3 address e8:2a:ea:01:02:03
ip link set dev $IFNAME up
route add default gw 192.168.42.129
echo "nameserver 8.8.8.8" >>/etc/resolv.conf

更改IFNAME并输入您的界面名称.然后执行:

# chmod +x tetherS7_nwsetup.sh 
# sudo ./tetherS7_nwsetup.sh 

对于DNS,我目前正在使用Google的DNS服务器.随意改变.
希望这些步骤对你有用.

标签:mac-address,android,linux,usb,network-interface
来源: https://codeday.me/bug/20190814/1658278.html