Professional Documents
Culture Documents
This article covers the main TCP/IP network configuration files used by Linux to configure various network services of the system such as IP Address, Default Gateway, Name servers -
DNS, hostname and much more. Any Linux Administrator must be well aware where these services are configured and to use them. The good news is that most of the information
provided on this article apply's to Redhat Fedora, Enterprise Linux, CentOS, Ubunto and other similar Linux distributions.
On most Linux systems, you can access the TCP/IP connection details within 'X Windows' from Applications > Others > Network Connections. The same may also be reached
through Application > System Settings > Network > Configure. This opens up a window, which offers configuration of IP parameters for wired, wireless, mobile broadband, VPN and
DSL connections:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/networking/devices/ifcfg-eth0
/etc/resolv.conf
/etc/hosts
https://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/851-linux-services-tcpip.html 1/5
The static host IP assignment is saved in /etc/hosts
08/06/2022 16:32 Working with Linux TCP/IP Network Configuration Files
IP assignments for all the devices found on the system are saved in the ifcfg-<interface> files mentioned above.
If you want to see all the IP assignments, you can run the command for interface configuration:
# ifconfig
The command ifconfig is used to configure a network interface. It can be used to set up the interface parameters that are used at boot time. If no arguments are given, the command
ifconfig displays the status of the currently active interfaces. If you want to see the status of all interfaces, including those that are currently down, you can use the argument -a, such as -
# ifconfig -a
Fedora, Redhat Enterprise Linux, CentOS and other similar distributions supports user profiles as well, with different network settings for each user. The user profile and its parameters
are set by the network-configuration tools. The relevant system files are placed in:
/etc/sysconfig/netwroking/profiles/profilename/
After boot-up, to switch to a specific profile you have to access a graphical tool, which will allow you to select from among the available profiles. You will have to run:
https://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/851-linux-services-tcpip.html 2/5
$ system-config-network
08/06/2022 16:32 Working with Linux TCP/IP Network Configuration Files
route - Used to set static routes and view the routing table
hostname - Necessary for viewing and setting the hostname of the system
netstat - Flexible command for viewing information about network statistics, current connections, listening ports
mii-tool - Used to set the interface parameters at data link layer (half/full duplex, interface speed, autonegotiation, etc.)
Many distro are now including the iproute2 tools with enhanced routing and networking tools:
ip - Multi-purpose command for viewing and setting TCP/IP parameters and routes.
tc - Traffic control command, used for classifying, prioritizing, sharing, and limiting both inbound and outbound traffic.
Ethernet cards are used to connect to the world external to the computer, usually named eth0, eth1, eth2 and so on.
/etc/sysconfig/nework-scripts/ifcfg-lo
/etc/sysconfig/nework-scripts/ifcfg-eth0
# less /etc/sysconfig/network-scripts/ifcfg-lo
https://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/851-linux-services-tcpip.html 3/5
Which results in:
08/06/2022 16:32 Working with Linux TCP/IP Network Configuration Files
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
# less /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=00:0C:29:52:A3:DB
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.18
PREFIX=24
GATEWAY=192.168.1.11
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
# ifconfig eth0 up
https://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/851-linux-services-tcpip.html 4/5
The ifup & ifdown command can also be used to start and stop network interface cards:
08/06/2022 16:32 Working with Linux TCP/IP Network Configuration Files
# ifup eth0
# ifdown eth0
The systemctl commands can also be used to enable, start, stop, restart and check the status of the network interface services -
# hostname
Gateway
You can change the hostname by giving the new name at the end of the command -
# hostname Firewall-cx
This will change to the new hostname once you have logged out and logged in again. In fact, for any change in the interfaces, the change is implemented only after the user logs in the
next time after a log-out.
https://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/851-linux-services-tcpip.html 5/5