iPhone hotspot connectivity issue

Hi,
I am able to connect my iPhone mobile wifi hotspot with my Freebsd and IP also got assigned. I am unable to access internet and ping. Android devices connectivity is working fine as i am able access internet from it.

Thanks and Regards,
Arjun
 
ifconfig
Code:
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=4e524bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,MEXTPG>
    ether 54:e1:ad:0d:a1:49
    inet6 fe80::56e1:adff:fe0d:a149%em0 prefixlen 64 scopeid 0x1
    media: Ethernet autoselect
    status: no carrier
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=0
    ether f8:59:71:9b:44:2a
    inet 172.20.10.3 netmask 0xfffffff0 broadcast 172.20.10.15
    groups: wlan
    ssid iPhone channel 149 (5745 MHz 11a) bssid 06:89:57:96:bb:41
    regdomain APAC2 country IN authmode WPA2/802.11i privacy ON
    deftxkey UNDEF AES-CCM 2:128-bit txpower 23 bmiss 10 mcastrate 6
    mgmtrate 6 scanvalid 60 wme roaming MANUAL
    parent interface: iwm0
    media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11a
    status: associated
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

netstat-rn
Code:
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            172.20.10.1        UGS       wlan0
127.0.0.1          link#2             UH          lo0
172.20.10.0/28     link#3             U         wlan0
172.20.10.3        link#2             UHS         lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             link#2                        URS         lo0
::1                               link#2                        UHS         lo0
::ffff:0.0.0.0/96                 link#2                        URS         lo0
fe80::%lo0/10                     link#2                        URS         lo0
fe80::%em0/64                     link#1                        U           em0
fe80::56e1:adff:fe0d:a149%lo0     link#2                        UHS         lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
ff02::/16                         link#2                        URS         lo0
 
Can you ping the iPhone?

what nameservers are configured?
cat /etc/resolv.conf
Yes, able to ping iPhone..
contents of resolv.conf -
Code:
# Generated by resolvconf

#nameserver 127.0.0.1
#options edns0
nameserver 8.8.8.8
nameserver 8.8.4.4
 
looks all good so far. Do you have any firewall running on your BSD?
rc.conf
Code:
hostname="sysadmin"
keymap="us.kbd"
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
create_args_wlan0="country IN regdomain APAC2"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
dbus_enable="yes"
hald_enable="yes"
sound_load="yes"
snd_hda_load="yes"
kld_list="i915kms"
lightdm_enable="yes"
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA DHCP"
 
nothing weird there too it seems.

Other devices using your iPhone hotspot work fine (tethering blocking ISP?)? And the freebsd works fine on other wifi networks?
 
nothing weird there too it seems.

Other devices using your iPhone hotspot work fine (tethering blocking ISP?)? And the freebsd works fine on other wifi networks?
Yes able to use internet from same iPhone in Windows, Linux and android too!
Freebsd works on all other networks other than iPhones(checked with another iPhone too) :(
 
Did you try running tcpdump on freebsd yet to see how traffic is flowing, or rather how its not flowing?
Code:
root@sysadmin:/home/sysadmin # tcpdump -i wlan0
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:35:55.158153 IP6 fe80::8c98:6bff:fe34:8e64 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
10:35:55.397396 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:35:55.397607 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:35:56.399559 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:35:56.498266 IP6 fe80::8c98:6bff:fe34:8e64 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
10:35:59.406072 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:35:59.406725 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:36:49.261725 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:36:49.261869 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:36:50.246151 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:36:50.249058 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:36:53.252415 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:36:53.252504 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:02.277605 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:02.277968 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:29.326912 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:29.327246 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:51.693059 IP6 fe80::8c98:6bff:fe34:8e64 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
10:37:51.917458 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:37:51.917779 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QU)? _companion-link._tcp.local. PTR (QU)? _rdlink._tcp.local. (58)
10:37:52.920718 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:52.920820 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:55.928732 IP 172.20.10.1.mdns > 224.0.0.251.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
10:37:55.928840 IP6 fe80::8c98:6bff:fe34:8e64.mdns > ff02::fb.mdns: 0 [2q] PTR (QM)? _companion-link._tcp.local. PTR (QM)? _rdlink._tcp.local. (58)
^C
24 packets captured
24 packets received by filter
0 packets dropped by kernel
 
