Configure host name (fixed and temporary), local resolution, modify NIC configuration information, modify DNS
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; Vertical-align:top;border:none; "/> Host name
[Email protected] root]$ cat/etc/sysconfig/network networking=yes Hostname=clinet.clientdoman # Where the host name is client
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; Vertical-align:top;border:none; "/>ip address and host name resolution
[[email protected] root]$ tail-1/etc/hosts 192.168.1.100 client.clientdoman client #网络IP地址 hostname or domain name [host alias]
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; vertical-align:top;border:none; "/> Network card address (the quotation marks inside can also not be used)
[[email protected] root]$ cat /etc/sysconfig/ Network-scripts/ifcfg-eth0 device= "eth0" # --device name bootproto= "None" # --how to get an address dhcp news static Static <none> hwaddr= "00:0C:29:26:F2:B9" #--mac address < identity Network Name Mapping Mac--eth0 > nm_controlled= "Yes"-#--networkmanager network management onboot= "Yes" #---on whether to start the NIC type= "Ethernet" # ---Ethernet ipaddr=192.168.0.10 #---Configure static addresses netmask=255.255.255.0 #-subnet Mask [[Email protected] root] $service network restart # Restart the network for it to take effect
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; Vertical-align:top;border:none; "/>dns configuration
File format:
DomainName Domain Name
Search domain
NameServer primary_dns_server_ip_address
NameServer second_dns_server_ip_address
"Search domainname.com" means that when a hostname is provided that does not include a full domain name, the suffix of the domainname.com is added after the host name, and "nameserver" means that the host specified when resolving the domain name is the domain name server. Where the name servers are queried in the order in which they appear in the file. where domainname and search can exist at the same time, there can be only one; nameserver can specify multiple
[Email protected] etc]# cat/etc/resolv.conf |grep-v ^# search Clientdoman nameserver 61.144.56.100 nameserver The file may fail after 61.144.56.101# restart, so the command can be locked: [[email protected] etc]# chattr +a/etc/resolv.conf
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; vertical-align:top;border:none; "/> Test
[[email protected] etc]# nslookup #验证DNS > server default server: 61.144.56.100 address: 61.144.56.100#53 default server: 61.144.56.101 address : 61.144.56.101#53 [[email protected] etc]# ping 192.168.1.1 #测试与网关连通情况 ping 192.168.1.1 (192.168.1.1) 56 (+) bytes of data. 64 Bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=12.1 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.61 ms
650) this.width=650; "src=" Http://img.baidu.com/hi/face/i_f42.gif "alt=" I_f42.gif "style=" padding:0px;margin:0px; Vertical-align:top;border:none; "/> Sub-interface configuration
When you need two segments in your network, you need to configure sub-interfaces, noting that there can be only one network segment gateway.
Turn off network management, copy the configuration file of the interface, rename, address and other information, and then restart can be generated. Check the gateway, route, complete
[[email protected] etc]# /etc/init.d/networkmanager stop #关闭网络管理功能 stopping networkmanager daemon: [ ok ][[email protected] etc]# chkconfig networkmanager off[[email protected] etc]# cd /etc/sysconfig/network-scripts[[email protected] network-scripts]# cp ifcfg-eth1 ifcfg-eth1:0[[email protected] network-scripts]# vim ifcfg-eth1:0 device=eth1:0 bootproto=none nm_controlied=no onboot=yes type=ethernet ipaddr= 192.168.2.100 gatewAy=192.168.2.1 netmask=255.255.255.0 569 service network restart # Restart Network 570 ping 192.168.2.1 #测试网关 571 ping 8.8.8.8 #测试外网 572 ping www.qq.co #测试DNS
Linux Network configuration