You are able to do the next:
Sort ifconfig
or ifconfig -a
. This command reveals you the record of interfaces together with their IP and MAC addresses (the latter one provided that relevant). You can even kind ifconfig en0
or ifconfig en1
for the configuration of a selected interface solely (as somebody mentioned of their solutions, en0 is usually the wired Ethernet whereas en1 is the WiFi interface).
Instead, netstat -i
will record all interfaces and can present you the IP addresses you could have assigned to every of them.
Usually, when you could have SSH daemon operating on a field, it can hear on all accessible interfaces, ie. you need to use any IP tackle that is configured in your machine to connect with that machine by way of SSH (this, clearly, topic to Firewall guidelines). Should you’re after what the OS calls a Main interface and first IP tackle, you need to use the scutil
command like this:
MacBook:~ scutil
> present State:/Community/World/IPv4
{
PrimaryInterface : en0
PrimaryService : C0550F84-5C07-484F-8D62-C8B90DC977D8
Router : 10.103.4.1
}
> present State:/Community/Interface/en0/IPv4
{
Addresses : {
0 : 10.103.4.234
}
BroadcastAddresses : {
0 : 10.103.4.255
}
SubnetMasks : {
0 : 255.255.255.0
}
}
Please notice, that the above, regardless that is a command-line command, can also be interactive (so that you run scutil
after which enter its personal instructions into it). The primary present
command tells you the title of the first interface for the OS (i.e. this would be the one on prime of the record in your System Preferences / Community Preferences window), in addition to the IP tackle of your default router. The second present
command takes State:/Community/Interface/
argument (on this case, en0
) and offers you the IP addresses assigned to it. You are on the lookout for the tackle within the Addresses array, the opposite two entries are broadcast addresses and the netmasks.
Hope that helps, but when something will not be clear, let me know.