Files
mkdocs/docs/macos/network.md
2024-04-06 09:54:09 +02:00

4.5 KiB

Network

$ arp -a
? (192.0.0.2) at 50:ed:3c:1f:98:6 on en0 ifscope permanent [ethernet]
? (239.255.255.250) at 1:0:5e:7f:ff:fa on en0 ifscope permanent [ethernet]
$ networksetup -listallnetworkservices

An asterisk (*) denotes that a network service is disabled.
Belkin USB-C LAN
USB 10/100/1000 LAN
Wi-Fi
iPhone USB
Thunderbolt Bridge 2
Thunderbolt Bridge
DS923
$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) Belkin USB-C LAN
(Hardware Port: Belkin USB-C LAN, Device: en5)

(2) USB 10/100/1000 LAN
(Hardware Port: USB 10/100/1000 LAN, Device: en9)

(3) Wi-Fi
(Hardware Port: Wi-Fi, Device: en0)

(4) iPhone USB
(Hardware Port: iPhone USB, Device: en8)

(5) Thunderbolt Bridge 2
(Hardware Port: Thunderbolt Bridge, Device: bridge0)

(6) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)

(7) DS923
(Hardware Port: com.wireguard.macos, Device: )
$ networksetup -getinfo Wi-Fi
DHCP Configuration
IP address: 192.0.0.2
Subnet mask: (null)
Router: 192.0.0.1
Client ID:
IPv6: Automatic
IPv6 IP address: none
IPv6 Router: none
Wi-Fi ID: 50:ed:3c:1f:98:06
$ networksetup -listallhardwareports | grep -C1 $(route get default | grep interface | awk '{print $2}')
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: 50:ed:3c:1f:98:06
$ networksetup -listnetworkserviceorder | grep -C1 $(netstat -nr | grep ^default | grep -o "\s\S\+$")
$ networksetup -listnetworkserviceorder | grep -C1 en0
(3) Wi-Fi
(Hardware Port: Wi-Fi, Device: en0)

one way to know which one you are taking to reach the outside is the following line command

$ route get default | grep interface
  interface: en0
$ route -n get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}'
en0
$ netstat -i

Name       Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
lo0        16384 <Link#1>                         25370     0    25370     0     0
lo0        16384 127           localhost          25370     -    25370     -     -
lo0        16384 localhost   ::1                  25370     -    25370     -     -
lo0        16384 airbook.loc fe80:1::1            25370     -    25370     -     -
gif0*      1280  <Link#2>                             0     0        0     0     0
stf0*      1280  <Link#3>                             0     0        0     0     0
anpi0      1500  <Link#4>    de:47:cc:60:98:b6        0     0        0     0     0
anpi1      1500  <Link#5>    de:47:cc:60:98:b7        0     0        0     0     0
en3        1500  <Link#6>    de:47:cc:60:98:96        0     0        0     0     0
en4        1500  <Link#7>    de:47:cc:60:98:97        0     0        0     0     0
en1        1500  <Link#8>    36:6d:60:8b:6d:80        0     0        0     0     0
en2        1500  <Link#9>    36:6d:60:8b:6d:84        0     0        0     0     0
bridge0    1500  <Link#11>   36:6d:60:8b:6d:80        0     0        0     0     0
ap1        1500  <Link#12>   72:ed:3c:1f:98:06        0     0     1108     0     0
ap1        1500  airbook.loc fe80:c::70ed:3cff        0     -     1108     -     -
en0        1500  <Link#13>   50:ed:3c:1f:98:06      121     0    49488     0     0
en0        1500  airbook.loc fe80:d::c7a:c760:      121     -    49488     -     -
en0        1500  2a01cb09806 2a01:cb09:806e:28      121     -    49488     -     -
en0        1500  2a01cb09806 2a01:cb09:806e:28      121     -    49488     -     -
en0        1500  192.0.0.2/32  192.0.0.2            121     -    49488     -     -
awdl0      1500  <Link#14>   f6:0c:44:f4:ad:f2        0     0     2260     0     0
awdl0      1500  fe80::f40c: fe80:e::f40c:44ff        0     -     2260     -     -
llw0       1500  <Link#15>   f6:0c:44:f4:ad:f2        0     0        0     0     0
llw0       1500  fe80::f40c: fe80:f::f40c:44ff        0     -        0     -     -
utun0      1500  <Link#16>                            0     0        0     0     0
utun0      1500  airbook.loc fe80:10::4ec3:d09        0     -        0     -     -
utun1      1380  <Link#17>                            0     0        0     0     0
utun1      1380  airbook.loc fe80:11::98ed:570        0     -        0     -     -
utun2      2000  <Link#18>                            0     0        0     0     0
utun2      2000  airbook.loc fe80:12::416:ebf1        0     -        0     -     -
utun3      1000  <Link#19>                            0     0        0     0     0
utun3      1000  airbook.loc fe80:13::ce81:b1c        0     -        0     -     -