A handy repository for anyone who wants to fix a network issue :)
I have only orgonised and added my own command to the list but the original document was drafted by krypted.com
Feel free to contribute and improve this list :)
ipconfig getifaddr en0
ip=`ipconfig getifaddr en0 ; echo $ip
ipconfig getoption en0 subnet_mask
ipconfig getoption en0 domain_name_server
ipconfig getpacket en1
ifconfig en0
ifconfig en0 inet 10.10.10.10 netmask 255.255.255.0
networksetup -listlocations
networksetup -getcurrentlocation
Create a network location called Work and populate it with information from the active network connection:
networksetup -createlocation
networksetup -deletelocation
networksetup -switchlocation
Work Switch the active location to a location called Work, but also show the GUID of that location so we can make scripties with it laters:
scselect
networksetup -listallnetworkservices
networksetup -renamenetworkservice
networksetup -setnetworkserviceenabled
networksetup -ordernetworkservices “Wi-Fi” “USB Ethernet”
networksetup -setdhcp Wi-Fi
ipconfig set en1 BOOTP && ipconfig set en1 DHCP ifconfig en1 down && ifconfig en1 up
echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil
networksetup -setmanual Wi-Fi 10.0.0.2 255.255.255.0 10.0.0.1
networksetup -setdnsservers Wi-Fi 10.0.0.2 10.0.0.3
networksetup -getdnsservers Wi-Fi
launchctl unload /System/Library/LaunchAgents/com.apple.alf.useragent.plist
launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist Start the application layer firewall: launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist
launchctl load /System/Library/LaunchAgents/com.apple.alf.useragent.plist
socketfilterfw -t
“/Applications/FileMaker Pro/FileMaker Pro.app/Contents/MacOS/FileMaker Pro” See the routing table of a Mac: netstat -nr
route -n add 10.0.0.0/32 10.0.9.2 Log bonjour traffic at the packet level: sudo killall -USR2 mDNSResponder Stop Bonjour: launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
Start Bojour: launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
ping -i 5 192.168.210.1
ping -c 5 google.com
ping -f localhost
ping -s 100 google.com
iostat -d disk0
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I
traceroute -n google.com
traceroute -d google.com
netstat -at
netstat -lt
netstat -s
netstat -p igmp
netstat -i
ntop Scan port 80 of www.google.com /System/Library/CoreServices/Applications/Network\ Utility.app/Contents/Resources/stroke www.google.com 80 80 Port scan krypted.com stealthily: nmap -sS -O krypted.com/24
Establish a network connection with www.apple.com:
nc -v www.apple.com 80
/usr/bin/nc -v -w 15 gateway.push.apple.com 2195
/usr/bin/nc -v -4 feedback.push.apple.com 2196
/usr/bin/nc -l 2196
tcpdump -nS
tcpdump -nnvvXS
tcpdump -nnvvXs 548
tcpdump -nnvvXs 548 dst 10.0.0.48
tcpdump -nnvvXs 548 dst 10.0.0.48 -w /tmp/myfile.pcap
tcpdump -qns 0 -A -r /var/tmp/capture.pcap
lsof -n -i4TCP
Make an alias for looking at what has a listener open, called ports:
Report back the name of the system:
dscacheutil -flushcache
arp -ad View how the Server app interprets your network settings:
/Applications/Server.app/Contents/ServerRoot/usr/libexec/afctl -w 10.10.10.2