|Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?|
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 http://bsdwiki.reedmedia.net/wiki/Determine_the_current_TCP--IP_settings_on_a_system.html.
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
As we can see the fxp0 interface has IP 192.168.1.162/24 (/24 means that the network mask is 255.255.255.0 - ffffff00), broadcast address 192.168.1.255, 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.
That means that the default gateway IP is 192.168.1.1.
resolv.conf has IP addresses of DNS server. For this example the system will first try to resolve DNS name with 192.168.1.1, secondly with 10.2.2.1(The 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 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 0.0.0.0 means that you want add route for 0.0.0.0 network - all networks(also you can do it like that route add default 192.168.1.1) and 192.168.1.1 it's IP for your default router.
ifconfig(8), netstat(1), resolv.conf(5), route(8), hostname(1)