ipconfig.co.uk

Other platforms: BSD, Solaris, AIX, Cisco, phones, containers

The same question, "what is my IP and how do I change it", on every system you are likely to meet outside the big three desktops. Where a platform has a graphical path, it is mentioned; where a command exists, it is given.

FreeBSD

FreeBSD's ifconfig is the primary tool and is far more capable than the Linux one: it handles Wi-Fi association, VLANs, bridges, link aggregation, tunnels and jails' epair interfaces. There is no ip command.

BSD · Terminal
ifconfig                          # all interfaces
ifconfig -a
ifconfig -l                       # names only
ifconfig -u                       # only up
ifconfig em0
ifconfig -v em0                   # verbose, driver capabilities
ifconfig -g wlan                  # interfaces in group 'wlan'
netstat -rn                       # routing table
route -n get default
netstat -in                       # interface counters
arp -an
ndp -an
sockstat -4 -l                    # listening sockets with process
sysctl net.inet.ip.forwarding

Configuration

BSD · Terminal
# temporary
sudo ifconfig em0 inet 192.168.1.50/24
sudo ifconfig em0 alias 192.168.1.51/32
sudo ifconfig em0 -alias 192.168.1.51
sudo ifconfig em0 inet6 2001:db8::50/64
sudo route add default 192.168.1.1
sudo route change default 192.168.1.254
sudo dhclient em0                 # obtain a DHCP lease now
sudo ifconfig em0 description "uplink to core-sw1"
sudo ifconfig em0 name lan0
sudo ifconfig em0 mtu 9000
sudo ifconfig em0 ether 02:11:22:33:44:55
File
# /etc/rc.conf — persistent
hostname="bsdbox.home.arpa"
ifconfig_em0="inet 192.168.1.50/24"
ifconfig_em0_ipv6="inet6 accept_rtadv"
defaultrouter="192.168.1.1"
# or DHCP:
# ifconfig_em0="DHCP"
# ifconfig_em0="SYNCDHCP"       # wait for the lease at boot
# VLAN and bridge examples
vlans_em0="10 20"
ifconfig_em0_10="inet 10.10.0.1/24"
cloned_interfaces="bridge0"
ifconfig_bridge0="addm em0 addm em1 up"
BSD · Terminal
sudo service netif restart em0
sudo service routing restart
sudo service netif restart && sudo service routing restart

Wi-Fi on FreeBSD

BSD · Terminal
sudo ifconfig wlan0 create wlandev iwm0
sudo ifconfig wlan0 up scan
sudo ifconfig wlan0 list scan
sudo ifconfig wlan0 ssid MySSID
sudo ifconfig wlan0 list sta
# /etc/rc.conf
#   wlans_iwm0="wlan0"
#   ifconfig_wlan0="WPA DHCP"
# /etc/wpa_supplicant.conf holds the SSID and psk

DNS

Plain /etc/resolv.conf, usually written by resolvconf(8) from DHCP. There is no system-wide cache unless you install local-unbound (service local_unbound restart to flush).

OpenBSD

BSD · Terminal
ifconfig
ifconfig em0
ifconfig -A                       # all, including ones with no address
route -n show
route -n get default
arp -an
netstat -rn
dhcpleasectl em0                  # show lease (OpenBSD 7.0+)
sudo dhcpleasectl -w 10 em0       # request a lease and wait
sudo ifconfig em0 inet 192.168.1.50 netmask 255.255.255.0
sudo ifconfig em0 inet autoconf   # DHCP via dhcpleased
sudo route add default 192.168.1.1
File
# /etc/hostname.em0 — one file per interface, persistent
inet 192.168.1.50 255.255.255.0
inet6 autoconf
!route add default 192.168.1.1
# or simply:
# inet autoconf
# inet6 autoconf

# /etc/mygate — default gateway(s)
192.168.1.1
BSD · Terminal
sudo sh /etc/netstart em0
sudo sh /etc/netstart

Wi-Fi is configured the same way: ifconfig iwm0 nwid MySSID wpakey secret, or the equivalent lines in /etc/hostname.iwm0. ifconfig iwm0 scan lists networks. OpenBSD 6.9 replaced dhclient with dhcpleased and slaacd for IPv6.

NetBSD

BSD · Terminal
ifconfig -a
ifconfig wm0 inet 192.168.1.50 netmask 255.255.255.0
route add default 192.168.1.1
dhcpcd wm0
# /etc/ifconfig.wm0 for persistence, /etc/rc.conf: dhcpcd=YES, defaultroute="192.168.1.1"

Solaris and illumos (OmniOS, OpenIndiana, SmartOS)

Solaris 11 replaced ifconfig-based configuration with ipadm (IP) and dladm (data link). ifconfig still exists for compatibility.

