|Description||Querying vital networking settings and determining the basic requirements for a computer on a Local Area Network (LAN).|
Key Knowledge Areas:
- Internet, network, routers.
- Domain Name Service.
- Network configuration.
The following is a partial list of the used files, terms and utilities:
- IPv4, IPv6.
Nice to know:
Our Linux device, (PC, laptop, server, handheld), can connect to the network uisng IP, the Internet Protocol. For years this has been just IP or what people now call IPv4 and this is still the most common way of connecting to networks. IPv6 is in use now and at some stage in the not to disatant future we sill see this taking over from IPv4. For the moment we will start with IPv4.
An IPv4 address would look similar to this: 192.168.1.100 , the address is written in what we call a dotted decimal format that represents 32 bit address space. Along with the address there is something called the subnet mask, this identifies which part of the address represents the networks and what part the host. In the simplest forms having a subnet mask of 255.255.255.0 applied to the previous IP address would give us a network of 192.168.1.0 and a host 100 on that network. If a host is on the sane network as the originating device communication can happen directly; if it is seen as being on a different network then, usually this would mean that communication would be mediated by the default gateway or router on the network. An IP Address and subnet mask are required, the default gateway is optional.
To display the IP address configuration of a host we can use the tools ifconfig or ip. Traditionally Linux and UNIX administrators have become used to using ifconfig (/sbin/ifconfig) to both display and set an IP address. As this is in the sbin directory it may not be in the PATH variable for standard users and as such becomes and admin only tool even for just displaying information. To display information for the first ethernet card, etho use the command:
You see the output from the command in the following screenshot from one of my machines:
You can use ifconfig to both display and set address information. Permanent address configuration has to be made through configuration files not with commands like ip or ifconfig.
The new kid on the block is ip, (/sbin/ip), this can be used to display address configuration with:
ip address show eth0
This can be abbreviated to :
ip a s eth0
Again it can be used to configure the address as well as displaying it, like ifconfig these changes are not persistent if not made in the configuration files for the network interface. Although the command is in the /sbin directory there is also a symbolic or soft link in the /bin making it easily accessible to standard users who can use it to display information.
The real winner with the ip command is that it can be used to manage more than just the ip address, routes links, multicast addresses, ARP tables and more can be managed with ip.
- ip route show
- ip neighbor show
- ip maddr show
- ip link show
Much more of a swiss-army knife than ifconfig.
The IP address configuration can be STATIC or DYNAMIC , client computers are often configured with dynamic addresses from a DHCP or Dynamic Host Control Protocol , servers are often configured with static addresses. With a dynamic address you can, for example, connect your android phone to your WiFi network at home to gain internet access, connecting to the internet at your favourite coffee is just as easy, no changes to the configuration is required as the assignment is dynamic, the address, subnet mask and default gateway comes from the DHCP server on each network you connect to.
Like ifconfig the command route (/sbin/route), is the tradition command used in UNIX and Linux to display route information for a host. Both ip route show and the command route on its own will display the route table on the host. Usually the most important route is the default route, if no other route can be found to a network the default route is used.
The host will be configured with and IP Address but mainly users will find it easier to access hosts using DNS names (Domain Name Server), this way we can access our favourite websites with just a name, www.theurbanpenguin.com, rather than having to know its address. The system has to be configured with the Ip address of the DNS server or servers. This is most often in the file /etc/resolv.conf. The file uses the nameserver directive followed by the address of the server. The address of the servers can be delivered by DHCP for dynamically configured hosts.