Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?
Advertisement: The OpenBSD PF Packet Filter Book: PF for NetBSD, FreeBSD, DragonFly and OpenBSD

BSD Links
·New Links
·User Groups

This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at

Determine the current TCP/IP settings on a system


Be able to determine a system's IP address(es), subnet mask, default gateway, primary and secondary DNS servers and hostname.


If you are a BSD user/administrator you must understand where and how you can get any information about a system such as its network settings. What interesting information about a network can we get from the system? We can obtain its IP address, default gateway, the DNS server, the MAC address of any network interface on the system and other relevant information related to networking.

TODO: show "hostname" tool

TODO: some BSDs have "route show" or "route get" ...


Let's start from IP address and MAC address. We can get this kind of information from ifconfig -a command. For example

wi0: flags=8802 <BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ether 00:05:3c:08:8f:7e
        media: IEEE 802.11 Wireless Ethernet autoselect (none)
        status: no carrier
        ssid "" channel 1
        stationname "FreeBSD WaveLAN/IEEE node"
        authmode OPEN privacy OFF txpowmax 100 bmiss 7
        inet netmask 0xffffff00 broadcast
        ether 00:09:6b:13:42:9f
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049 <UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 ::1 prefixlen 128 
        inet netmask 0xff000000

As we can see the fxp0 interface has IP (/24 means that the network mask is - ffffff00), broadcast address, MAC address 00:09:6b:13:42:9f and 100baseTX full-duplex connection to the switch. Also the system has a wifi interface wi0 and also lo0 - the loopback interface.

Next step is to determine the DNS servers and default route.

#netstat -rn
Routing tables

Destination        Gateway            Flags    Refs      Use  Netif Expire
default          UGS         0      919   fxp0          UH          0        0    lo0
192.168.1          link#2             UC          0        0   fxp0        00:13:46:56:cf:15  UHLW        2        0   fxp0   1178

That means that the default gateway IP is

> cat /etc/resolv.conf

resolv.conf has IP addresses of DNS server. For this example the system will first try to resolve DNS name with, secondly with system will really try to resolve DNS name with hosts file, if the name is not in the hosts file system (hosts.conf) try to resolve it with a DNS server). You can edit resolv.conf on the fly.

Some times system have some static route for hosts on the network. For save this you can use rc.conf file. And you can update routes on the fly. For example, if you need change default route. Let's try changing the default route:

# route flush
default              done
# route add
add net gateway

Route flush means that you want flush all routes on your system, instead of this you can use the route delete command (look at the manual for your system). route add means that you want add route for network - all networks(also you can do it like that route add default and it's IP for your default router.

Practice Exercises

  1. Try to access your DNS-servers.
  2. List the IP addresses of each interface, the default router, list the DNS servers.
  3. Log into your system and verify that the DNS servers correspond to that of your ISP or your own.
  4. Log into your system and verify that you have a valid, IP address and default gateway.

More information

ifconfig(8), netstat(1), resolv.conf(5), route(8), hostname(1)

Front | Information | Lists | Newsfeeds