Any shell
dladm show-link                        # links
dladm show-phys                        # physical NICs
ipadm show-if                          # IP interfaces
ipadm show-addr                        # addresses
ipadm show-addr net0/v4
netstat -rn
route -p show                          # persistent routes
# configure
ipadm create-ip net0
ipadm create-addr -T static -a 192.168.1.50/24 net0/v4
ipadm create-addr -T dhcp net0/dhcp
ipadm create-addr -T addrconf net0/v6
ipadm delete-addr net0/v4
route -p add default 192.168.1.1
# DNS
svccfg -s network/dns/client setprop config/nameserver = net_address: "(1.1.1.1 1.0.0.1)"
svcadm refresh network/dns/client
# legacy
ifconfig -a
ifconfig net0 plumb 192.168.1.50 netmask 255.255.255.0 up

AIX

Any shell
ifconfig -a
netstat -in
netstat -rn
lsdev -Cc if                            # interfaces
lsdev -Cc adapter | grep ent            # adapters
entstat -d ent0                         # link statistics and speed
lsattr -El en0                          # attributes including netaddr, netmask
# configure (persistent, via ODM)
chdev -l en0 -a netaddr=192.168.1.50 -a netmask=255.255.255.0 -a state=up
chdev -l inet0 -a route=net,-hopcount,0,,0,192.168.1.1
# or use smitty tcpip / mktcp
namerslv -s                             # DNS servers
no -a | grep ipforwarding

HP-UX

Any shell
ifconfig lan0
lanscan                                 # hardware and interface names
netstat -in
netstat -rn
# persistent config: /etc/rc.config.d/netconf
ifconfig lan0 192.168.1.50 netmask 255.255.255.0 up
route add default 192.168.1.1 1
nwmgr                                   # 11i v3 network manager

Cisco IOS and IOS-XE

Cisco IOS
show ip interface brief                 # the ipconfig equivalent
show ipv6 interface brief
show interfaces GigabitEthernet0/1
show interfaces status                  # switches: port state, VLAN, speed
show ip interface GigabitEthernet0/1    # detailed L3 settings
show ip route
show ip route 0.0.0.0
show ip arp
show mac address-table
show cdp neighbors detail
show lldp neighbors
show running-config interface GigabitEthernet0/1
show ip dhcp binding                    # if the router is the DHCP server
show dhcp lease                         # if an interface is a DHCP client
show hosts                              # name cache
clear ip dhcp binding *
clear host *
Output
Router#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         203.0.113.2     YES DHCP   up                    up
GigabitEthernet0/1         192.168.1.1     YES manual up                    up
GigabitEthernet0/2         unassigned      YES unset  administratively down down
Loopback0                  10.255.0.1      YES manual up                    up
Cisco IOS
! configure an interface
configure terminal
interface GigabitEthernet0/1
 ip address 192.168.1.1 255.255.255.0
 no shutdown
 ipv6 address 2001:db8:1::1/64
exit
ip route 0.0.0.0 0.0.0.0 203.0.113.1
ip name-server 1.1.1.1
ip domain-lookup
end
write memory

Status up / Protocol down means the port is enabled but there is no link or keepalive; administratively down means it was shut down in config. Nexus (NX-OS) uses the same show ip interface brief; Cisco ASA uses show interface ip brief.

Juniper Junos

Any shell
show interfaces terse
show interfaces ge-0/0/0 detail
show route
show arp
show system connections
# configure
configure
set interfaces ge-0/0/1 unit 0 family inet address 192.168.1.1/24
set routing-options static route 0.0.0.0/0 next-hop 203.0.113.1
set system name-server 1.1.1.1
commit

MikroTik RouterOS

Any shell
/ip address print
/ip route print
/ip dhcp-client print
/ip dns print
/interface print
/ip arp print
/ip address add address=192.168.1.1/24 interface=ether2
/ip route add dst-address=0.0.0.0/0 gateway=203.0.113.1
/ip dhcp-client add interface=ether1 disabled=no
/ip dns set servers=1.1.1.1,1.0.0.1
/ip dns cache flush

Android

Settings › Network & internet › Internet › (gear icon next to the network) shows IP address, gateway, DNS and MAC. Settings › About phone › Status (or IP address under Wi-Fi details) shows the address without the rest. Android 10 and later randomise the Wi-Fi MAC per network by default; the setting is Privacy › Use randomised MAC on each network.

From a computer with ADB, or from a terminal app such as Termux:

Linux · Terminal
adb shell ip addr show wlan0
adb shell ip route
adb shell getprop | grep dns            # older versions; Android 8+ uses private DNS settings
adb shell dumpsys connectivity | head -50
adb shell dumpsys wifi | grep -E 'mWifiInfo|SSID'
# in Termux (no root needed for these)
ifconfig            # Termux ships net-tools
ip -br addr
curl ipconfig.co.uk/ip

Static addresses: long-press the network › Modify › Advanced › IP settings › Static. Private DNS (DNS-over-TLS) is under Network & internet › Private DNS and applies to every network.

iOS and iPadOS

