Skip to main content

Common ifconfig commands.

# Display network settings of the first ethernet adapter
ifconfig wlan0

# Display all interfaces, even if down
ifconfig -a

# Take down / up the wireless adapter
ifconfig wlan0 {up|down}

# Set a static IP and netmask
ifconfig eth0 192.168.1.100 netmask 255.255.255.0

# You may also need to add a gateway IP
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1


# Assign multiple IP's:
ifconfig dc0:0 192.168.1.2

# Assign second IP:
ifconfig dc0:1 192.168.1.3

# Assign IP/Subnet:
ifconfig dc0 inet 192.168.1.2 netmask 255.255.255.0

# Assign Gateway:
route delete default && route add default 192.168.1.1