First, the basic knowledge of the network
1) Classification of IP addresses
Class A: 1-126 networks, 127 for the loopback address, can accommodate the host is: 2^24-2, the host bit 0 and all 1 for the network address and broadcast address range is: 1-126 Class B: 2^14 network, the number of hosts in each network 2^16-2, The address range is: 128-191C class: 2^21 network, each network host makes the number is 2^8-2, the address range is: 192-223
2) Private address range
Class A: 10.0.0.0/255.0.0.0 Class B: 172.16.0.0/255.255.0.0-172.31.0.0/255.255.0.0 Class C: 192.168.0.0/ 255.255.255.0-192.168.255.0/255.255.255.0
3) Iso/osi seven-layer model
Network Basics: TCP/IP (Layer five model): Physical layer: Physical medium for transmitting signal link layer: Mac from device to device host communication, MAC address, Ip<-->mac (Arp/rarp), MTU: Maximum Transmission Unit network layer: IP packet, Communication from the source host to the target host, IP address, IP message Transport layer: TCP/UDP, communication from the source host process to the target host-specific process, TCP/UDP application layer: Various data, and application Iso/osi: Seven layer physical layer: physical Medium, For transmission signal link layer: Mac from device to device host communication, MAC address, Ip<-->mac (Arp/rarp), MTU: Maximum Transmission Unit network layer: IP packet, communication from source host to target host, IP address, IP message Transport layer: TCP/UDP , from the source host process to the target host-specific process communication between the TCP/UDP session layer: Session information, Sessions presentation layer: Expression Application layer: various data, and application interaction TCP: There is a connection protocol, establish a logical connection SYN, ACK, FIN, RST, PSH, Urg Three-time handshake: syn=1, ack=0, fin=0 syn=1, ack=1, fin=0 syn=0, Ack=1, fin=0 four disconnects:
Second, network configuration
Configuration: 1) statically specify Ifcfg family: ifconfig: Configure Ip,netmask route: Configure routing netstat: View status information Ip route2 family: ip object: &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;IP&NBSP;ADDR: Address and mask ip Link: interface ip route: Routing ss: State Statistics Tool CENTOS7:NM (Network mamager) Family nmtui: Add an image interface such as a NIC with host name and its IP address nmcli:text window Tools Note: 1) DNS server designation configuration file:/etc/resolv.conf 2) Hostname Configuration hostname configuration file:/etc/sysconfig/network (centos6.x) centos7:hostnamectl, and its/etc/hostname3) Network card profile Redhat and related distributions, ifcfg-ifname configuration file format as follows: /etc/sysconfig/network-scripts/ifcfg-device-namedevice=ifname: This configuration file is the device name and is consistent with device-name in this article Bootproto={bootp|dhcp|static|none}: Get the IP address method hwaddr=00:11:22:22:33:44:be:de:66 &NBSP: Device MAC address nm_controlled={yes|no}: whether to accept networkThe Manager service script configures whether this device;onboot={yes|no}: automatically activates this interface during the boot process type={ethernet| bridge}: network interface type uuid= : Native UUIDIPADDR=&NBSP;:IP address netmask=: Subnet mask gateway=: Gateway dns1= &NBSP: Domain name resolution DNS2=&NBSP;&NBSP;&NBSP;: Domain name resolution ipv6init={yes|no}userctl={yes|no}: allow normal use to control this interface Peerdns={yes|no}: Do not accept DHCP server-assigned DNS server address 4) Route command: Route view and Management View route entry:route -n add: route add [-net |-host] target [netmask nm] [gw gw] [dev] [if] Delete:route del -net instance:route add -net 10.0.0.0/8 gw 192.168.0.1 Route del -net 10.0.0.0/8
Netstat command:
netstat command: netstat - print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships option: -r: Show kernel routing table -n: number format -a: Show all -t:tcp related connections &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;-U:UDP Connection -l:listen Monitoring status &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;-E: Extended format -p: Displays PIDNETSTAT commands for related processes common combinations:-tan -uan -tnl -unl -tunpl display Network Connections: NETSTAT&NBSP;[-TCP]&NBSP;[-T]&NBSP;[-UDP|-U] Transport Layer protocol: &NBSP;&NBSP;&NBSP;TCP: Connection-oriented, three-time handshake udp: Non-oriented connection, Send data messages Display interface statistics directly: allInterface: Netstat -i netstat -ieth0 Specify interface: Netstat -iifup/ifdown command: Note: Through the configuration file/etc/sysconfig/ Nework-scripts/ifcfg-iface to identify the interface complete configuration hostname command: View:hostname configuration:hostname hostname Hostnamectl command: hostnamectl status: Display hostname information hostnamectl set-hostname: set hostname, permanently valid
Configure the DNS service to point to and test
1) configuration file:/etc/resolv.conf nameserver dns_server_ip namesever 8.8.8.8 2) How to test dig-t A domain name (resolve domain name to IP) dig-x IP (resolves IP to domain Extension
This article is from "Wake up your not alarm clock but dream" blog, please be sure to keep this source http://purify.blog.51cto.com/10572011/1839349
Linux Network properties and their configuration