First, Shell mode
1. Configure the IP address of the eth0 and activate the device at the same time
sudo ifconfig 192.168. 1.10 255.255. 255.0 up
This command fails after a reboot
2. Add Default gateway
sudo 192.168. 1.1
3. Configure DNS
sudo vi /etc/202.96. 134.133 202.96. 128.68 202.96. 128.166
4. Other commands
ifconfig eth0 up #激活设备 ifconfig eth0 down #禁用设备
second, the way to modify the file
Network configuration related files in the/etc/sysconfig/network-scripts/ifcfg-eth0 directory
Where Ifcfg-lo is the default profile for the local network card, Ifcfg-eth0 is the profile for the eth0 NIC.
View Ifcfg-eth0:
Cat /etc/sysconfig/network-scripts/ifcfg-eth0
To configure the Ifcfg-eth0 file:
VI /etc/sysconfig/network-scripts/ifcfg-eth0
In the Ifcfg-eth0 file:
Device: Physical Device Name
Type: Configure the file interface types. There are various network configuration files in the/etc/sysconfig/network-scripts/directory, such as Ethernet, IPSec and so on, the network interface type is Ethernet
UUID: Globally unique identifier, which only takes effect within the system
Onboot: Whether the device is activated at boot time, whether it is powered on or not
Nm_controled: Whether the device can be hosted by the Network Manager graphical management tool
Bootproto: The device uses the No/manual DHCP/BOOTP/DHCP protocol
Hwaddr:mac Address
Ipaddr:ip Address
PREFIX: Subnet mask bits, typically 24-bit, both 255.255.255.0
Gateway: Gateways Address
Defroute: is set as the default route
Ipv4_failure_fatal: If the IPV4 is not successfully activated, the entire device fails in the case of both IPV4 and IPV6 settings
Ipv6init: Whether to enable IPV6
Name: Names of network interfaces
NETMASK: Subnet Mask
DNS2:
DNS1:
Userctl: Whether to allow non-root users to control the device
Third, GUI mode
Access to the Network Manager Graphics management tool
System-config-network
Linux Network configuration