51. Linux Shell Command, route, ifconfig

Source: Internet
Author: User

3. Route

1) route [-nee]

ROute add [-net |-host] [domain or host] netmask [mask] [GW | Dev]

Route del [-net |-host] [domain or host] netmask[Mask] [GW | Dev]

2) Option

①-N: not usedProtocolOr host name, directly using IP or port number;

②-Ee: use more detailed information to display

Add and delete (DEL) Route parameters:

①-Net: indicates that the followed route is a domain;

②-Host: The route connecting to a single host;

③Netmask:Subnet Mask;

④GW: Short for gateway;

⑤DeVSpecify the network card to connect, followed by eth0, etc.

For the description of flags in the result, see [1 ].

3) Example

1) Route del-net 169.254.0.0 netmask 255.255.0.0 Dev eth0 // you must write all the items in the route table.

2) Route add-net 192.168.100.0 netmask 255.255.255.0 Dev eth0

3) Route add default GW 192.168.1.250

/Etc/init. d/network restart // all the preceding settings are invalid. The ifcfg-ethx settings are the main ones.

Default = 0.0.0.0/0.0.0.0

4. ifconfig, IFUP, and ifdown

1) Description

⑥Ifconfig {interface} {up | down}

7.Ifconfig interface address {options}

You can set a virtual network interface to specify multiple IP addresses for a network interface. The virtual interface is eth0: 0, eth0: 1, eth0: 2 ..... eth1n. For example, we can use different IP addresses to run multiple HTTPd servers.

2) Option

Interface: network card number, including eth0, eth1, ppp0, etc.

Options ::

①Up, down: Start (up) or close (down) the network interface (no parameters are involved)

②MTU: Different MTU values can be set, for example, MTU 1500 (unit: byte)

③Netmask: ChildNetmask;

④Broadcast: broadcast address

3) Example

Ifconfig eth0 192.168.100.100 // set the IP address of eth0

Ifconfig eth0 192.168.100.100 netmask implements 255.255.128 MTU 8000

Ifconfig eth0: 0 192.168.50.50 // ETH0: 0. On this physical Nic, simulate another network.AddressThat is, multiple IP addresses are set on a network card.

Ifconfig eth0: 0 down

/Etc/init. d/network restart//Just nowOfIf all settings are invalid, the ifcfg-ethx settings are used as the master.

/Etc/sysconfig/Network/config

Ifconfig eth1: 0 192.168.1.250 HW ether 00: 11: 00: 00: 11: 44 netmask 255.255.255.0 broadcast 192.168.1.255 up/HW follows the network interface type, ether indicates Ethernet

4) IFUP, ifdown is two feetIn the/etc/sysconfig/network-scripts directory., And start and close with the corresponding script.

IFUP | ifdown {interface}

5. ip command [1]

Reference

[1] Explain the commands

Http://linux.vbird.org/linux_server/0140networkcommand.php#netstat

[2] better explanation of TCP State, such as time_wait: the socket is waiting after close to handle packets still in the network.

Http://linux.die.net/man/8/netstat

[3]Http://www.linuxso.com/command/netstat.html

[4] traceroute usage example

Http://blog.sina.com.cn/s/blog_4895289e010009bn.html

Nice to talk about the ins and outs

Http://blog.chinaunix.net/space.php? Uid = 20172731 & Do = Blog & cuid = 159630

[5] ifconfig usage

Http://www.cublog.cn/u2/78880/showart_1879201.html

Related Article

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.