Huawei Modem as network in Proxmox

dariuszszyc

Member
Sep 7, 2020
9
1
23
37
Hello,

I've been searching a lot to solve this issue and I gave up. I need your help.

I have connected Huawei e5776s-32 (Mobile LTE WiFi Hotspot) via usb cable to Proxmox.
I plan to use this network with opnSense. I tried that already (sharing whole USB port) and it worked fine but each time I disconnected Huawei - opnSense VM crashed and had to be started again.

So I've decided it'd be better to share Huawet as a network, I've heard this way opnSense shouldn't crash once Huawei is disconnected.

But I'm having trouble connecting to the network from Proxmox shell via Huawei's interface.

DMESG
Code:
[ 2873.745487] usb 1-4: Manufacturer: HUAWEI Technology
[ 2873.748322] option 1-4:1.0: GSM modem (1-port) converter detected
[ 2873.751036] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[ 2873.774364] huawei_cdc_ncm 1-4:1.1: MAC-Address: 0c:5b:8f:27:9a:64
[ 2873.774372] huawei_cdc_ncm 1-4:1.1: setting rx_max = 16384
[ 2873.774709] huawei_cdc_ncm 1-4:1.1: setting tx_max = 16384
[ 2873.774985] huawei_cdc_ncm 1-4:1.1: NDP will be placed at end of frame for this device.
[ 2873.775193] huawei_cdc_ncm 1-4:1.1: cdc-wdm0: USB WDM device
[ 2873.775607] huawei_cdc_ncm 1-4:1.1 wwan0: register 'huawei_cdc_ncm' at usb-0000:00:12.2-4, Huawei CDC NCM device, 0c:5b:8f:27:9a:64
[ 2873.775730] usb-storage 1-4:1.2: USB Mass Storage device detected
[ 2873.780201] scsi host2: usb-storage 1-4:1.2
[ 2873.780578] usb-storage 1-4:1.3: USB Mass Storage device detected
[ 2873.781036] scsi host3: usb-storage 1-4:1.3
[ 2873.793801] huawei_cdc_ncm 1-4:1.1 eth1: renamed from wwan0

I've renamed device to eth1 in /etc/udev/rules.d/10-network.rules
Code:
SUBSYSTEM=="net", ACTION=="add", ATTR(address)=="MY_MAC", NAME="eth1"

Before renaming - I didn't see the interface in GUI. Now I see it as eth1.

I've created a Linux Bridge (vmbr1) from GUI:
Code:
21: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr1 state UNKNOWN group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
22: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.102/24 brd 192.168.8.255 scope global dynamic vmbr1
       valid_lft 83485sec preferred_lft 83485sec
    inet6 fe80::e5b:8fff:fe27:9a64/64 scope link
       valid_lft forever preferred_lft forever

VMBR1 got correct IP address via DHCP (my modem's gateway is set to 192.168.8.1). What makes me worried is that the state is unknown.
All looks fine, but I can't ping anything, tried domain, tried 8.8.8.8 . When I attached USB port to VM - everything worked and ping worked but not from Proxmox.

I'm a basic user so maybe I'm mixing things... I'll be grateful for any advice (novice-friendly :) ).

Cheers
 
I have connected Huawei e5776s-32 (Mobile LTE WiFi Hotspot) via usb cable to Proxmox.
I plan to use this network with opnSense. I tried that already (sharing whole USB port) and it worked fine but each time I disconnected Huawei - opnSense VM crashed and had to be started again.

So I've decided it'd be better to share Huawet as a network, I've heard this way opnSense shouldn't crash once Huawei is disconnected.

But I'm having trouble connecting to the network from Proxmox shell via Huawei's interface.

DMESG
Code:
[ 2873.745487] usb 1-4: Manufacturer: HUAWEI Technology
[ 2873.748322] option 1-4:1.0: GSM modem (1-port) converter detected
[ 2873.751036] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[ 2873.774364] huawei_cdc_ncm 1-4:1.1: MAC-Address: 0c:5b:8f:27:9a:64
[ 2873.774372] huawei_cdc_ncm 1-4:1.1: setting rx_max = 16384
[ 2873.774709] huawei_cdc_ncm 1-4:1.1: setting tx_max = 16384
[ 2873.774985] huawei_cdc_ncm 1-4:1.1: NDP will be placed at end of frame for this device.
[ 2873.775193] huawei_cdc_ncm 1-4:1.1: cdc-wdm0: USB WDM device
[ 2873.775607] huawei_cdc_ncm 1-4:1.1 wwan0: register 'huawei_cdc_ncm' at usb-0000:00:12.2-4, Huawei CDC NCM device, 0c:5b:8f:27:9a:64
[ 2873.775730] usb-storage 1-4:1.2: USB Mass Storage device detected
[ 2873.780201] scsi host2: usb-storage 1-4:1.2
[ 2873.780578] usb-storage 1-4:1.3: USB Mass Storage device detected
[ 2873.781036] scsi host3: usb-storage 1-4:1.3
[ 2873.793801] huawei_cdc_ncm 1-4:1.1 eth1: renamed from wwan0

I've renamed device to eth1 in /etc/udev/rules.d/10-network.rules
Code:
SUBSYSTEM=="net", ACTION=="add", ATTR(address)=="MY_MAC", NAME="eth1"

Before renaming - I didn't see the interface in GUI. Now I see it as eth1.

I've created a Linux Bridge (vmbr1) from GUI:
Code:
21: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr1 state UNKNOWN group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
22: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.102/24 brd 192.168.8.255 scope global dynamic vmbr1
       valid_lft 83485sec preferred_lft 83485sec
    inet6 fe80::e5b:8fff:fe27:9a64/64 scope link
       valid_lft forever preferred_lft forever

VMBR1 got correct IP address via DHCP (my modem's gateway is set to 192.168.8.1). What makes me worried is that the state is unknown.
All looks fine, but I can't ping anything, tried domain, tried 8.8.8.8 . When I attached USB port to VM - everything worked and ping worked but not from Proxmox.


Since your modem is a removable device it may disappear - even it's just for a moment - from system and then from the bridge too. When the device comes back it is not connected to the bridge again (the concept of bridges in Proxmox is not dedicated for removable devices). You can do this by an OS command, but IMO a better solution is the following:

* use your modem just in the host itself with DHCP (adapt your /etc/network/interface accordingly)
* pfSense is connected via vmbr1 and routes all its traffic via Proxmox host
* Proxmox host actions as a NAT router using the modem as external interface

For this the following commands are necessary:

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
 
Since your modem is a removable device it may disappear - even it's just for a moment - from system and then from the bridge too. When the device comes back it is not connected to the bridge again (the concept of bridges in Proxmox is not dedicated for removable devices). You can do this by an OS command, but IMO a better solution is the following:

* use your modem just in the host itself with DHCP (adapt your /etc/network/interface accordingly)
* pfSense is connected via vmbr1 and routes all its traffic via Proxmox host
* Proxmox host actions as a NAT router using the modem as external interface

For this the following commands are necessary:

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Thank you Richard for he suggestion. It is not a bad idea.
What I'm wondering is how will vmbr1 know that it should use eth1 since I have 2 other network interfaces (WAN & LAN) connected to Proxmox ?
I want Proxmox to use WAN as the internet connection.

enp1s0 is my LAN (192.168.1.0)
enxd... is my WAN (192.168.0.0)
eth1 is Huawei Mobile Hotspot

proxmox network.png
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!