Introduced
Network, is a very big topic. If you want to learn about the OSI seven layer model and want to see what the Network Bridge, routers and other networking devices look like, you may be disappointed here. However, for those who are not getting started or just getting started, English is not good for the Internet, you find the right article. Below, let me introduce the common web-related commands and configuration files in CentOS, so that you can easily configure the Internet.
ifcfg Family: Net-tools
This is an ancient family that accesses and changes the kernel network configuration through PROCFS (/PROC) and IOCTL system calls. After CENTOS6, it is recommended to replace it with the Iproute2 family, but as a classic network series, it is worthwhile to take a moment to understand it.
ifco
Ifconfig [interface] ifconfig interface [aftype] options | address ... # ifconfig: Display the active status of the NIC interface; # ifconfig -a: Displays all interfaces, including the inactive interface; # ifconfig iface ip/mask [up|down] Example: enable eth0 this NIC: Ifconfig eth0 up # ifconfig IFACE IP netmask NETMASK example: to eth0 this NIC set IP to 1.1.1.1, subnet mask is 255.0.0.0: ifconfig eth0 1.1.1.1 netmask 255.0.0.
Route: Routing Table Management
Routing Entry Type: host route: The destination address is a single ip; Network routing: Destination address is IP network; Default route: target for any network,0.0.0.0/0.0.0.0 view:# route -n Add:route add [-net|-host] target [netmask nm] [gw GW] [[dev] If] Example: 1. Add a new route to 10.0.0.0/8, the gateway is 192.168.234.1, the corresponding network card is eth1; route add -net 10.0.0.0/8 gw 192.168.234.1 dev eth1 or route add -net 10.0.0.0/255.0.0.0 Gw 192.168.234.1 2. Add a new default route, gateway to 192.168.234.1 route add default gw 192.168.234.1 Delete: route del  [-NET|-HOST] TARGET  [GW GW]  [NETMASK NM]  [[DEV] IF] Example: route del -net 10.0.0.0/8 gw 192.168.10.1 route del default
Note: when adding a route entry, the gateway must be in the same network segment as the associated network card IP, or the network is unreachable error will occur.
ARP: administering the ARP cache table
View ARP table: Arp-en add static ARP entry: arp-s 192.168.234.100 00:0c:29:c0:5a:ef Delete static ARP entry: arp-d 192.168.234.100
Netstat: status and Statistics view
Show routing table: Netstat-rn-r: Show kernel route table-N: Number format display network connection: netstat [options] options:-T:TCP protocol related connection, connection its status; FSM (finate state machine);-U:UDP related connection-w:raw socket related connection-L: Connection in listening state-A: all states-N: Digital format displays IP and port;-e: Extended Format-P: Displays related processes and PID; common combinations:-tan,-uan,-TNL,-UNL,-TUNLP
Ifup/ifdown command:
The configuration file/etc/sysconfig/network-scripts/ifcfg-iface to identify the interface and complete the configuration; Example: Ifdown eth0 + ifup eth0 <==> Read profile restart Eth0
This is the connection to the kernel via the network link socket interface. The network link interface is lighter than the/proc interface, and more importantly, binding operations such as source-based routing, quality of service, and so on, must be iproute2 to complete. so you're still using net-tools, and it's time to switch to Iproute2 .
Ip:
Addr: Address and mask;
Link: interface
Route: Routing
viewing ARP Tables
You can use these commands to display the ARP table for the kernel.
Using Net-tools:
$ arp-an
Using Iproute2:
$ IP neigh
SS: Status and Statistics view
This article is from the "home of small Mosquitoes" blog, be sure to keep this source http://timber.blog.51cto.com/7677013/1728750
Common commands and configuration files for Linux networks