Basic network connection and setting method on RedHat system


Before starting the explanation of this chapter, it is specially stated that since there is no need to configure IPv6 in the operation and maintenance work for so many years, we will not explain IPv6 too much here.
1、 Linux graphical network configuration
The simplest way to configure networking in Red Hat Linux is to use the graphical configuration tool network connections application. It can be configured to activate specific network interfaces (VPN, etc.) only when a specific user logs in.
The configuration steps are as follows:
Open network connections (Figure 1)
20151215115714628.jpg (1280×746)

Double click the existing network connection system eth0 (as shown in Figure 2). If not, click the Add button on the right to add
20151215115733029.jpg (1284×767)

Enter the edit page and click IPv4 settings to enter IPv4 settings (as shown in Figure 3)
20151215115751358.jpg (1284×772)

The default network connection mode is DHCP. Now it is changed to manual (you need to know the whole network segment and gateway first, as shown in Figure 4)
20151215115817919.jpg (1295×778)

Click Add to add the IP address (as shown in Figure 5)
20151215115842142.jpg (1290×781)

Since my environment is a virtual machine, I configure it according to the network segment of the virtual machine. When you configure, you can set it according to your own situation. (Fig. 6)
20151215115911745.jpg (1287×773)

Click apply to enter the root password to complete the setting (as shown in Figure 7)
20151215115928613.jpg (1287×776)

2、 Linux command line network configuration
After finishing the configuration of graphical interface, we have to introduce the command-line network configuration, because in our daily work, there are few opportunities to use the graphical interface configuration. In most cases, the text command line interface is used for configuration.
Command line configuration, you need to remember two files
1. File to modify DNS settings

Copy code

The code is as follows:


resolv.conf Just change the nameserver parameter
Examples are as follows:

Copy code

The code is as follows:

vi /etc/resolv.conf

# Generated by NetworkManager

2. Files for modifying network configuration parameters
The file / etc / sysconfig / network scripts / ifcfg-eth0 is in the directory / etc / sysconfig / network script. The script file (control file) of network interface (network card) is stored in this directory. Ifcfg-eth0 is the first network interface by default. If there are multiple network interfaces in the machine, the name will be the same as ifcfg-eth1, ifcfg-eth2, Ifcfg-eth3… (the file in this is very important, which involves whether the network can work normally).
====Setting form: set value = value====
The set items are as follows:
*Device interface name (device, network card)
*Userctl [yes| no] (whether non root users can control the device)
*Bootproto IP configuration method [none | static | BOOTP | DHCP | static allocation IP | BOOTP protocol | DHCP protocol during boot)
*Hwaddr MAC address
*Onboot: whether the network interface is valid when the system is started (yes / no)
*Type network type (usually Ethernet)
*Netmask netmask
*IPADDR IP address
*Whether IPv6 init IPv6 is valid (yes / no)
*Gateway – default gateway IP address
*Broadcast broadcast address
*Network address
====Refer to the following example====

Copy code

The code is as follows:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Note: the above contents are listed for example only. The specific network configuration needs to be modified according to the specific situation of the machine.
3. Linux common network view command
Ifconfig to view the current network configuration
Ping to view the current channel condition
Netstat, check the network
See Figure 8 for the correct return contents of the above commands in the network configuration, and see Figure 9 for the return contents of the configuration errors
20151215120021198.jpg (1281×769)

20151215120039624.jpg (704×395)

4. IP, with the route parameter, you can view the current routing situation, as shown in Figure 10
20151215120054390.jpg (1292×778)