Learn Linux Series (#1) - TCP/IP Computer Adaptation
Learn Linux Series (#1) - TCP/IP Computer Adaptation
What Will I Learn?
- You will learn how to prepare a computer to work in a TCP / IP network
- What a TCP / IP network is
- How to configure DNS
- Getting to know the principles of operation of the 'hosts' file
- How to set the IP address and other network parameters for the card
Requirements
- Linux system installed
- Basic knowledge of terminal operation
- Average knowledge of linux commands
- Motivation when something goes wrong
Difficulty
Intermediate
Learn Linux Series (#1) - TCP/IP Computer Adaptation
- What a TCP / IP network is
TCP / IP (Transmission Control Protocol / Internet Protocol) - Network protocol - or more precisely a set of protocols - used in the Internet; the Unix systems most often use it.
TCP / IP is more vulnerable to security breaches due to its open, "trustworthy nature".
Its task is to divide the information into appropriate size packets, number them, so that the recipient can check whether all packages have arrived and set them in the right order.
Individual parts of information are inserted into TCP envelopes, which in turn are placed in IP envelopes.
On the recipient's side, the TCP software collects all envelopes and reads the sent data.
If an envelope is missing, it will need to be sent again.
Packets are sent by computers without checking if the path is free.
Therefore, it may happen that more packages come to the specified network node in which the router is located, than the device is able to segregate and send further.
- How to prepare a computer to work in a TCP / IP network
Help for people with little knowledge:
sudo - executing a command with administrator privileges
nano - text file editor
All configuration data is stored in the /etc/ directory and its subdirectories.
You should already have a network card installed, i.e. have configured network adapter modules.
You can check it by writing in the terminal:
cat /etc/modules.conf
There should be a line like:
alias eth0 xxxx
- It's time to set the IP address and other network parameters for the card.
To do this, edit the file
/etc/sysconfig/network-scripts/ifcfg-eth0
This file should contain a configuration similar to the following example:
DEVICE=eth0 BOOTPROTO=static BROADCAST=192.168.1.255 IPADDR=192.168.1.X NETMASK=255.255.255.0 NETWORK=192.168.1.0 ONBOOT=yes
This means that the eth0 device has a static (fixed) IP address 192.168.1.X (enter your address here), a subnet mask of 255.255.255.0, belongs to the 192.168.1.0 network having Broadcast 192.168.1.255.
The last line informs us that the card should be automatically launched at the system startup.
Edit the file:
/etc/sysconfig/network
enter the data like this:
NETWORKING=yes HOSTNAME=host_name GATEWAY=192.168.1.1
This file contains the name of your host and the IP address of the gate, that is 192.168.1.1- How to configure DNS
We have to edit file:
/etc/resolv.conf
by adding there:
search utopian.io nameserver 192.168.1.1 nameserver 194.204.159.1 nameserver 194.204.152.34
this file contains a list of DNS addresses.
You have to start the network card with the new settings.
Write in terminal:
ifconfig eth0 up
- principles of operation of the 'hosts' file
/etc/hosts
The 'hosts' file includes changing IP addresses to computer names as well as aliases for these names.
In practice, this file is used only if our network does not have its own name server (DNS).
Lines of this file should consist of a records:
IP host_name 174.138.105.129 utopian
Important information (useful for learning):
The most important configuration files responsible for network operation are:
/etc/sysconfig/network /etc/HOSTNAME /etc/hosts /etc/services /etc/host.conf /etc/resolv.conf
For configuring network interfaces we can use ifconfig syntax:
ifconfig interface address_ip netmask broadcast <request_address>
ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
The interface can be temporarily turned off and reactivated without having to be reconfigured.
The following commands are used to disable and enable interfaces:
ifconfig interface down - disabling the interface ifconfig interface up - starting the interface
Network File
/etc/sysconfig/network
The network file contains basic information about the network configuration, such as:
NETWORKING - <YES> if our host is on the network or <NO> if not HOSTNAME - <host name> DOMAINNAME - <domain name> GATEWAY - <network gateway address> GATEWAYDEV - <device name that supports the network gateway>
/etc/services
The services file contains the mappings of the network services names to the port numbers used by the computer to service the service.
This file consists of rows, each of which is one information record.name port / protocol aliases # comment
www 80/tcp http # WWW
where:
name - means the word representing the described service port - is the number specifying the port number under which the given service will be available protocol - the name of the TCP or UDP protocol aliases - specify other names under which the service will be available
/etc/host.conf
The host.conf file contains data about the order in which the system should poll various name resolution systems (DNS, NIS) when resolving the network name.
order - specifies the order in which name resolution systems are polled and can consist of the following options: bind (DNS), hosts (/etc/hosts), nis (NIS) multi - determines whether the query addressed to the name resolution system returns only one result - off, or can it return a few - it
/etc/resolv.conf
The resolv.conf file is the DNS client configuration file.,br> It specifies the order in which domains are searched and contains the addresses of name servers.
nameserver - specifies the DNS server address domain - specifies the domain name to which the computer belongs search - specifies the order in which domains are searched
Posted on Utopian.io - Rewarding Open Source Contributors
- How to prepare a computer to work in a TCP / IP network
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
thank you very much. I appreciate your contribution to the development of utopian.
I really liked your article, I count on more about linux.
Regards Peancy.! :*
Hey @vitusc I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Nice tutorial series!