Nic configuration file cd/etc/sysconfig/network-s [tab] ifcfg-eth0 first Nic configuration ifcfg-eth1 second .... DEVICE = eth0 # configure the network card. The first network card of eth0 is HWADDR = 08: 00: 27: 49: 57: 1c # the mac address bound to the network card, in this line, we 'd better delete NM_CONTROLLED = yes # I don't know ONBOOT = yes # whether to use this configuration IPADD
Nic configuration file
Cd/etc/sysconfig/network-s [tab]
Configuration of the first Nic In the ifcfg-eth0
The second piece of ifcfg-eth1 ....
DEVICE = eth0 # configure the network card. eth0 is the first network card.
HWADDR = 08: 00: 27: 49: 57: 1c # the mac address bound to the NIC. It is best to delete this line.
NM_CONTROLLED = yes # No
ONBOOT = yes # whether to use this configuration
IPADDR = 192.168.100.1 # IP Address
BOOTPROTO = none # static or dynamic
NETMASK = 255.255.255.0 # Subnet Mask
TYPE = Ethernet # Ethernet TYPE
GATEWAY = 192.168.100.254 # GATEWAY
DNS1 = 192.168.100.1 # dns address
IPV6INIT = no # ipv6 initialization
USERCTL = no # unknown
Standard Nic Configuration
Static Configuration
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
IPADDR = 192.168.100.1
NETMASK = 255.255.255.0
GATEWAY = 192.168.100.254
DNS1 = 61.134.1.4 # DNS address, starting with RHEL6
DNS2 = 218.30.19.50
Dynamic acquisition
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = dhcp
Run
Service network restart takes effect for the modified Nic File
View ip
Ifconfig
DNS Configuration
Vi/etc/resolv. conf edit dns configuration file
Nameserver 61.134.1.4 # direct the computer's dns
Use linux as a router
Vi/etc/sysctl. conf edit the Kernel configuration file
Net. ipv4.ip _ forward = 0
Change
Net. ipv4.ip _ forward = 1
Net. ipv4.ip_forward is the routing function, 0 is disabled, 1 is enabled
Sysctl-p makes the modification take effect.
Static route command route
Route add-net 200.200.200.0 netmask 255.255.255.0 gw 192.168.100.2
Add to 200.200.200.0, And the next hop of the network segment with mask 255.255.255.0 is 192.168.100.2.
Route del-net 200.200.200.0 netmask 255.255.255.0 gw 192.168.100.2
Delete to 200.200.200.0, And the next hop of the network segment with a mask of 255.255.255.0 is 192.168.100.2.
Dynamic Routing (provided by zebra)
Ctrl + c terminate command
Traceroute ip address hop count (number of routes from the local ip address to the target ip address)
Hostname
Nslookup dns test