it is working now after adding these lines into my rc.conf:

Code:
ifconfig_wlan0="WPA DHCP inet 172.20.10.3 netmask 255.255.255.240 up metric 0"
ifconfig_em0="DHCP metric 1"
 
metric is irrelevant, it's only useful with dynamic routing protocols like OSPF or BGP. It has no meaning with 'standard' routing.
 
metric is irrelevant, it's only useful with dynamic routing protocols like OSPF or BGP. It has no meaning with 'standard' routing.
I have used metric to solve the problem while connecting with LAN connections. Before, I used default IP as my iPhone IP in rc.conf and it was working but when connected to LAN it was not giving internet so added this line to dynamically route.
 
dynamically route.
You're not using dynamic routing. Dynamic routing protocols are RIP, OSPF and BGP for example. You have static routes, it doesn't matter if you get a gateway address from DHCP, that doesn't make it 'dynamic' routing.
 
Gateway will be set by whatever DHCP response came last. And with two interfaces on two different networks your gateway will get bounced back and forth between two different gateways.
 
resolvconf -i

Not giving any output, only blank output

Yeah … defocusing from hotspots, I used to struggle with that.

… Before, I used default IP as my iPhone IP in rc.conf and it was working but when connected to LAN it was not giving internet …

For DHCP environments where I find that /etc/resolv.conf is empty, recently I began taking an approach like this:

route delete default ; service netif stop em0 ; ifconfig wlan0 destroy ; sleep 5 ; service netif start wlan0 ; sleep 10

Maybe clumsy, but better than having no Internet.

Code:
root@mowa219-gjp4-zbook-freebsd:~ # route delete default ; ifconfig gif0 down ; service netif stop em0 > & /dev/null ; ifconfig wlan0 destroy ; sleep 5 ; service netif start wlan0 > & /dev/null ; sleep 10 ; resolvconf -i ; route show default ; ping -4 -c 2 freshports.org
delete net default
em0 wlan0
   route to: default
destination: default
       mask: default
    gateway: 192.168.1.1
        fib: 0
  interface: wlan0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
PING freshports.org (54.227.255.74): 56 data bytes
64 bytes from 54.227.255.74: icmp_seq=0 ttl=51 time=97.944 ms
64 bytes from 54.227.255.74: icmp_seq=1 ttl=51 time=98.033 ms

--- freshports.org ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 97.944/97.989/98.033/0.045 ms
root@mowa219-gjp4-zbook-freebsd:~ # echo $SHELL
/bin/csh
root@mowa219-gjp4-zbook-freebsd:~ # uname -mvKU
FreeBSD 15.0-CURRENT main-n271720-6982be38cb7e GENERIC-NODEBUG amd64 1500023 1500023
root@mowa219-gjp4-zbook-freebsd:~ # route delete default ; ifconfig gif0 down ; service netif stop em0 > & /dev/null ; ifconfig wlan0 destroy ; sleep 5 ; service netif start em0 > & /dev/null ; sleep 10 ; resolvconf -i ; route show default ; ping -4 -c 2 freshports.org
delete net default
em0 wlan0
   route to: default
destination: default
       mask: default
    gateway: 192.168.1.1
        fib: 0
  interface: em0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
PING freshports.org (54.227.255.74): 56 data bytes
64 bytes from 54.227.255.74: icmp_seq=0 ttl=51 time=100.854 ms
64 bytes from 54.227.255.74: icmp_seq=1 ttl=51 time=100.947 ms

--- freshports.org ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 100.854/100.901/100.947/0.047 ms
root@mowa219-gjp4-zbook-freebsd:~ #
 
Gateway will be set by whatever DHCP response came last. And with two interfaces on two different networks your gateway will get bounced back and forth between two different gateways.
Oh you're onto something. There's no default route in the IPv6 routing table. wlan0: is IPv4 only and em0: is IPv6 only, but with no IPv6 default route any non-local IPv6 traffic will fail with "no route". Setting the metric makes the system prefer IPv4 instead of the default IPv6 preference.

Was there an IPv6 default route when em0: was working before connecting to the IPv4-only hotspot, and if so why did the DHCP client delete the IPv6 default route when it didn't set an IPv6 address?
 
Back
Top