Settings › Wi-Fi › (i) next to the network shows IP address, subnet mask, router, DNS, and lets you set a manual address or DNS. The Wi-Fi MAC is under the same screen as Wi-Fi Address; Private Wi-Fi Address randomises it per network (on by default since iOS 14). Mobile data addresses are not shown anywhere in Settings; use a browser to visit the IP checker. There is no terminal; apps such as Network Analyzer or iNetTools provide ping, traceroute and port scans. To renew the DHCP lease: (i) › Renew Lease. To reset all networking: Settings › General › Transfer or Reset iPhone › Reset › Reset Network Settings, which forgets every Wi-Fi network and VPN profile.

ChromeOS

Settings › Network › (the network) › Network shows IP, gateway, DNS and MAC, and allows static configuration. chrome://network#state shows the raw Shill state for every interface. The crosh shell (Ctrl+Alt+T) offers ping, tracepath, route and, on recent versions, ipaddrs. With the Linux development environment enabled, the penguin container has ip and you can install net-tools, but it shows the container's address on a private network, not the Chromebook's.

Docker and containers

A container's network namespace is separate from the host's. Most images are minimal and have neither ifconfig nor ip. Ask Docker from the outside instead:

Linux · Terminal
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mycontainer
docker inspect -f '{{.NetworkSettings.Networks.bridge.Gateway}}' mycontainer
docker network ls
docker network inspect bridge
docker container ls --format '{{.Names}}\t{{.Ports}}'
# run a tool inside if the image has it
docker exec mycontainer ip addr
docker exec mycontainer cat /etc/hosts /etc/resolv.conf
# borrow the container's namespace with a toolbox image
docker run --rm -it --network container:mycontainer nicolaka/netshoot ip addr
# or from the host with nsenter
sudo nsenter -t $(docker inspect -f '{{.State.Pid}}' mycontainer) -n ip addr
# read /proc inside a tool-less container
docker exec mycontainer cat /proc/net/fib_trie | grep -B1 '32 host' | grep -v host

The host sees containers on docker0 (172.17.0.0/16 by default) or per-network br-… bridges, with a veth pair for each container. On Docker Desktop for Mac and Windows there is an extra VM in the way, so container addresses are not directly reachable from the host; published ports (-p 8080:80) are the intended path.

Kubernetes

Linux · Terminal
kubectl get pods -o wide                        # pod IPs and nodes
kubectl get svc                                 # ClusterIPs and external IPs
kubectl get nodes -o wide                       # node internal/external IPs
kubectl exec -it mypod -- ip addr               # if the image has it
kubectl exec -it mypod -- cat /etc/resolv.conf  # cluster DNS
kubectl debug -it mypod --image=nicolaka/netshoot --target=app   # ephemeral debug container sharing the pod's namespace
kubectl get endpoints myservice

Podman, LXC, systemd-nspawn

Linux · Terminal
podman inspect -f '{{.NetworkSettings.IPAddress}}' mycontainer
podman network inspect podman
lxc list                                        # LXD: shows IPv4/IPv6 per container
lxc exec mycontainer -- ip addr
machinectl list                                 # nspawn machines
machinectl shell mycontainer /usr/bin/ip addr

WSL (Windows Subsystem for Linux)

Linux · Terminal
ip -br addr                     # inside WSL2: eth0 with a 172.x address (NAT mode)
ip route | grep default         # gateway is the Windows vEthernet (WSL) adapter
cat /etc/resolv.conf            # generated; points at the Windows host by default
ipconfig.exe /all               # Windows tools work from inside WSL
powershell.exe -c Get-NetAdapter
# WSL1 shares the Windows stack: ip addr shows the same addresses as ipconfig

In the default NAT mode, WSL2 gets a new address each time it starts and is not reachable from other machines. Add a netsh interface portproxy rule on Windows, or switch to mirrored networking ([wsl2] section, networkingMode=mirrored in %USERPROFILE%\.wslconfig, then wsl --shutdown), which gives WSL the same interfaces and addresses as Windows. More on WSL adapters →

Home routers

Your router is the one device that knows both your LAN configuration and your public WAN address. The status page is at the gateway address that ipconfig or ip route shows: commonly 192.168.0.1, 192.168.1.1, 192.168.1.254 (BT), 192.168.0.1 (Virgin Media), 192.168.1.1 (Sky, TalkTalk, Plusnet), 10.0.0.1 or 192.168.100.1 (cable modems in bridge mode). Look for Status, WAN, Internet or Device info. Many routers also run SSH or Telnet with a BusyBox shell where ifconfig and ip work; OpenWrt exposes everything through uci show network, ubus call network.interface.wan status and the LuCI web UI.

Related pages

Last reviewed . Command syntax verified against Windows 11, Ubuntu 24.04, macOS 15 and FreeBSD 14 unless noted otherwise.

Spotted a mistake or a switch we have missed? Every page on this site is written to be checked against real output, so please test on your own machine and compare.