Basic network configuration
NIC configuration parameters
- /etc/sysconfig/network-scipts/ifcfg-IFACE
- TYPE = interface type, there are common Ethernet, Bridge
- NAME=ens33
- DEVICE = device name
- ONBOOT = whether to activate the boot from the network interface card (yes | no)
- UUID = uniquely identifies the device
- IPV6INIT = whether to initialize IPv6
- BOOTPROTO = activated when the interface using what protocol to configure this interface attributes; DHCP (automatically assigned), bootp (automatically assigned), static (Static), none (static)
- IPADDR = IPv4 address
- PREFIX = mask length
- GATEWAY = default gateway
- DEFROUTE = is the default route using the interface
- First DNS server DNS1 =
- Alternate DNS server DNS2 =
- DOMAIN = DNS search domains
- USERCTL = normal user to control whether to allow the device
- If PEERDNS = dhcp BOOTPROTO value, whether to allow allocation dhcp dns dns specify manually directed pointing cover
- NM_CONTROLLED = whether to use NetworkManager service control interface
HWADDR = MAC address of the device
Set non-default routing
- /etc/sysconfig/network-scripts/route-IFACE
- 1) a route entry in every row
TARGET via GW
Example:172.20.2.0/24 via 172.20.1.253
2) a routing entry every third row represents a number #
ADDRESS#=TARGET NETMASK#=MASK GATEWAY#=NEXTHOP ``` 示例: ``` ADDRESS0=172.20.2.0 NETMASK0=255.255.255.0 GATEWAY0=172.20.1.254
- 1) a route entry in every row
A plurality of address interface configuration:
1) Use ifconfig
ifconfig IFACE_LABEL ADDRESS NETMASK ifconfig ens33:1 172.20.2.11/24
2) Use ip
ip addr add IFADDR dev IFACE label NAME ip addr add 172.20.3.11/24 dev ens33 label ens33:2
3) using a configuration file
DEVICE=ens33:1 BOOTPROTO选项只能为静态 static none
4) Use nmcli command ( not recommended ).
nmcli connection modify ens37 +ipv4.addresses "172.20.3.121/24" nmcli con down ens37 nmcli con up ens37