Linux Network Command detailed

Source: Internet
Author: User

1 ifconfig command

Format: ifconfig {inerface} {options}

The options parameters are: Up,down,mtu,netmask,broadcast

Separate ifconfig command: View all ports on the network;

Example 1:ifconfig eth0 192.168.1.0 netmask 255.255.0.0 MTU 8000 (IP address of configuration port eth0)

Example 2:ifconfig eth0:0 192.168.50.50 (indicates that a network interface is emulated in eth0)

Note: The ifconfig configuration will only take effect temporarily, the machine restarts or/etc/init.d/network restart, it will invalidate the ifconfig configuration;

2 ifup ifdown Command

Format: IFUP interface; Ifdown interface

Example: Ifup eth0;ifdown eth0

In fact, these two commands are scripts, they are to read the/etc/sysconfig/network-scripts/ifcfg-eth* file;

3 Route Command

Format: route or route-n See routing information

Route add [-host or-net] netmask GW or dev

Route del [-host or-net] netmask GW or dev

Example: Route add-net 192.168.100.0 netmask 255.255.255.0 Dev eth0

Example: Route add default GW 192.168.1.250

Note: ifconfig eth0 192.168.1.0 or route add-net 192.168.1.0 mask 255.255.255.0 Dev eth0 are temporarily active for networking and testing, and when the test is complete, use/E Tc/init.d/network Restart restore the original default network can be;

4 more powerful IP commands

(IP link setting)

Format: IP link set [device] [action and parameters]

Example: IP link Show (simply look at the device's related hardware information)

Example: IP link show eth0

Example: IP link set eth0 up; IP link set eth0 down; IP link set eth0 MTU 1000 (open and close ports and device MTU)

Example: IP link set eth0 down> IP link set eth0 name Vbird >IP link Show (change the name of the eth0 before changing the NIC Eth0)

(IP address)

Format: IP address [add|del] [IP] [dev] [related parameters]

Example: IP address Show (eth*)

Example: IP address add 192.168.50.50/24 broadcast dev eth0 label Eth0:vbird (add a network interface)

Example: IP address del 192.168.50.50/24 dev eth0

(IP route)

Example: IP route Show

Example: IP route add 192.168.5.0/24 dev eth0 (add route, mainly native direct communication network)

Example: IP route add 192.168.10.0/24 via 192.168.5.100 Dev eth0 (add route to external, via router)

Example: IP route add default via 192.168.1.254 dev eth0 (add route, by 192.168.1.254 this host communication, actually this host is my default router (gateway))

Example: IP route del 192.168.5.0/24;ip route del 192.168.10.0/24 (delete route)

Wireless network command: Iwlist (wireless card for wireless network AP detection and acquisition of relevant data) Iwconfig (wireless card configuration)

DHCP client command: dhclient: dhclient eth0

Linux Network Command detailed

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.