Regardless of how you connect to your iPhone acting a a personal hotspot, whether it be via WiFi or tethered via cable, you are sharing the cellular data connection.
So, using your example, where your iPhone is initially connected to the corporate WiFi and then you enable the Personal Hotspot feature, you will disconnect from the corporate WiFi and a private (NAT) network will be created with a gateway configured through your cellular network. Whether you use WiFi or connect via USB, this network will be created
From Apple Support:
A Personal Hotspot lets you share the cellular data connection of your iPhone or iPad (Wi-Fi + Cellular) when you don't have access to a Wi-Fi network.
Why is this the case? Your iPhone can only connect to a single WiFi network at any given time. The Personal Hotspot is designed to provide a WiFi signal where you don't have one. This configuration cannot be changed.
Finding your Gateway....
If you want to see which connection you’re using (which has priority) for the Internet you just need to get the IP addresses of you adapters and run a trace route to see the path.
(Values below are from my iMac; en0
is wired, en1
is WiFi connected to hotspot. Your values will differ.)
$ ifconfig en0 | egrep -iw inet
inet 192.168.1.54 netmask 0xffffff00 broadcast 192.168.1.255
$ ifconfig en1 | grep -iw inet
inet 172.20.10.3 netmask 0xfffffff0 broadcast 172.20.10.15
$ traceroute apple.com | head -n 1
1 pfsense (192.168.1.1) 0.481 ms 0.312 ms 0.329 ms
You will get a output telling you which gateway is being used for Internet traffic. In my case, it's showing me that I'm going through my en0
or wired network adapter.
You could use the netstat -rn
command to get your default gateway, but I've found that you can have multiple gateways.
$ netstat -rn | egrep default
default 192.168.1.1 UGSc 125 109 en0
default 172.20.10.1 UGScI 7 0 en1
This is why I like to use traceroute
to actually (and quickly) "see" where the traffic is going.
Measuring Bandwidth....
The only way to measure bandwidth is to use a utility (service) like vnStat. It's available via MacPorts or Homebrew. The system, by default is not measuring bandwidth usage so you'll need a service that gets loaded at boot (or at the users request) to begin logging this data.
A sample output (assuming 2 interfaces) would look like the following:
(with 2 interfaces)
$ vnstat
rx / tx / total / estimated
Internet (eth1):
2018-09 31.90 GiB / 28.05 GiB / 59.95 GiB
2018-10 281.04 MiB / 99.45 MiB / 380.49 MiB / 12.05 GiB
yesterday 1.23 GiB / 473.23 MiB / 1.69 GiB
today 281.04 MiB / 99.45 MiB / 380.49 MiB / 397 MiB
Local (eth0):
2018-09 25.13 GiB / 116.94 GiB / 142.07 GiB
2018-10 234.75 MiB / 5.03 GiB / 5.26 GiB / 170.76 GiB
yesterday 520.55 MiB / 2.21 GiB / 2.72 GiB
today 234.75 MiB / 5.03 GiB / 5.26 GiB / 5.51 GiB