In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article to share with you is about how to use the ifconfig command in Linux, Xiaobian feel quite practical, so share to everyone to learn, I hope you can gain something after reading this article, not much to say, follow Xiaobian to see it.
Linux has many network commands, some of which are like ping,
ftp, telnet, route, netstat, etc. can also be seen on other operating systems, but there are also some Unix/Linux unique commands, such as ifconfig,
finger, mail, etc. One of the characteristics of Linux network operation commands is that there are many command parameter options and functions, and a command can often achieve the functions of other commands.
ifconfig
1. role
ifconfig is used to view and change the addresses and parameters of network interfaces, including IP addresses, netmasks, broadcast addresses, and access rights are superuser.
2. format
ifconfig -interface [options] address
3. main parameters
-interface: The specified network interface name, such as eth0 and eth2.
up: Activates the specified network interface card.
down: Closes the specified network interface.
broadcast address: Set the broadcast address of the interface.
pointopoint: Enable point-to-point mode.
address: Sets the IP address of the specified interface device.
netmask address: Sets the subnet mask of the interface.
4. application notes
ifconfig is a command-line tool used to set up and configure network cards. This is a command that must be mastered in order to configure the network manually. The advantage of using this command is that there is no need to restart the machine. To assign the eth0 interface IP address 207.164.186.2 and activate it immediately, use the following command:
#fconfig eth0 210.34.6.89 netmask 255.255.255.128 broadcast 210.34.6.127
the
The command sets the IP address, netmask, and local broadcast address of the network card eth0. If you run the ifconfig command without any arguments, this command will display all active interfaces of the machine.
Information. Commands with the "-a" argument display information for all interfaces, including those that are not active. Note that network device parameters configured with the ifconfig command will be lost after the machine restarts.
If you want to suspend the work of a network interface, you can use the down parameter:
#ifconfig eth0 down
ip
1. role
IP is a powerful network configuration tool in the iproute2 package that replaces traditional network management tools such as ifconfig, route, etc., with superuser privileges. Almost all Linux distributions support this command.
2. format
ip [OPTIONS] OBJECT [COMMAND [ARGUMENTS]]
3. main parameters
OPTIONS are options that modify ip behavior or change its output. All options start with a-character and are divided into long and short forms. IP currently supports the options shown in Table 1.
OBJECT is an object for which the administrator acquires information. See Table 2 for the current IP recognition objects.
Table 1 IP supported options
-V,-Version Print the version of ip and exit.
-s,-stats,-statistics Output more detailed information. If this option appears twice or more, the output will be more detailed.
-f,-family This option is followed by the protocol type, including inet, inet6, or link, emphasizing the type of protocol used. If there is not enough information to tell ip which protocol to use, ip uses the default value inet or any. link is special because it means that no network protocol is involved.
-4 is short for-family inet.
-6 is short for-family inet6.
-0 is short for-family link.
-o,-oneline Use a single line of output for each line of records, and return lines with characters instead. If you need to use wc, grep, etc. tools to process ip output, you will use this option.
-r,-resolve Query DNS, replace host IP address with host name obtained
COMMAND
Sets the action to be performed on the specified object, depending on the type of object. In general, ip supports the addition (add), deletion (delete) and display (show or list) of objects. some
Object does not support these operations or has some other command. For all objects, users can use the help command for help. This command lists the syntax of commands and parameters supported by this object. if no
If there is an operation command for the specified object, ip will use the default command. In general, the default command is list, and if the object cannot be listed, the help command is executed.
ARGUMENTS
are parameters of commands that depend on objects and commands. IP supports two types of parameters: flag and parameter. flag consists of one keyword;parameter consists of one
Keyword plus a numerical value. For convenience, each command has a default parameter that can be ignored. For example, the dev parameter is the default parameter for the ip link command, so ip link ls
eth0 equals ip link ls dev eth0. We will describe the use of each command in detail later, and the default parameters of the command will be marked with default.
4. application example
Add IP address 192.168.2.2/24 to eth0 NIC:
#ip addr add 192.168.1.1/24 dev eth0
Discard all datagrams with source addresses belonging to the 192.168.2.0/24 network:
#ip rule add from 192.168.2.0/24 prio 32777 reject
The above is how to use the ifconfig command in Linux. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.