Before beginning to explain the content of this chapter, special statement, because so many years of operation and maintenance has never met the requirements of configuration IPv6, so here is not for IPv6 do too much explanation.
Linux Graphical network configuration
The easiest way to configure networking in red Hat Linux is to use the graphical Configuration tool to network connections applications. It can set a system-wide default value that affects all users, or it can be configured to activate a specific network interface (VPN, etc.) only when a specific user logs on.
The configuration steps are as follows:
Open Network Connections (Figure 1)
Double-click an existing network connection system eth0 (Figure 2), and if not, add the right Add button
Enter the edit page, click IPv4 Settings, and enter the IPV4 setting (Figure 3)
The default network connection is DHCP, which is now changed to manual manual (you need to understand the entire network segment and gateway first, as shown in Figure 4)
Click Add to add an IP address (Figure 5)
Because my environment is a virtual machine, so I was configured according to the network segment of the virtual machine, you can configure the time set according to their own circumstances. (Figure 6)
Click Apply to enter the root password to complete the setup (Figure 7)
Second, Linux command line network configuration
After finishing the configuration of the 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 configured.
Command line configuration, you need to remember two files
1, modify the DNS settings file
Copy Code
The code is as follows:
/etc/resolv.conf
Resolv.conf only need to modify nameserver parameters
Examples are as follows:
Copy Code
The code is as follows:
Vi/etc/resolv.conf
# Generated by NetworkManager
NameServer 192.168.159.2
2, modify the network configuration parameters of the file
/etc/sysconfig/network-scripts/ifcfg-eth0
File/etc/sysconfig/network-scripts/ifcfg-eth0 is located under this directory in/etc/sysconfig/network-script, which is a script file (control file) for network interface (NIC). Ifcfg-eth0 is the default first network interface, and if there are multiple network interfaces in the machine, then the name will be ifcfg-eth1,ifcfg-eth2,ifcfg-eth3 ... (This file is very important to the network can work properly).
= = = = Value = = = = = = = = = = = = =
The project project is set as follows:
*device Interface Name (device, network card)
*userctl [Yes|no] (whether a non-root user can control the device)
*bootproto IP Configuration method [None|static|bootp|dhcp] (does not use protocol at boot time |) static allocation ip| BOOTP protocol | DHCP protocol)
*hwaddr MAC Address
*onboot the network interface is active when the system is started (yes/no)
*type network type (usually Ethemet)
*netmask Network Mask
*IPADDR IP Address
*ipv6init IPV6 is valid (yes/no)
*gateway Default gateway IP address
*broadcast Broadcast Address
*network Network Address
= = = = = = can refer to the example below
Copy Code
The code is as follows:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Bootproto=static
broadcast=192.168.1.255
Hwaddr=00:0c:2x:6x:0x:xx
ipaddr=192.168.1.23
netmask=255.255.255.0
network=192.168.1.0
Onboot=yes
Type=ethernet
Note: The above content is only for example, the specific network configuration needs to be modified according to the specific circumstances of the machine.
3, Linux common Network View command
Ifconfig, view current network configuration
Ping to view current access conditions
Netstat, view the network situation
The above command in the network configuration of the correct return content see (Figure 8), the configuration error return details see (Figure 9)
4. IP, with route parameters, you can view the current routing situation, as detailed in (Figure 10)