pgj / freebsd-wifibox

wifibox: Use Linux to drive your wireless card on FreeBSD
BSD 2-Clause "Simplified" License
150 stars 11 forks source link

wifibox works but routing to 10.0.0.1 died #97

Open krolingo opened 2 months ago

krolingo commented 2 months ago

Description

A clear and concise description of what the problem is. What is expected from the application? wifibox stopped working after an update of GhostBSD It launches and runs and it connects to the internet, verified with wifibox console, yet wifibox0 is 0.0.0.0.0

Host operating system

Output of `uname -a`.
FreeBSD martin-ghostbsd-pc 14.0-STABLE FreeBSD 14.0-STABLE GENERIC amd64

Wireless NIC

Relevant output of `pciconf -lv`.
pciconf -lv
    subclass   = RAM
ppt0@pci0:0:20:3:   class=0x028000 rev=0x10 hdr=0x00 vendor=0x8086 device=0xa370 subvendor=0x8086 subdevice=0x4030
    vendor     = 'Intel Corporation'
    device     = 'Cannon Lake PCH CNVi WiFi'
    class      = network

Wifibox version

Output of `wifibox version`.  Note that only the latest version is supported.
version
wifibox version 0.13.0
Disk image checksum: 1775c3767f5c480565079def723e8c8f79b3624c9e068e16565569833a6a44a3

Disk image type and version

The kind of VM image in use, e.g. Wifibox/Alpine, and its version. Wifibox/Alpine

pkg info wifibox-alpine wifibox-alpine-20240328 Name : wifibox-alpine Version : 20240328 Installed on : Tue Apr 30 13:09:25 2024 EDT Origin : net/wifibox-alpine Architecture : FreeBSD:14:amd64 Prefix : /usr/local Categories : net Licenses : BSD2CLAUSE Maintainer : pali.gabor@gmail.com WWW : https://github.com/pgj/freebsd-wifibox-alpine Comment : Wifibox guest based on Alpine Linux Options : APP_HOSTAPD : off APP_WPA_SUPPLICANT: on COMP_GZIP : off COMP_LZ4 : off COMP_LZO : off COMP_XZ : on COMP_ZSTD : off FW_ATH10K : on FW_ATH11K : on FW_ATH12K : on FW_ATMEL : off FW_B43 : off FW_B43LEGACY : off FW_BRCM : on FW_IPW2100 : off FW_IPW2200 : off FW_IWL3945 : off FW_IWL4965 : off FW_IWLWIFI : on FW_MARVELL : on FW_MEDIATEK : on FW_RT61 : on FW_RTLWIFI : on FW_RTW88 : on FW_RTW89 : on FW_TI : off IPV6 : on KERN_EDGE : off KERN_LTS : on UDS_PASSTHRU : on XX_DRIVER_WL : off XX_FORWARDING : off XX_MDNS : off XX_TCPDUMP : off Annotations : FreeBSD_version: 1400501 flavor : default repo_type : binary repository : GhostBSD Flat size : 122MiB

Changes to the default configuration files

Include relevant sections from all the configuration files that contain local changes and may help to reproduce the problem.

Logs

Please copy and paste any relevant log output from the following sources:

- /var/log/wifibox.log (with DEBUG logging verbosity)
- /var/run/wifibox/appliance/log/dmesg
- /var/run/wifibox/appliance/log/messages

Hint: The DEBUG log verbosity could be configured in the `core.conf` file, which is located in the `$LOCALBASE/etc/wifibox` directory.

