1, immediately effective, the changes made after restarting the network service or host failure
A. network card, IP, mask
Network card naming method
Ethernet: EthX
Ifconfig is a network card that is used to view the active status on the current host, and can also be configured, enabled, or disabled for the command
IFCONFIG-A: View all network cards on the host
Ifconfig eth0: View information for eth0 NIC
Specify IP address: ifconfig eth0 192.168.1.1/24
Ifconfig eth0 172.16.10.1/16
Ifconfig eth0 10.0.0.0/8
B. Gateway:
Route
Add: Adding
-host: Host Routing
-net: Network Routing
-net 0.0.0.0
Route add-net|host DEST GW Nexthop
Route add default GW nexthop
Route add-net 10.0.0.0/8 GW 192.168.10.1 #10.0.0.0 via 192.168.10.1
Route add default GW 192.168.10.1
Del: Delete
-host
-net
Route Del-net 10.0.0.0/8
Route Del-net 0.0.0.0
Route del Default
View:
Route
Route-n: Digitally display information about each host or port
2, the configuration will not take effect after the network service or host to restart
Network Service configuration file (permanent)
rhel5:/etc/init.d/network {Start|stop|restart|status}
Rhel6:/etc/init.d/networkmanager {Start|stop|restart|status} But the current function is not perfect, so disable this function, enable the function of RHEL5
A. IP address and subnet hidden code address
Network Interface configuration file:
/etc/sysconfig/network-scripts/ifcfg-interface_name
Device=: The associated device name, to be consistent with the file name's back office "Interface_name"
BOOTPROTO={STATIC|NONE|DHCP|BOOTP}: Boot protocol: To use a static address, use a passive or none:dhcp representation to obtain an address using a DHCP server
Ipaddr=:ip Address
netmask=: Subnet Mask
gateway=: Setting the default gateway
Onboot=: Whether to automatically activate the secondary network interface when powering on
Hwaddr=: Hardware address, to be consistent with the address in the hardware, can save
Userctl={yes|no}: Whether ordinary users are allowed to control this interface
Peerdns={yes|no}: Whether the DNS address specified by the DHCP server is accepted when Bootproto is DHCP
Cases:
# vim/etc/sysconfig/network-scripts/ifcfg-eth0device=eth0hwaddr=00:0c:29:c0:1c:8ftype=ethernetuuid= D63853e2-b0e9-4b15-a21e-a09aeca9212eonboot=no--ONBOOT=YESNM_CONTROLLED=YESBOOTPROTO=DHCP-BOOTPROT O=static--ipaddr=192.168.1.21-netmask=255.255.255.0
B. Gateway address, configuring host name
# vim/etc/sysconfig/networknetworking=yeshostname=localhost--Hostname=user-->gateway =192.168.1.254
c. DNS Configuration
The DNS server specifies only one method:
Edit/etc/resolv.vonf
NameServer dns_tp_1
NameServer dns_tp_2
NameServer 172.16.0.1
NameServer 202.102.224.68
Cases:
# vim/etc/resolv.conf--NameServer 192.168.1.254
Restart the network after the configuration is complete to connect to the Internet
# Service Network Restart #重启网络
This article is from the "three elder brother" blog, please be sure to keep this source http://523958392.blog.51cto.com/9871195/1631346
Linux Network configuration