I. How to configure the Host Name:
1./etc/sysconfig/network
NETWORKING = yes (disable the network function)
NETWORKING_IPV6 = no (disable ipv6)
HOSTNAME = localhost. localdomain (set host name)
It cannot take effect immediately after the configuration is complete.
You can restart the network service:
Service network restart
/Etc/init. d/network restart (same effect as above)
2. view the/proc/sys/kernel/hostname file by hostname
Echo "exlinux.example.com">/proc/sys/kernel/hostname
/Proc/sys/kernel/hostname this file cannot be opened with vim, but only the redirection method can be used
Upload content to it.
II. Four methods to configure Nic information:
1.
System-config-network-gui display gui
Ethx --> Ethernet NIC
Pppx --> ppp Nic
Ppp0, ppp1 ,...
FQDN: Full Qualified Domain Name (Full Domain Name)
2. setup
System-config-network-tui
Configure the nic and dns in the image
3.
/Etc/sysconfig/network-scripts/ifcfg-eth
DEVICE = eth0 (NIC)
HWADDR = (NIC mac address)
BOOTPROTO = {dhcp | bootp | static | none} (address acquisition method)
IPADDR = (IP address)
NETMASK = (subnet mask)
GATEWAY = (Default GATEWAY)
ONBOOT = {yes | no} whether to start after adjustment
USERCTL = {yes | no} whether to allow common users to set the NIC (usually no)
PEERDNS = {yes | no} is used when the boot protocol is dhcp or bootp. If it is set to no
The dhcp Service or bootp service cannot change the host's dns configuration.
(Bootp is the predecessor of dhcp, but it does not have the lease function)
Disable an ifdown Device
Ifup enabled device
Ifdown eth0 & ifup eth0 (if disabled successfully, enable it)
4.
Ifconfig ethX IP/NETMASK)
Service network restart becomes invalid
Neither method 3 nor Method 4 can configure dns
3. How to configure dns:
Vim/etc/resolv. conf set dns here
Search followed by search domain
Eg: search a.com
A.com is automatically added when you ping www.
Nameserver dns server address
At most one domain name corresponds to three
4. How to add a gateway:
Route add-host IP gw GATEWAY
Route add-net NETWORK/NETMASK gw GATEWAY
Route add-net 0.0.0.0/0.0.0.0 gw GATEWAY
Route add default gw GATEWAY (add default GATEWAY)
5. How to delete route information:
Route del-host IP
Route del-net NETWORK/NETMAS
This article is from the "Wei's Linux bar" blog