│2024-04-30T14:40:10-0400 DEBUG [bhyve] rdmsr to register 0x64e on vcpu 0                                                                        │
│2024-04-30T14:40:10-0400 DEBUG [bhyve] rdmsr to register 0x34 on vcpu 0                                                                         │
│2024-04-30T14:40:10-0400 INFO  Guest wifibox has started up                                                                                     │
│2024-04-30T14:40:10-0400 INFO  Guest is managed by PID 5299                                                                                     │
│2024-04-30T14:40:10-0400 INFO  Bringing up Unix Domain Socket pass-through                                                                      │
│2024-04-30T14:40:10-0400 INFO  Found guest IP address: 10.0.0.1                                                                                 │
│2024-04-30T14:40:10-0400 INFO  Configured sockets: [path=/var/run/wpa_supplicant/wlan0,user=root,group=0,mode=770,port=1200                     │
│path=/var/run/wpa_supplicant/p2p-dev-wlan0,user=root,group=0,mode=770,port=1201]                                                                │
│2024-04-30T14:40:10-0400 INFO  Hooking up 10.0.0.1:1200 as /var/run/wpa_supplicant/wlan0 (root:0@770)                                           │
│2024-04-30T14:40:10-0400 INFO  Hooking up 10.0.0.1:1201 as /var/run/wpa_supplicant/p2p-dev-wlan0 (root:0@770)                                   │
│2024-04-30T14:40:10-0400 INFO  End: wifibox restart                                                                                             │

Additional context

Add any other context about the problem here that might help the investigation.

dhclient -d wifibox0 DHCPREQUEST on wifibox0 to 255.255.255.255 port 67 DHCPACK from 10.0.0.1 bound to 192.168.0.20 -- renewal in 432000 seconds.

Have you tried to turn it on and off?

krolingo commented 2 months ago

what's weird is this: bound to 192.168.0.20 -- renewal in 432000 seconds. dunno where 192.168.0.20 is coming from

pgj commented 2 months ago

If the IPv4 address of the wifibox0 interface is 0.0.0.0 that means that dhclient could not yet get an address. It may take a while to have the process completed. If the resulting IP is something "weird", that is probably a cached IP from an earlier lease.

I am curious if that is the same if you configure a static IPv4 address for the wifibox0 interface?

If the static address assignment works, a problem could be around udhcpd in the guest. You can learn about its health by using the following command:

wifibox# fgrep udhpcd /var/log/messages

At the same time, it might be worth to check the udhcp.conf file in $LOCALBASE/etc/wifibox/appliance. Note that the default values there were changed, because I realized that a single-adddress range (as it was before) can become depleted easily. That is because that single address may not be released when it is requested once more in a short period of time. You may have to change udhcpd.conf in the following way:

start           10.0.0.2
end             10.0.0.254
max_leases      64
krolingo commented 2 months ago

I have it like this:

cat /usr/local/etc/wifibox/appliance/udhcpd.conf


start           10.0.0.2
end             10.0.0.254
max_leases      64
interface       eth0
opt     subnet  255.255.255.0
opt     router  10.0.0.1
opt     dns     %%DNS%% 8.8.8.8 8.8.4.4
opt     lease   864000

and now static on rc.conf

## ## WIFIBOX ## ##
wifibox_enable="YES"
devmatch_enable="YES"
devmatch_blocklist="if_iwm if_iwlwifi"
#DHCP
#ifconfig_wifibox0="SYNCDHCP"

background_dhclient_wifibox0="YES"
defaultroute_delay="0"
defaultrouter="10.0.0.1"
ifconfig_wifibox0="inet 10.0.0.2/24"
# end wifibox
ifconfig

wifibox0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=0
        ether 58:9c:fc:10:c3:41
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 2000000
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>
pgj commented 2 months ago

Have you done the following on the host?

# service netif restart wifibox0
# service routing restart
krolingo commented 2 months ago

static IP + service netif restart wifibox0 + # service routing restart

solved it.

pgj commented 2 months ago

I am glad that the static IP assignment solved the problem for you. But it would be better if we understood why this was required in the first place. In my books, that is a workaround, not a real solution.

krolingo commented 2 months ago

I can help anyway you need, just let me know what would be useful to you for me to do.

pgj commented 2 months ago

Thank you! First off, I would circle back to one of my earlier comments:

If the static address assignment works, a problem could be around udhcpd in the guest. You can learn about its health by using the following command:

wifibox# fgrep udhpcd /var/log/messages

Here is another command that might be worth to try:

wifibox# service udhcpd status

A problem could be that the templating of udhcpd.conf does not always work as expected and the service cannot start up. But this has be to established first.