[Network Configuration related]--ifconfig command, IP command, Route command

Source: Internet
Author: User

Ifconfig command

1. View the details of the network card that has been activated

# ifconfig eth0 Link encap:ethernet HWaddr 00:30:67:f2:10:cf inet addr:10.0.0.253 bcast:10.0.255.255 Mask : 255.255.0.0inet6 ADDR:FE80::230:67FF:FEF2:10CF/64 scope:linkup broadcast RUNNING multicast MTU:1500 Metric:1RX packets:4663517 errors:0 dropped:0 overruns:0 frame:0tx packets:6122850 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1852734274 (1.7 gib) TX bytes:1487018040 (1.3 Gib)

HWaddr : The hardware address of the NIC, which is the MAC address

inet Addr: IP Address of IPV4
Bcast: Broadcast Address
Mask: Subnet Mask
Inet6 Addr: IPv6 Address
MTU: Maximum Transmission Unit
Metric: Cost to calculate routing
RX: Indicates the network boot-to-current packet acceptance (receive)
Packets: Indicates the number of packets received
Errors: Indicates the number of errors received by the packet
dropped: Indicates the number of packets dropped
Overruns: Indicates the number of packets that were lost due to excessive speed when receiving
Frame: Indicates the number of packets lost when a frame error occurred
TX: From the network boot to the current delivery situation (transmit)
Collisions: The number of conflicting packets
Txqueuelen: The size of the send queue
RX byte, TX byte: Total transmit/Receive quantity

Note: You can see whether the network is very busy by Rx and TX
Note: errors:0 dropped:0 overruns:0 frame:0, all 0 shows that the network is relatively stable
Note: Collisions occurred too many times to indicate that the network condition is not very good

2. Temporary IP configuration

# ifconfig eth0 172.16.0.118 netmask 255.255.0.0# ifconfig eth0 172.16.0.118/16# ifconfig eth0:1 172.16.0.119/16  Specifying sub-interfaces

  

3. Configure the temporary MAC address (the MAC address in the configuration file cannot be changed directly, or it will not be written)

  

4. Simply start and close the network interface

# Ifdown eth0; Ifup eth0

  

5. Turn off the temporary network interface

# ifconfig Eth0:1 Down

  

6. Enabling and shutting down the ARP protocol

# ifconfig eth0  arp# ifconfig eth0  -arp

7. Set the value of the transmission Unit MTU

# ifconfig  eth0  MTU  1000

  

IP command

1. About additional IP settings: IP add temporarily Add/Remove IP address

# IP add add 192.168.1.126/24  dev eth0:0  # ip Add del  192.168.1.126/24  dev eth0:0# ip add  show# IP add  show eth0

  

2. Related Settings for interface devices: IP link

# IP Link set eth0 up        //open NIC # IP link set eth0      down//off NIC # IP link set eth0 name Lyj  //NIC renamed # IP link set E Th0 MTU  //Change MTU value
# IP link Show//Display all interface information 1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN Link/loopback 00:0 0:00:00:00:00 BRD 00:00:00:00:00:002:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up QL En link/ether 52:54:00:d6:81:26 brd ff:ff:ff:ff:ff:ff# ip-s link show eth0//Display interface Traffic information 2:eth0: <broadcast,mult    Icast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 52:54:00:d6:81:26 BRD FF:FF:FF:FF:FF:FF   Rx:bytes packets Errors dropped overrun Mcast 107193541 1118624 0 0 0 0 tx:bytes Packets Errors dropped carrier Collsns 116799818 1093559 0 0 0 0# ip-s-S link show eth0//More than one-s to indicate more detail Information 2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 52:54:00:d6:       81:26 BRD FF:FF:FF:FF:FF:FF rx:bytes packets errors dropped overrun Mcast 107031087 1116940 0 0 0 0 RX Errors:lenGth CRC frame FIFO missed 0 0 0 0 0 tx:bytes packets Errors Droppe               D Carrier Collsns 116526036 1091941 0 0 0 0 TX errors:aborted FIFO window heartbeat 0 0 0 0

  

3. Related Settings for routing: IP route

# IP route Show  //view routing information 10.0.0.0/16 dev eth0  proto kernel  scope link  src 10.0.10.158 169.254.0.0/16 Dev E Th0  Scope link  metric 1002 default via 10.0.0.254 Dev eth0 # ip route add 10.10.10.0/24 via 172.16.0.254  Dev E Th0  //Add a route # IP route del 10.10.10.0/24                             //delete a route # IP route add default via 172.16.0.254  dev eth0     //Add Default route # IP route del default  via 172.16.0.254   dev eth0   //delete default route

4. Other

# IP Monitor all   //a computer on the local area network can be classified as reachable or stale[neigh]10.104.64.1 dev eth0 lladdr fe:ee:ff:ff:ff:ff according to its status stale[neigh]10.104.64.1 Dev eth0 lladdr fe:ee:ff:ff:ff:ff reachable[neigh]10.104.64.1 Dev eth0 lladdr fe:ee:ff:ff:ff:ff stale[neigh]10.104.64.1 Dev eth0 lladdr fe:ee:ff:ff:ff:ff reachable[neigh]10.104.64.1 Dev eth0 lladdr fe:ee:ff:ff:ff:ff stale[neigh]10.104.64.1 Dev eth0 lladdr fe:ee:ff:ff:ff:ff reachable# IP neighbour  // View the MAC address of the device that is accessing your local area network 10.104.64.1 dev eth0 lladdr fe:ee:ff:ff:ff:ff REACHABLE

  

Route command  

1. View the routing status

# route-nkernel IP routing tabledestination Gateway genmask Fl AGS Metric Ref use Iface10.104.64.0 0.0.0.0 255.255.192.0 U 0 0 0 eth0169.254.0.0 0.0        .0.0 255.255.0.0 U 1002 0 0 eth00.0.0.0 10.104.64.1 0.0.0.0 UG 0 0 0 eth0 

Destination: Destination
genmask: Network mask for routing
Gateway: Which gateways the network connects to (next hop)
0.0.0.0: Indicates that the route is sent directly by native computer, that is, the Mac of the LAN
IP: Indicates that the route requires a router (gateway) forwarding to send
Flags: Flags
U up indicates that this route is currently in the boot state
H host, which indicates that the gateway is a host
G Gateway, which indicates that this gateway is a router
R reinstate route, re-initialized with dynamic routing
D dynamically, this route is dynamically written to
M Modified, this route is dynamically modified by the route daemon or director
! Indicates that this route is currently in a closed state
Iface: interface for this route-passing packet

2. Delete/Set route

# route add-net  172.16.0.0/16  netmask 255.255.0.0  GW 172.16.0.254  dev eth0    //Add a route- NET followed by a network # route del  -net  172.16.0.0/16  netmask 255.255.0.0  GW 172.16.0.254  Dev eth0   Remove a route # route  Add  -host  172.16.10.10 GW 192.168.1.1   //-host Connect to a single host route # route  Add  default GW  192.168.1.1             //Add the defaults route GW specifies the next hop  # route  del   default  GW 192.168.1.1  

  

 

[Network Configuration related]--ifconfig command, IP command, Route command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.